VLBIImagePriors

Documentation for VLBIImagePriors.

VLBIImagePriors.AngleTransformType
AngleTransform

A transformation that moves two vector x and y to an angle θ. Note that is x and y are normally distributed then the resulting distribution in θ is uniform on the circle.

VLBIImagePriors.CenteredImageType
CenteredImage(x, y, σ, p)

Regularizes a general image prior p such that the center of light is close the the origin of the imag. After regularization the log density of the prior is modified to

\[ \log p(I) \to \log p(I) - \frac{(x_C^2 + y_C^2)^2}{2\sigma\^2} N_x N_y\]

where N_x and N_y are the number of pixels in the x and y direction of the image, and $x_C, y_C$ are the center of light of the image I.

VLBIImagePriors.DiagonalVonMisesType
DiagonalVonMises(μ::Real, κ::Real)
DiagonalVonMises(μ::AbstractVector{<:Real}, κ::AbstractVector{<:Real})

Constructs a Von Mises distribution, with mean μ and concentraion parameter κ. If μ and κ are vectors then this constructs a independent multivariate Von Mises distribution.

Notes

This is a custom implementation since the version in Distributions.jl has certain properties that do not play well (having an support only between [-π+μ, π+μ]) with usual VLBI problems. Additionally this distribution has a special overloaded product_distribution method so that concatenating multiple DiagonalVonMises together preserves the type. This is helpful for Zygote autodiff.

VLBIImagePriors.ImageDirichletType
ImageDirichlet(α::AbstractMatrix)
ImageDirichlet(α::Real, ny, nx)

A Dirichlet distribution defined on a matrix. Samples from this produce matrices whose elements sum to unity. This is a useful image prior when you want to separately constrain the flux. The α parameter defines the usual Dirichlet concentration amount.

Notes

Much of this code was taken from Distributions.jl and it's Dirichlet distribution. However, some changes were made to make it faster. Additionally, we use define a custom rrule to speed up derivatives.

VLBIImagePriors.ImageSimplexType
ImageSimplex(ny,nx)

This defines a transformation from ℝⁿ⁻¹ to the n probability simplex defined on an matrix with dimension ny×nx. This is a more natural transformation for rasterized images, which are most naturally represented as a matrix.

Notes

Much of this code was inspired by TransformVariables. However, we have specified custom rrules using Enzyme as a backend. This allowed the simplex transform to be used with Zygote and we achieved an order of magnitude speedup when computing the pullback of the simplex transform.

VLBIImagePriors.ImageSphericalUniformType
ImageSphericalUniform(nx, ny)

Construct a distribution where each image pixel is a 3-sphere uniform variable. This is useful for polarization where the stokes parameters are parameterized on the 3-sphere.

Currently we use a struct of vectors memory layout. That is the image is described by three matrices (X,Y,Z) grouped together as a tuple, where each matrix is one direction on the sphere, and we require norm((X,Y,Z)) == 1.

VLBIImagePriors.ImageUniformType
ImageUniform(a::Real, b::Real, nx, ny)

A uniform distribution in image pixels where a/b are the lower/upper bound for the interval. This then concatenates ny×nx uniform distributions together.

VLBIImagePriors.SphericalUnitVectorType
SphericalUnitVector{N}()

A transformation from a set of N+1 vectors to the N sphere. The set of N+1 vectors are inherently assumed to be N+1 a distributed according to a unit multivariate Normal distribution.

Notes

For more information about this transformation see the Stan manual. In the future this may be depricated when is merged.

VLBIImagePriors.WrappedUniformType
WrappedUniform(period)

Constructs a potentially multivariate uniform distribution that is wrapped a given period. That is

d = WrappedUniform(period)
logpdf(d, x) ≈ logpdf(d, x+period)

for any x.

If period is a vector this creates a multivariate independent wrapped uniform distribution.