Anime API

Contents

Index

Public API

Storage

Anime.msfromconfigFunction
msfromconfig(msname::String, mscreationmode::String, stations::String, casaanttemplate::String, spw_centrefreq::Array{Float64, 1}, 
spw_bw::Array{Float64, 1}, spw_channels::Array{Int64, 1}, sourcedict::Dict{String, Any}, starttime::String, exposure::Float64, scans::Int64,
scanlengths::Array{Float64, 1}, scanlag::Float64; autocorr::Bool=false, telescopename::String="VLBA", feed::String="perfect R L",
shadowlimit::Float64=1e-6, elevationlimit::String="10deg", stokes::String="RR RL LR LL", delim::String=",", ignorerepeated::Bool=false)

Create Measurement Set from observation parameters. Requires casatools.

source
Anime.msfromuvfitsFunction
msfromuvfits(uvfits::String, msname::String, mscreationmode::String)

Convert uvfits file to MS named msname. Requires casatools and casatasks to be installed.

source
Anime.mstouvfitsFunction
mstouvfits(msname::String, uvfits::String, datacolumn::String; field::String="", spw::String="", antenna::String="",
timerange::String="", overwrite::Bool=false)

Convert MS to UVFITS. Requires casatasks to be installed.

source
Anime.loadmsFunction
loadms(msname::String, stations::String, corruptseed::Int64, tropseed::Int64, tropwetonly::Bool, correff::Float64, tropattenuate::Bool,
tropskynoise::Bool, tropmeandelays::Bool, tropturbulence::Bool, polframe::String, polmode::String, ptginterval::Float64, ptgscale::Float64, ptgmode::String,
stationgainsmode::String, bandpassfile::String; delim::String=",", ignorerepeated::Bool=false)

Load data and metadata from MS and station & bandpass tables and return a CjlObservation object.

source
Anime.postprocessmsFunction
postprocessms(obs::CjlObservation; h5file::String="")

Add weight and sigma columns (write optionally to h5file), reshape as needed by MS, and write data stored in obs to disk.

source

Coherency

Anime.run_wscleanFunction
run_wsclean(msname::String, fitsdir::String, polarized::Bool, channelgroups::Int64, osfactor::Int64)

Compute source coherency matrix using WSClean and populate MS. fitsdir is the directory containing FITS source models, polarized indicates if source model is polarized, and channelgroups is the number of images in frequency. osfactor is the oversampling factor which is a WSClean argument that controls prediction/imaging accuracy.

source

Instrument Models

Anime.troposphere!Function
troposphere!(obs::CjlObservation, h5file::String; absorptionfile::String="", dispersivefile::String="", elevfile::String="")

Main function to compute various components of the tropospheric model. The actual numerical values generated are serialized in HDF5 format.

source
Anime.instrumentalpolarization!Function
instrumentalpolarization!(data::Array{Complex{Float32},4}, scanno::Vector{Int32}, times::Vector{Float64}, stationinfo::DataFrame, phasedir::Array{Float64,2},
pos::Array{Float64, 2}, chanfreqvec::Vector{Float64}, polframe::String, polmode::String, antenna1::Vector{Int32}, antenna2::Vector{Int32}, 
exposure::Float64, rngcorrupt::AbstractRNG; h5file::String="", elevfile::String="", parangfile::String="")

Compute frequency-varying instrumental polarization (leakage, or "D-Jones" terms) and apply to data. The actual numerical values are serialized as HDF5.

source
instrumentalpolarization!(obs::CjlObservation; h5file::String="", elevfile::String="", parangfile::String="")

Shorthand for instrumental polarization function when CjlObservation struct object is available.

source
Anime.pointing!Function
pointing!(data::Array{Complex{Float32},4}, stationinfo::DataFrame, scanno::Vector{Int32}, chanfreqvec::Vector{Float64}, 
ptgint::Float64, ptgscale::Float64, ptgmode::String, exposure::Float64, times::Vector{Float64}, rngcorrupt::AbstractRNG, antenna1::Vector{Int32}, 
antenna2::Vector{Int32}, numchan::Int64; α=1.0, h5file::String="")

