Skip to content

ScateringOptics.jl API

Index

Docstrings

ScatteringOptics.Params_Johnson2018 Constant

Best-fit parameters of the dipole scattering model derived in Johnson et al. 2018

source

ScatteringOptics.AbstractKzetaFinder Type
julia
AbstractKzetaFinder

This is an abstract data type to set up equations and provide a solver for the concentration parameter k_ζ for an anistropic interstellar scattering model. See Psaltis et al. 2018, arxiv::1805.01242v1 for details.

Mandatory methods

  • kzetafinder_equation(kzeta, finder::AbstractKzetaFinder): should privide a equation where k will be derived.

Methods provided

  • findkzeta_exact(finder::AbstractKzetaFinder): solves the equation for k_ζ,2 given the set of parameters in the finder.

source

ScatteringOptics.AbstractScatteringKernel Type
julia
abstract type AbstractScatteringKernel{T} <: ComradeBase.AbstractModel

An abstract Comrade Sky Model for the diffractive scattering kernel. These are usually primitive models, and are usually analytic in Fourier but not analytic in the image domain. As a result a user only needs to implement the following methods.

  • visibility_point

  • radialextent

source

ScatteringOptics.AbstractScatteringModel Type
julia
abstract type AbstractScatteringModel

An abstract anistropic scattering model based on a thin-screen approximation. In this package, we provide a reference implementation of the dipole (DipoleScatteringModel), von Mises (vonMisesScatteringModel) and periodic Box Car models (PeriodicBoxCarScatteringModel) all introduced in Psaltis et al. 2018.

Mandatory fields The scattering model will be fundamentally governed by the following parameters. Ideally, a subtype of this abstract model should have a constructor only with these arguments.

  • α::Number: The power-law index of the phase fluctuations (Kolmogorov is 5/3).

  • rin::Number: The inner scale of the scattering screen in cm.

  • θmaj::Number: FWHM in mas of the major axis angular broadening at the specified reference wavelength.

  • θmin::Number: FWHM in mas of the minor axis angular broadening at the specified reference wavelength.

  • ϕ::Number: The position angle of the major axis of the scattering in degree.

  • λ0::Number: The reference wavelength for the scattering model in cm.

  • D::Number: The distance from the observer to the scattering screen in cm.

  • R::Number: The distance from the source to the scattering screen in cm.

Furthermore the following parameters need to be precomputed.

  • M::Number: Magnification parameter, defined as D/R

  • Qbar::Number: The amplitudes of fluctuations. Given by calc_Qbar(α, rin_cm, λ0_cm, M, θmaj_rad, θmin_rad)

  • C::Number: The scaling factor of the power spectrum. Given by calc_C(α, rin_cm, λ0_cm, Qbar)

  • D1maj::Number: given by calc_D1(α, Amaj, Bmaj)

  • D2maj::Number: given by calc_D2(α, Amaj, Bmaj)

  • D1min::Number: given by calc_D1(α, Amin, Bmin)

  • D2min::Number: given by calc_D2(α, Amin, Bmin)

Optional Fields Followings are currently not used by methods but may be useful to have.

  • A::Number: Asymmetry parameter θmaj_mas/θmin_mas

  • ζ0::Number: Another asymmetry parameter. Given by calc_ζ0(A)

  • ϕ0:: position angle (measured from Dec axis in CCW) converted to a more traditional angle in radians measured from RA axis in CW

  • Amaj::Number: related to the asymmetric scaling of the kernel. given by calc_Amaj(rin_cm, λ0_cm, M, θmaj_rad)

  • Amin::Number: related to the asymmetric scaling of the kernel. given by calc_Amin(rin_cm, λ0_cm, M, θmin_rad)

  • Bmaj::Number: calc_Bmaj(α, ϕ0, Pϕfunc, B_prefac)

  • Bmin::Number: calc_Bmin(α, ϕ0, Pϕfunc, B_prefac)

Mandatory Method

  • Pϕ(sm::ScatteringModel, ϕ): Probability Distribution for the wondering of the direction of the magnetic field centered at orientation ϕ0.

source

ScatteringOptics.ApproximatedScatteringKernel Type
julia
struct ApproximatedScatteringKernel{T, S, N} <: AbstractScatteringKernel{T}

A Comrade VLBI Sky Model for the scattering kernel based on a Scattering Model sm <: AbstractScatteringModel using the fast approximation formula in Psaltis et al. (2018).

If T isn't given, T defaults to Float64

source

ScatteringOptics.DipoleScatteringModel Type
julia
struct DipoleScatteringModel{T<:Number} <: AbstractScatteringModel

An anistropic scattering model based on a thin-screen approximation. This scattering model adopts the dipole field wonder described in Psaltis et al. 2018.

