Anime API
Contents
Index
Anime.CjlObservationAnime.addweightcolsAnime.attenuate!Anime.bandpass!Anime.compute_meandelays!Anime.compute_skynoise!Anime.compute_transmission!Anime.compute_turbulence!Anime.computeweights!Anime.copymodeltodataAnime.elevationangleAnime.genseries1d!Anime.instrumentalpolarization!Anime.loadmsAnime.makecasaanttableAnime.msfromconfigAnime.msfromuvfitsAnime.mstouvfitsAnime.parallacticangleAnime.plotbandpassAnime.plotdtermsAnime.plotelevationangleAnime.plotmeandelaysAnime.plotparallacticangleAnime.plotpointingerrorsAnime.plotstationgainsAnime.plottransmissionAnime.plotuvcovAnime.plotvisAnime.pointing!Anime.postprocessmsAnime.rationalquadratickernelAnime.run_aatmAnime.run_wscleanAnime.squaredexponentialkernelAnime.stationgains!Anime.thermalnoise!Anime.troposphere!
Public API
Storage
Anime.msfromconfig — Functionmsfromconfig(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.
Anime.msfromuvfits — Functionmsfromuvfits(uvfits::String, msname::String, mscreationmode::String)Convert uvfits file to MS named msname. Requires casatools and casatasks to be installed.
Anime.mstouvfits — Functionmstouvfits(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.
Anime.loadms — Functionloadms(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.
Anime.postprocessms — Functionpostprocessms(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.
Coherency
Anime.run_wsclean — Functionrun_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.
Instrument Models
Anime.troposphere! — Functiontroposphere!(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.
Anime.instrumentalpolarization! — Functioninstrumentalpolarization!(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.
instrumentalpolarization!(obs::CjlObservation; h5file::String="", elevfile::String="", parangfile::String="")Shorthand for instrumental polarization function when CjlObservation struct object is available.
Anime.pointing! — Functionpointing!(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.
pointing!(obs::CjlObservation; h5file::String="")Shorthand for pointing model function when CjlObservation struct object is available.
Anime.stationgains! — Functionstationgains!(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.
stationgains!(obs::CjlObservation; h5file::String="")Shorthand for station gains function when CjlObservation struct object is available.
Anime.bandpass! — Functionbandpass!(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.
bandpass!(obs::CjlObservation; h5file::String="")Shorthand for bandpass function when CjlObservation struct object is available.
Anime.thermalnoise! — Functionthermalnoise!(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.
thermalnoise!(obs::CjlObservation; h5file::String="", noisefile::String="")Shorthand for thermal noise function when CjlObservation struct object is available.
Statistics
Anime.genseries1d! — Functiongenseries1d!(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.
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.
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.
genseries1d!(series, times, rng::AbstractRNG; μ=0.0, σ=1.0, ρ=1.0)Generate 1-D series using SE kernel.
genseries1d!(series, times, rng::AbstractRNG, α::Float64; μ=0.0, σ=1.0, ρ=2.0)Generate 1-D series using RQ kernel.
Utils
Anime.elevationangle — Functionelevationangle(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.
Anime.parallacticangle — Functionparallacticangle(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.
Plotting
Anime.plotvis — Functionplotvis(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.
Anime.plotuvcov — Functionplotuvcov(uvw::Matrix{Float64}, flagrow::Vector{Bool}, chanfreqvec::Vector{Float64}; saveprefix="test_")Plot uv-coverage of observation.
Anime.plotstationgains — Functionplotstationgains(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.
Anime.plotbandpass — Functionplotbandpass(h5file::String, stationnames::Vector{String3}, chanfreqvec::Vector{Float64}; save::Bool=true)::Plots.Plot{Plots.GRBackend}Plot bandpass gains against time.
Anime.plotpointingerrors — Functionplotpointingerrors(h5file::String, scanno::Vector{Int32}, stationnames::Vector{String3}; save::Bool=true)::Plots.Plot{Plots.GRBackend}Plot pointing errors.
Anime.plotelevationangle — Functionplotelevationangle(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.
Anime.plotparallacticangle — Functionplotparallacticangle(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.
Anime.plotdterms — Functionplotdterms(h5file::String, stationnames::Vector{String3}, chanfreqvec::Vector{Float64}; save::Bool=true)::Plots.Plot{Plots.GRBackend}Plot frequency-dependent complex instrumental polarization.
Anime.plottransmission — Functionplottransmission(h5file::String, stationnames::Vector{String3}, times::Vector{Float64}, chanfreqvec::Vector{Float64}; save::Bool=true)::Plots.Plot{Plots.GRBackend}Plot tropospheric transmission variation with frequency.
Anime.plotmeandelays — Functionplotmeandelays(h5file::String, stationnames::Vector{String3}, times::Vector{Float64}, chanfreqvec::Vector{Float64}; save::Bool=true)::Plots.Plot{Plots.GRBackend}Plot mean delays against time.
Data Types
Anime.CjlObservation — Typestruct CjlObservation{T} <: Anime.AbstractObservation{T}Container type for storing observation parameters and data.
Fields
msname: Name of the Measurement Set
data: Complex visibility data (MSDATAcolumn)
flag: Flag array of the same dimensions as data (MSFLAGcolumn)
flagrow: Flag row Boolean vector (MSFLAG_ROWcolumn)
antenna1: Antenna 1 in a baseline pair (MSANTENNA1column)
antenna2: Antenna 2 in a baseline pair (MSANTENNA2column)
uvw: uvw coordinates (MSUVWcolumn)
times: Timestamps (MSTIMEcolumn)
exposure: Integration time
scanno: Scan numbers (MSSCAN_NUMBERcolumn)
numchan: Number of frequency channels
chanfreqvec: Channel frequencies (Hz) (MSCHAN_FREQcolumn)
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
Internal
Anime.addweightcols — Functionaddweightcols(msname::String, mode::String, sigmaspec::Bool, weightspec::Bool)Add WEIGHT_SPECTRUM and SIGMA_SPECTRUM columns to MS. Requires casatools to be installed.
Anime.makecasaanttable — Functionmakecasaanttable(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.
Anime.copymodeltodata — Functioncopymodeltodata(msname::String)Copy MODEL_DATA to DATA in MS msname.
Anime.computeweights! — Functioncomputeweights!(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.
Anime.run_aatm — Functionrun_aatm(obs::CjlObservation; absorptionfile::String="", dispersivefile::String="")::DataFrameRun 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.
Anime.compute_transmission! — Functioncompute_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}}}\]
Anime.attenuate! — Functionattenuate!(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}}}\]
Anime.compute_skynoise! — Functioncompute_skynoise!(obs::CjlObservation, atmdf::DataFrame, transmission::Array{Float64, 3}, g::HDF5.Group)Compute sky contribution to visibility noise using the radiometer equation.
Anime.compute_meandelays! — Functioncompute_meandelays!(obs::CjlObservation, atmdf::DataFrame, elevationmatrix::Array{Float64, 2}, g::HDF5.Group)Compute delays due to (mean) troposphere.
Anime.compute_turbulence! — Functioncompute_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).
Anime.squaredexponentialkernel — Functionsquaredexponentialkernel(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.
Anime.rationalquadratickernel — Functionrationalquadratickernel(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}\]