Compute pointing model and apply to data. The actual numerical values are serialized in HDF5 format.

source
pointing!(obs::CjlObservation; h5file::String="")

Shorthand for pointing model function when CjlObservation struct object is available.

source
Anime.stationgains!Function
stationgains!(data::Array{Complex{Float32},4}, scanno::Vector{Int32}, times::Vector{Float64}, exposure::Float64, 
stationinfo::DataFrame, mode::String, rngcorrupt::AbstractRNG, antenna1::Vector{Int32}, antenna2::Vector{Int32}, numchan::Int64; h5file::String="")

Compute time-variable complex station gains and apply to data. The actual numerical values are serialized in HDF5 format.

source
stationgains!(obs::CjlObservation; h5file::String="")

Shorthand for station gains function when CjlObservation struct object is available.

source
Anime.bandpass!Function
bandpass!(data::Array{Complex{Float32},4}, bandpassfile::String, stationinfo::DataFrame, rngcorrupt::AbstractRNG,
antenna1::Vector{Int32}, antenna2::Vector{Int32}, numchan::Int64, chanfreqvec::Vector{Float64}; h5file::String="")

Compute the complex bandpass model and apply to data. The actual numerical values are serialized in HDF5 format.

source
bandpass!(obs::CjlObservation; h5file::String="")

Shorthand for bandpass function when CjlObservation struct object is available.

source
Anime.thermalnoise!Function
thermalnoise!(data::Array{Complex{Float32},4}, times::Vector{Float64}, antenna1::Vector{Int32}, antenna2::Vector{Int32}, correff::Float64,
exposure::Float64, chanwidth::Float64, rngcorrupt::AbstractRNG, sefd::Vector{Float64}; h5file::String="", noisefile::String="")

Compute per-baseline thermal noise using radiometer equation and apply to data. The actual numerical values are serialized in HDF5 format.

source
thermalnoise!(obs::CjlObservation; h5file::String="", noisefile::String="")

Shorthand for thermal noise function when CjlObservation struct object is available.

source

Statistics

Anime.genseries1d!Function
genseries1d!(series::Vector{ComplexF32}, mode::String, location::ComplexF32, scale::Float32, driftrate::Float32, nsamples::Int64, rng::AbstractRNG)

Generate a complex-valued Gaussian process 1-D series of length nsamples with the given location, scale, and driftrate parameters. mode determines if "normal" distribution or "gaussian processes" is used to generate the samples.

source
genseries1d!(series::Vector{Float32}, mode::String, location::Float32, scale::Float32, driftrate::Float32, nsamples::Int64, rng::AbstractRNG)

Generate a Float32-valued Gaussian process 1-D series of length nsamples with the given location, scale, and driftrate parameters. mode determines if "normal" distribution or "gaussian processes" is used to generate the samples.

source
genseries1d!(series::Vector{Float64}, mode::String, location::Float64, scale::Float64, driftrate::Float64, nsamples::Int64, rng::AbstractRNG)

Generate a Float64-valued Gaussian process 1-D series of length nsamples with the given location, scale, and driftrate parameters. mode determines if "normal" distribution or "gaussian processes" is used to generate the samples.

source
genseries1d!(series, times, rng::AbstractRNG; μ=0.0, σ=1.0, ρ=1.0)

Generate 1-D series using SE kernel.

source
genseries1d!(series, times, rng::AbstractRNG, α::Float64; μ=0.0, σ=1.0, ρ=2.0)

Generate 1-D series using RQ kernel.

source

Utils

Anime.elevationangleFunction
elevationangle(times::Vector{Float64}, phasedir::Array{Float64,2}, stationinfo::DataFrame, pos::Array{Float64, 2})

Compute elevation angle for all stations in stationinfo for all times using phasedir and pos information.

source
Anime.parallacticangleFunction
parallacticangle(times::Vector{Float64}, phasedir::Array{Float64,2}, stationinfo::DataFrame, pos::Array{Float64,2})

Compute parallactic angle for all stations in stationinfo for all times using phasedir and pos information.

source

Plotting