** Keywords for the constructor ** The default numbers are based on the best-fit parameters presented in Johnson et al. 2018.

  • α::Number: The power-law index of the phase fluctuations (Kolmogorov is 5/3).

  • rin_cm::Number: The inner scale of the scattering screen in cm.

  • θmaj_mas::Number: FWHM in mas of the major axis angular broadening at the specified reference wavelength.

  • θmin_nas::Number: FWHM in mas of the minor axis angular broadening at the specified reference wavelength.

  • ϕ_deg::Number: The position angle of the major axis of the scattering in degree.

  • λ0_cm::Number: The reference wavelength for the scattering model in cm.

  • D_kpc::Number: The distance from the observer to the scattering screen in kpc.

  • R_kpc::Number: The distance from the source to the scattering screen in kpc.

source

ScatteringOptics.Dipole_KzetaFinder Type
julia
struct Dipole_KzetaFinder{T<:Number} <: ScatteringOptics.AbstractKzetaFinder

The finder of the concentration parameter k_ζ,2 for dipole anistropic scattering models. See Psaltis et al. 2018, arxiv::1805.01242v1 for details. The equation for k_ζ,2 is given by the equation 43 of Psaltis et al. 2018.

Mandatory fields

  • α::Number: The power-law index of the phase fluctuations (Kolmogorov is 5/3).

  • A::Number: The anisotropy parameter of the angular broaderning defined by θmaj/θmin.

source

ScatteringOptics.ExactScatteringKernel Type
julia
struct ExactScatteringKernel{T, S, N} <: AbstractScatteringKernel{T}

A Comrade VLBI Sky Model for the scattering kernel based on a Scattering Model sm <: AbstractScatteringModel using the exact formula in Psaltis et al. (2018).

By default if T isn't given, T defaults to Float64

source

ScatteringOptics.PeriodicBoxCarScatteringModel Type
julia
struct PeriodicBoxCarScatteringModel{T<:Number} <: AbstractScatteringModel

An anistropic scattering model based on a thin-screen approximation. This scattering adopts the periodic boxcar field wonder described in Psaltis et al. 2018.

** Keywords for the constructor ** The default numbers are based on the best-fit parameters presented in Johnson et al. 2018.

  • α::Number: The power-law index of the phase fluctuations (Kolmogorov is 5/3).

  • rin_cm::Number: The inner scale of the scattering screen in cm.

  • θmaj_mas::Number: FWHM in mas of the major axis angular broadening at the specified reference wavelength.

  • θmin_nas::Number: FWHM in mas of the minor axis angular broadening at the specified reference wavelength.

  • ϕ_deg::Number: The position angle of the major axis of the scattering in degree.

  • λ0_cm::Number: The reference wavelength for the scattering model in cm.

  • D_kpc::Number: The distance from the observer to the scattering screen in pc.

  • R_kpc::Number: The distance from the source to the scattering screen in pc.

source

ScatteringOptics.PeriodicBoxCar_KzetaFinder Type
julia
struct PeriodicBoxCar_KzetaFinder{T<:Number} <: ScatteringOptics.AbstractKzetaFinder

The finder of the concentration parameter k_ζ,3 for the Periodic Box Car anistropic scattering model. See Psaltis et al. 2018, arxiv::1805.01242v1 for details. The equation for k_ζ,3 is given by the equation 47 of Psaltis et al. 2018.

Mandatory fields

  • A::Number: The anisotropy parameter of the angular broaderning defined by θmaj/θmin.

source

ScatteringOptics.PhaseScreenPowerLaw Type
julia
$(TYPEDEF)

Power spectrum model of ISM fluctuations, for use in generating a RefractivePhaseScreen object. Requires an AbstractScatteringModel for scattering parameters as well as image x and y pixel sizes. Optional input of velocity in x and y direction for moving phase screen.

Fields

FIELDS

source

ScatteringOptics.RefractivePhaseScreen Type
julia
RefractivePhaseScreen(sm, Nx, Ny, dx, dy, Vx_km_per_s=0.0, Vy_km_per_s=0.0)

An abstract type for generating a refractive phase screen model corresponding to an image and computing the scattered average image.

  • sm <: AbstractScatteringModel

  • Nx: image size in x axis

  • Ny: image size in y axis

  • dx: pixel size in x direction (in radians)

  • dy: pixel size in y direction (in radians)

Vx_km_per_s and Vy_km_per_s are optional for moving phase screen.

source

ScatteringOptics.vonMisesScatteringModel Type
julia
struct vonMisesScatteringModel{T<:Number} <: AbstractScatteringModel

An anistropic scattering model based on a thin-screen approximation. This scattering adopts the von Mises field wonder described in Psaltis et al. 2018.

** Keywords for the constructor ** The default numbers are based on the best-fit parameters presented in Johnson et al. 2018.

  • α::Number: The power-law index of the phase fluctuations (Kolmogorov is 5/3).

  • rin_cm::Number: The inner scale of the scattering screen in cm.

  • θmaj_mas::Number: FWHM in mas of the major axis angular broadening at the specified reference wavelength.

  • θmin_nas::Number: FWHM in mas of the minor axis angular broadening at the specified reference wavelength.

  • ϕ_deg::Number: The position angle of the major axis of the scattering in degree.

  • λ0_cm::Number: The reference wavelength for the scattering model in cm.

  • D_kpc::Number: The distance from the observer to the scattering screen in pc.

  • R_kpc::Number: The distance from the source to the scattering screen in pc.

source

ScatteringOptics.vonMises_KzetaFinder Type
julia
struct vonMises_KzetaFinder{T<:Number} <: ScatteringOptics.AbstractKzetaFinder

The finder of the concentration parameter k_ζ,1 for the von Mises anistropic scattering model. See Psaltis et al. 2018, arxiv::1805.01242v1 for details. The equation for k_ζ,1 is originally given by the equation 37 of Psaltis et al. 2018, but this is different in the implementation of Johnson et al. 2018 in eht-imaging library. We follow eht-imaging's implementation.

Mandatory fields

  • A::Number: The anisotropy parameter of the angular broaderning defined by θmaj/θmin.

source

ScatteringOptics.Dϕ_approx Method
julia
Dϕ_approx(sm::AbstractScatteringModel, λ::Number, x::Number, y::Number)

Masm approximate phase structure function Dϕ(r, ϕ) at observing wavelength λ, first converting x and y into polar coordinates. Based on Equation 35 of Psaltis et al. 2018.

source

ScatteringOptics.Dϕ_exact Method
julia
Dϕ_exact(sm::AbstractScatteringModel, λ::Number, x::Number, y::Number)

Masm exact phase structure function Dϕ(r, ϕ) at observing wavelength λ, first converting x and y into the polar coordinates

source

ScatteringOptics.calc_Dmaj Method
julia
Dmaj(r, sm::AbstractScatteringModel)

Masm D_maj(r) for given r. Based on Equation 33 of Psaltis et al. 2018

source

ScatteringOptics.calc_Dmin Method
julia
calc_Dmin(r, sm::AbstractScatteringModel)

Masm D_min(r) for given r. Based on Equation 34 of Psaltis et al. 2018

source

ScatteringOptics.dDϕ_dz Method
julia
dDϕ_dz(sm::AbstractScatteringModel, λ::Number, r::Number, ϕ::Number, ϕq)

Differential contribution to the phase structure function.

source

ScatteringOptics.ensembleaverage Method
julia
ensembleaverage(sm::AbstractScatteringModel, skymodel::AbstractModel, νmodel; use_approx=true)

Compute the ensemble-average image of the input skymodel skymodel using the scattering model sm.

Arguments

  • sm::AbstractScatteringModel: An instance of the scattering model.

  • skymodel::AbstractModel: An instance of AbstractModel.

  • νmodel::Number=c_cgs: The frequency in Hz to compute the scattering kernel.

  • use_approx::Bool=true: If true, the approximate analytic formula is used to compute the scattering kernel. Otherwise semi-analytic formula is used.

source

ScatteringOptics.ensembleaverage Method
julia
ensembleaverage(sm::AbstractScatteringModel, imap::IntensityMap; νref=c_cgs, use_approx=true)

Compute the ensemble-average image of the input intensity map imap using the scattering model sm. The frequency of the image, if exists in its metadata, is used to compute the scattering kernel. Otherwise νref is used to compute the scattering kernel.

Arguments

  • sm::AbstractScatteringModel: An instance of the scattering model.

  • imap::IntensityMap: An instance of the intensity map.

  • νref::Number=c_cgs: The frequency in Hz to compute the scattering kernel.

  • use_approx::Bool=true: If true, the approximate analytic formula is used to compute the scattering kernel. Otherwise semi-analytic formula is used.

source

ScatteringOptics.findkzeta_exact Method
julia
findkzeta_exact(finder::AbstractKzetaFinder; kwargs...)

Solves the equation for the concentration parameter k_ζ,2 given the set of parameters in the finder. It uses NonlinearSolve.jl.

source

ScatteringOptics.get_rF Method
julia
get_rF(psm::AbstractPhaseScreen, λ_cm)

Returns Fresnel scale corresponding to the given AvstractPhaseScreen object and observing wavelength, λ_cm

source