Anime.plotvisFunction
plotvis(uvw::Matrix{Float64}, chanfreqvec::Array{Float64,1}, flag::Array{Bool,4}, data::Array{Complex{Float32},4},
numchan::Int64, times::Vector{Float64}; saveprefix="data_")

Plot complex visibilities against time and projected baseline length.

source
Anime.plotuvcovFunction
plotuvcov(uvw::Matrix{Float64}, flagrow::Vector{Bool}, chanfreqvec::Vector{Float64}; saveprefix="test_")

Plot uv-coverage of observation.

source
Anime.plotstationgainsFunction
plotstationgains(h5file::String, scanno::Vector{Int32}, times::Vector{Float64}, exposure::Float64, stationnames::Vector{String3}; save::Bool=true)::Plots.Plot{Plots.GRBackend}

Plot complex station gains against time.

source
Anime.plotbandpassFunction
plotbandpass(h5file::String, stationnames::Vector{String3}, chanfreqvec::Vector{Float64}; save::Bool=true)::Plots.Plot{Plots.GRBackend}

Plot bandpass gains against time.

source
Anime.plotpointingerrorsFunction
plotpointingerrors(h5file::String, scanno::Vector{Int32}, stationnames::Vector{String3}; save::Bool=true)::Plots.Plot{Plots.GRBackend}

Plot pointing errors.

source
Anime.plotelevationangleFunction
plotelevationangle(h5file::String, scanno::Vector{Int32}, times::Vector{Float64}, stationnames::Vector{String3}; save::Bool=true)::Plots.Plot{Plots.GRBackend}

Plot evolution of station elevation angles during the course of the observation.

source
Anime.plotparallacticangleFunction
plotparallacticangle(h5file::String, scanno::Vector{Int32}, times::Vector{Float64}, stationnames::Vector{String3}; save::Bool=true)::Plots.Plot{Plots.GRBackend}

Plot evolution of station parallactic angles during the course of the observation.

source
Anime.plotdtermsFunction
plotdterms(h5file::String, stationnames::Vector{String3}, chanfreqvec::Vector{Float64}; save::Bool=true)::Plots.Plot{Plots.GRBackend}

Plot frequency-dependent complex instrumental polarization.

source
Anime.plottransmissionFunction
plottransmission(h5file::String, stationnames::Vector{String3}, times::Vector{Float64}, chanfreqvec::Vector{Float64}; save::Bool=true)::Plots.Plot{Plots.GRBackend}

Plot tropospheric transmission variation with frequency.

source
Anime.plotmeandelaysFunction
plotmeandelays(h5file::String, stationnames::Vector{String3}, times::Vector{Float64}, chanfreqvec::Vector{Float64}; save::Bool=true)::Plots.Plot{Plots.GRBackend}

Plot mean delays against time.

source

Data Types

Anime.CjlObservationType
struct CjlObservation{T} <: Anime.AbstractObservation{T}

Container type for storing observation parameters and data.

Fields

  • msname: Name of the Measurement Set
  • data: Complex visibility data (MS DATA column)
  • flag: Flag array of the same dimensions as data (MS FLAG column)
  • flagrow: Flag row Boolean vector (MS FLAG_ROW column)
  • antenna1: Antenna 1 in a baseline pair (MS ANTENNA1 column)
  • antenna2: Antenna 2 in a baseline pair (MS ANTENNA2 column)
  • uvw: uvw coordinates (MS UVW column)
  • times: Timestamps (MS TIME column)
  • exposure: Integration time
  • scanno: Scan numbers (MS SCAN_NUMBER column)
  • numchan: Number of frequency channels
  • chanfreqvec: Channel frequencies (Hz) (MS CHAN_FREQ column)
  • chanwidth: Width of frequency channel
  • phasedir: Direction of phase centre
  • pos: Antenna positions in x,y,z coordinates
  • stationinfo: Dataframe of station information input by user
  • tropwetonly: Consider only water vapour in the troposphere
  • correff: Correlator efficiency
  • tropattenuate: Introduce attenuation by the troposphere
  • tropskynoise: Introduce noise due to troposphere
  • tropmeandelays: Introduce mean delays due to troposphere
  • tropturbulence: Introduce turbulence in troposphere
  • polframe: Polarization frame
  • polmode: Mode to use to create frequency-varying D-term samples
  • ptginterval: Pointing interval (s)
  • ptgscale: Pointing scale mixture parameter
  • ptgmode: Mode to use to create pointing error time samples
  • stationgainsmode: Mode to use to create station gain time samples
  • bandpassfile: Input bandpass file
  • rngcorrupt: RNG for all models except troposphere
  • rngtrop: RNG for tropospheric models
source

Internal

Anime.addweightcolsFunction
addweightcols(msname::String, mode::String, sigmaspec::Bool, weightspec::Bool)

Add WEIGHT_SPECTRUM and SIGMA_SPECTRUM columns to MS. Requires casatools to be installed.

source
Anime.makecasaanttableFunction
makecasaanttable(stations::String, casaanttemplate::String; delim::String=",", ignorerepeated::Bool=false)

Create CASA antenna table from station info file stations using casaanttemplate as template. Requires casatools to be installed.

source
Anime.computeweights!Function
computeweights!(totalrmsspec::Array{Float32, 4}, totalwtspec::Array{Float32, 4}; h5file::String="")

Compute total rms (sigma) values and inverse-squared visibility weights from thermal+sky noise terms stored in h5file.

source
Anime.run_aatmFunction
run_aatm(obs::CjlObservation; absorptionfile::String="", dispersivefile::String="")::DataFrame

Run AATM (Bjona Nikolic; Pardo et al. 2001) to compute absorption by and dispersive delay in the troposphere. If AATM is not installed, this function can still accept input absorption and dispersion values in a specific CSV format and populate atm.csv.

source
Anime.compute_transmission!Function
compute_transmission!(transmission::Array{Float64, 3}, obs::CjlObservation, atmdf::DataFrame, elevationmatrix::Array{Float64, 2}, g::HDF5.Group)::Array{Float64, 3}

Compute elevation-dependent (mean) tropospheric transmission given opacity τ and elevation angle θ for each station.

\[e^{-τ/\sin{\theta_{\rm el}}}\]

source
Anime.attenuate!Function
attenuate!(obs::CjlObservation, transmission::Array{Float64, 3})

Attenuate the signal as it passes through (mean) troposphere using precomputed transmission values.

\[I = I_0 e^{-τ/\sin{\theta_{\rm el}}}\]

source
Anime.compute_skynoise!Function
compute_skynoise!(obs::CjlObservation, atmdf::DataFrame, transmission::Array{Float64, 3}, g::HDF5.Group)

Compute sky contribution to visibility noise using the radiometer equation.

source
Anime.compute_meandelays!Function
compute_meandelays!(obs::CjlObservation, atmdf::DataFrame, elevationmatrix::Array{Float64, 2}, g::HDF5.Group)

Compute delays due to (mean) troposphere.

source
Anime.compute_turbulence!Function
compute_turbulence!(obs::CjlObservation, atmdf::DataFrame, elevationmatrix::Array{Float64, 2}, g::HDF5.Group)

Compute phase delays due to tropospheric turbulence. The time series of phase errors for station p is given by

\[\{{\delta \phi_p(t, \nu)}\} = \frac{1}{\sqrt{\sin({\theta_{\mathrm{el}}(t)})}} \{\delta\phi^{\prime}_p(t)\} \big(\frac{\nu}{\nu_0}\big)\]

where ν is the list of channel frequencies and ν_0 is the reference frequency (lowest in the band).

source
Anime.squaredexponentialkernelFunction
squaredexponentialkernel(x1, x2; σ=1.0, ρ=1.0)

Generate squared exponential kernel function of the form

\[k_{SE}(x-x') = \sigma^2 e^{-\frac{(x-x')^2}{2\rho^2}}\]

where σ^2 is the variance and ρ is the characteristic length.

source
Anime.rationalquadratickernelFunction
rationalquadratickernel(x1, x2; σ=1.0, α=1.0, ρ=2.0)

Generate rational quadratic kernel of the form

\[k_{RQ}(x-x') = \sigma^2 \big(1+\frac{(x-x')^2}{2\alpha\rho^2}\big)^{-\alpha}\]

source