ScatteringOptics.kernelmodel Method
julia
kernelmodel(sm::AbstractScatteringModel; νref::Number=c_cgs, use_approx::Bool == true)

Return a Comrade Sky Model for the diffractive scattering kernel of the input scattering model.

** Keyword Argurments **

  • νref::Number: the reference frequency in Hz to give a radial extent of the kernel, which is ideally the lowest frequency of your data sets as the kenerl size is roughly scale with λ^2. νref defaults to the light speed in cgs unit, providing the wavelength of 1 cm.

  • use_approx::Bool==true: if true, returns a model using the approximated fourmula to compute visibiltiies (ScatteringKernel). Otherwise, return a model instead using the exact formula (ExactScatteringKernel).

source

ScatteringOptics.kzetafinder_equation Method
julia
kzetafinder_equation(kzeta, finder::AbstractKzetaFinder)

This equation privide a root-finding function f(kzeta, finder) to find kzeta from the equation f(kzeta, finder)=0.

source

ScatteringOptics.phase_screen Method
julia
phase_screen(psm::AbstractPhaseScreen, λ_cm, noise_screen=nothing)

Generates a refractive phase screen, ϕ, using StationaryRandomFields.jl the power law noise procedure. The fourier space 2D noise_screen (defaults to gaussian noise screen if not given) is scaled by the power law, Q, defined in input AbstractPhaseScreen psm. The observing wavelength, λ_cm, must be given.

source

ScatteringOptics.refractivephasescreen Method
julia
refractivephasescreen(sm, im, Vx_km_per_s=0.0, Vy_km_per_s=0.0)

An abstract type for generating a refractive phase screen model corresponding to an image and computing the scattered average image.

  • sm <: AbstractScatteringModel

  • im <: IntensityMap

  • Vx_km_per_s and Vy_km_per_s are optional for moving phase screen, which is not yet implemented.

source

ScatteringOptics.scatter_image Method
julia
scatter_image(psm::AbstractPhaseScreen, imap::IntensityMap; νref::Number = c_cgs, noise_screen=nothing, rng = Random.default_rng(), use_approx::Bool=true)

Arguments

  • psm::AbstractPhaseScreen: An instance of the phase screen.

  • imap::IntensityMap: An instance of the intensity map.

Parameters

  • νref::Number=c_cgs: The frequency in Hz to be used to simulate scattering effects. If the frequency of the image is not provided, this value is used.

  • noise_screen=nothing: The noise screen to be used to generate the phase screen. If not provided, a gaussian noise screen is generated.

  • rng = Random.default_rng(): The random number generator.

  • use_approx::Bool=true: If true, the approximate analytic formula is used to compute the scattering kernel. Otherwise semi-analytic formula is used.

source

ScatteringOptics.scatter_image Method
julia
scatter_image(sm, imap::IntensityMap; νref::Number = c_cgs, Vx_km_per_s=0.0, Vy_km_per_s=0.0, rng = Random.default_rng(), use_approx::Bool=true)

Simulates the full interstellar scattering on an unscattered Comrade skymodel intensity map (imap). The frequency of the image, if exists in its metadata, is used to simulate the scattering effects. Otherwise νref is used.

Arguments

  • sm::AbstractScatteringModel: An instance of the scattering model.

  • imap::IntensityMap: An instance of the intensity map.

Parameters

  • νref::Number=c_cgs: The frequency in Hz to be used to simulate scattering effects. If the frequency of the image is not provided, this value is used.

  • Vx_km_per_s=0.0: The velocity of the observer in the x direction in km/s. (just placeholder for future implementation)

  • Vy_km_per_s=0.0: The velocity of the observer in the y direction in km/s. (just placeholder for future implementation)

  • rng = Random.default_rng(): The random number generator.

  • use_approx::Bool=true: If true, the approximate analytic formula is used to compute the scattering kernel. Otherwise semi-analytic formula is used.

source

ScatteringOptics.visibility_point_approx Method
julia
visibility_point_approx(sm::AbstractScatteringModel, λ::Number, u::Number, v::Number)

Compute the diffractive kernel for a given observing wavelength λ and fourier space coordinates u, v using the approximated formula of the phase structure function.

source

ScatteringOptics.visibility_point_exact Method
julia
visibility_point_exact(sm::AbstractScatteringModel, λ::Number, u::Number, v::Number)

Compute the diffractive kernel for a given observing wavelength λ and fourier space coordinates u, v using the exact formula of the phase structure function.

source

ScatteringOptics.wrapped_grad Method
julia
wrapped_grad(ϕ, dx, dy)

Returns the wrapped gradient of a given 2D phase screen. The x and y pixel sizes (dx and dy) must be given.

source