Comrade.ArrayConfigurationType
abstract type ArrayConfiguration

This defined the abstract type for an array configuration. Namely, baseline times, SEFD's, bandwidth, observation frequencies, etc.

Comrade.CalPriorMethod
CalPrior(dists, cache::JonesCache, reference=:none)

Creates a distribution for the gain priors for gain cache cache. The dists should be a NamedTuple of Distributions, where each name corresponds to a telescope or station in the observation. The resulting type is a subtype of the Distributions.AbstractDistribution so the usual Distributions interface should work.

Example

For the 2017 observations of M87 a common CalPrior call is:

julia> gdist = CalPrior((AA = LogNormal(0.0, 0.1),
                   AP = LogNormal(0.0, 0.1),
                   JC = LogNormal(0.0, 0.1),
                   SM = LogNormal(0.0, 0.1),
                   AZ = LogNormal(0.0, 0.1),
                   LM = LogNormal(0.0, 1.0),
                   PV = LogNormal(0.0, 0.1)
                ), cache)

julia> x = rand(gdist)
julia> logdensityof(gdist, x)
Comrade.CalPriorMethod
CalPrior(dist0::NamedTuple, dist_transition::NamedTuple, jcache::SegmentedJonesCache)

Constructs a calibration prior in two steps. The first two arguments have to be a named tuple of distributions, where each name corresponds to a site. The first argument is gain prior for the first time stamp. The second argument is the segmented gain prior for each subsequent time stamp. For instance, if we have

dist0 = (AA = Normal(0.0, 1.0), )
distt = (AA = Normal(0.0, 0.1), )

then the gain prior for first time stamp that AA obserserves will be Normal(0.0, 1.0). The next time stamp gain is the construted from

g2 = g1 + ϵ1

where ϵ1 ~ Normal(0.0, 0.1) = distt.AA, and g1 is the gain from the first time stamp. In other words distt is the uncorrelated transition probability when moving from timestamp i to timestamp i+1. For the typical pre-calibrated dataset the gain prior on distt can be tighter than the prior on dist0.

Comrade.CalTableType
struct CalTable{T, G<:(AbstractVecOrMat)}

A Tabes of calibration quantities. The columns of the table are the telescope station codes. The rows are the calibration quantities at a specific time stamp. This user should not use this struct directly. Instead that should call caltable.

Comrade.ClosureConfigType
struct ClosureConfig{A, D} <: Comrade.ArrayConfiguration

Array config file for closure quantities. This stores the design matrix designmat that transforms from visibilties to closure products.

Fields

  • ac: Array configuration for visibilities

  • designmat: Closure design matrix

Comrade.ClosurePhasesType
ClosuresPhases(;kwargs...)

Type to specify to extract the closure phase table in the extract_table function. Optional keywords are passed through extract_table to specify additional option.

Special keywords for eht-imaging with Pyehtim.jl

For a list of potential keyword arguments see eht-imaging and add_cphase command for obsdata. In addition note we have changed the following:

  • count: How the closures are formed, the available options are "min-correct", "min", "max"

Warning

The count keyword argument is treated specially in Comrade. The default option is "min-correct" and should almost always be used. This option construct a minimal set of closure phases that is valid even when the array isn't fully connected. For testing and legacy reasons we ehtim other count options are also included. However, the current ehtim count="min" option is broken and does construct proper minimal sets of closure quantities if the array isn't fully connected.

Comrade.CoherenciesType
Coherencies(;kwargs...)

Type to specify to extract the coherency matrices table in the extract_table function. Optional keywords are passed through extract_table to specify additional option.

Special keywords for eht-imaging with Pyehtim.jl

Any keyword arguments are ignored for now. Use eht-imaging directly to modify the data.

Comrade.ComplexVisibilitiesType
ComplexVisibilities(;kwargs...)

Type to specify to extract the complex visibilities table in the extract_table function. Optional keywords are passed through extract_table to specify additional option.

Special keywords for eht-imaging with Pyehtim.jl

Any keyword arguments are ignored for now. Use eht-imaging directly to modify the data.

Comrade.DesignMatrixType
struct DesignMatrix{X, M<:AbstractArray{X, 2}, T, S} <: AbstractArray{X, 2}

Internal type that holds the gain design matrices for visibility corruption.

Comrade.EHTArrayConfigurationType
struct EHTArrayConfiguration{F, T, S, D<:AbstractArray} <: Comrade.ArrayConfiguration

Stores all the non-visibility data products for an EHT array. This is useful when evaluating model visibilities.

Fields

  • bandwidth: Observing bandwith (Hz)
  • tarr: Telescope array file
  • scans: Scan times
  • data: A struct array of ArrayBaselineDatum holding time, freq, u, v, baselines.
Comrade.EHTClosurePhaseDatumType
struct EHTClosurePhaseDatum{S<:Number} <: Comrade.ClosureProducts{S<:Number}

A Datum for a single closure phase.

Fields

  • measurement: closure phase (rad)
  • error: error of the closure phase assuming the high-snr limit
  • U1: u (λ) of first station
  • V1: v (λ) of first station
  • U2: u (λ) of second station
  • V2: v (λ) of second station
  • U3: u (λ) of third station
  • V3: v (λ) of third station
  • T: Measured time of closure phase in hours
  • F: Measured frequency of closure phase in Hz
  • triangle: station baselines used
Comrade.EHTCoherencyDatumType
struct EHTCoherencyDatum{S, B1, B2, M<:(StaticArraysCore.SArray{Tuple{2, 2}, Complex{S}, 2}), E<:(StaticArraysCore.SArray{Tuple{2, 2}, S, 2})} <: Comrade.AbstractInterferometryDatum{S}

A Datum for a single coherency matrix

Fields

  • measurement: coherency matrix, with entries in Jy
  • error: visibility uncertainty matrix, with entries in Jy
  • U: x-direction baseline length, in λ
  • V: y-direction baseline length, in λ
  • T: Timestamp, in hours
  • F: Frequency, in Hz
  • baseline: station baseline codes
  • polbasis: polarization basis for each station
Comrade.EHTLogClosureAmplitudeDatumType
struct EHTLogClosureAmplitudeDatum{S<:Number} <: Comrade.ClosureProducts{S<:Number}

A Datum for a single log closure amplitude.

  • measurement: log-closure amplitude
  • error: log-closure amplitude error in the high-snr limit
  • U1: u (λ) of first station
  • V1: v (λ) of first station
  • U2: u (λ) of second station
  • V2: v (λ) of second station
  • U3: u (λ) of third station
  • V3: v (λ) of third station
  • U4: u (λ) of fourth station
  • V4: v (λ) of fourth station
  • T: Measured time of closure phase in hours
  • F: Measured frequency of closure phase in Hz
  • quadrangle: station codes for the quadrangle
Comrade.EHTObservationType
struct EHTObservation{F, T<:Comrade.AbstractInterferometryDatum{F}, S<:(StructArrays.StructArray{T<:Comrade.AbstractInterferometryDatum{F}}), A, N} <: Comrade.Observation{F}

The main data product type in Comrade this stores the data which can be a StructArray of any AbstractInterferometryDatum type.

Fields

  • data: StructArray of data productts
  • config: Array config holds ancillary information about array
  • mjd: modified julia date of the observation
  • ra: RA of the observation in J2000 (deg)
  • dec: DEC of the observation in J2000 (deg)
  • bandwidth: bandwidth of the observation (Hz)
  • source: Common source name
  • timetype: Time zone used.
Comrade.EHTVisibilityAmplitudeDatumType
struct EHTVisibilityAmplitudeDatum{S<:Number} <: Comrade.AbstractVisibilityDatum{S<:Number}

A struct holding the information for a single measured visibility amplitude.

FIELDS

  • measurement: amplitude (Jy)
  • error: error of the visibility amplitude (Jy)
  • U: u position of the data point in λ
  • V: v position of the data point in λ
  • T: time of the data point in (Hr)
  • F: frequency of the data point (Hz)
  • baseline: station baseline codes
Comrade.EHTVisibilityDatumType
struct EHTVisibilityDatum{S<:Number} <: Comrade.AbstractVisibilityDatum{S<:Number}

A struct holding the information for a single measured complex visibility.

FIELDS

  • measurement: Complex Vis. measurement (Jy)
  • error: error of the complex vis (Jy)
  • U: u position of the data point in λ
  • V: v position of the data point in λ
  • T: time of the data point in (Hr)
  • F: frequency of the data point (Hz)
  • baseline: station baseline codes
Comrade.FixedSegType
struct FixedSeg{T} <: Comrade.ObsSegmentation

Enforces that the station calibraton value will have a fixed value. This is most commonly used when enforcing a reference station for gain phases.

Comrade.GainSchemaType
GainSchema(sites, times)

Constructs a schema for the gains of an observation. The sites and times correspond to the specific site and time for each gain that will be modeled.

Comrade.IntegSegType
struct IntegSeg{S} <: Comrade.ObsSegmentation

Data segmentation such that the quantity is constant over a correlation integration.

Comrade.IsCubeType
struct IsCube

Specifies that the sampling algorithm usually expects a hypercube transform

Comrade.IsFlatType
struct IsFlat

Specifies that the sampling algorithm usually expects a uncontrained transform

Comrade.JonesCacheType
struct JonesCache{D1, D2, S, Sc, R} <: Comrade.AbstractJonesCache

Holds the ancillary information for a the design matrix cache for Jones matrices. That is, it defines the cached map that moves from model visibilities to the corrupted voltages that are measured from the telescope.

Fields

  • m1: Design matrix for the first station
  • m2: Design matrix for the second station
  • seg: Segmentation schemes for this cache
  • schema: Gain Schema
  • references: List of Reference stations
Comrade.JonesModelMethod
JonesModel(jones::JonesPairs, refbasis = CirBasis())
JonesModel(jones::JonesPairs, tcache::ResponseCache)

Constructs the intrument corruption model using pairs of jones matrices jones and a reference basis

Comrade.JonesPairsType
struct JonesPairs{T, M1<:AbstractArray{T, 1}, M2<:AbstractArray{T, 1}}

Holds the pairs of Jones matrices for the first and second station of a baseline.

Fields

  • m1: Vector of jones matrices for station 1
  • m2: Vector of jones matrices for station 2
Comrade.LogClosureAmplitudesType
LogClosureAmplitudes(;kwargs...)

Type to specify to extract the log closure amplitudes table in the extract_table function. Optional keywords are passed through extract_table to specify additional option.

Special keywords for eht-imaging with Pyehtim.jl

For a list of potential keyword arguments see eht-imaging and add_cphase command for obsdata. In addition note we have changed the following:

  • count: How the closures are formed, the available options are "min-correct", "min", "max"

Returns an EHTObservation with log-closure amp. datums

Warning

The count keyword argument is treated specially in Comrade. The default option is "min-correct" and should almost always be used. This option construct a minimal set of closure phases that is valid even when the array isn't fully connected. For testing and legacy reasons we ehtim other count options are also included. However, the current ehtim count="min" option is broken and does construct proper minimal sets of closure quantities if the array isn't fully connected.

Comrade.MultiRadioLikelihoodType
MultiRadioLikelihood(lklhd1, lklhd2, ...)

Combines multiple likelihoods into one object that is useful for fitting multiple days/frequencies.

julia> lklhd1 = RadioLikelihood(dcphase1, dlcamp1)
julia> lklhd2 = RadioLikelihood(dcphase2, dlcamp2)
julia> MultiRadioLikelihood(lklhd1, lklhd2)
Comrade.PosteriorType
Posterior(lklhd, prior)

Creates a Posterior density that follows obeys DensityInterface. The lklhd object is expected to be a VLB object. For instance, these can be created using RadioLikelihood. prior

Notes

Since this function obeys DensityInterface you can evaluate it with

julia> ℓ = logdensityof(post)
julia> ℓ(x)

or using the 2-argument version directly

julia> logdensityof(post, x)

where post::Posterior.

To generate random draws from the prior see the prior_sample function.

Comrade.RIMEModelType
abstract type RIMEModel <: ComradeBase.AbstractModel

Abstract type that encompasses all RIME style corruptions.

Comrade.RadioLikelihoodMethod
RadioLikelihood(skymodel, instumentmodel, dataproducts::EHTObservation...;
                skymeta=nothing,
                instrumentmeta=nothing)

Creates a RadioLikelihood using the skymodel its related metadata skymeta and the instrumentmodel and its metadata instumentmeta. . The model is a function that converts from parameters θ to a Comrade AbstractModel which can be used to compute visibilities and a set of metadata that is used by model to compute the model.

Warning

The model itself must be a two argument function where the first argument is the set of model parameters and the second is a container that holds all the additional information needed to construct the model. An example of this is when the model needs some precomputed cache to define the model.

Example

dlcamp, dcphase = extract_table(obs, LogClosureAmplitude(), ClosurePhases())
cache = create_cache(NFFTAlg(dlcamp), IntensityMap(zeros(128,128), μas2rad(100.0), μas2rad(100.0)))

function skymodel(θ, metadata)
    (; r, a) = θ
    (; cache) = metadata
    m = stretched(ExtendedRing(a), r, r)
    return modelimage(m, metadata.cache)
end

function instrumentmodel(g, metadata)
    (;lg, gp) = g
    (;gcache) = metadata
    jonesStokes(lg.*exp.(1im.*gp), gcache)
end

prior = (
         r = Uniform(μas2rad(10.0), μas2rad(40.0)),
         a = Uniform(0.1, 5.0)
         )

RadioLikelihood(skymodel, instrumentmodel, dataproducts::EHTObservation...;
                 skymeta=(;cache,),
                 instrumentmeta=(;gcache))
Comrade.RadioLikelihoodMethod
RadioLikelihood(skymodel, dataproducts::EHTObservation...; skymeta=nothing)

Forms a radio likelihood from a set of data products using only a sky model. This intrinsically assumes that the instrument model is not required since it is perfect. This is useful when fitting closure quantities which are independent of the instrument.

If you want to form a likelihood from multiple arrays such as when fitting different wavelengths or days, you can combine them using MultiRadioLikelihood

Example

julia> RadioLikelihood(skymodel, dcphase, dlcamp)
Comrade.RandomReferenceMethod
RandomReference(val::Number)

For each timestamp select a random reference station whose station gain will be set to val.

Notes

This is useful when there isn't a single site available for all scans and you want to split up the choice of reference site. We recommend only using this option for Stokes I fitting.

Comrade.ResponseCacheType
struct ResponseCache{M, B<:PolBasis} <: Comrade.AbstractJonesCache

Holds various transformations that move from the measured telescope basis to the chosen on sky reference basis.

Fields

  • T1: Transform matrices for the first stations
  • T2: Transform matrices for the second stations
  • refbasis: Reference polarization basis
Comrade.ResponseCacheMethod
ResponseCache(obs::EHTObservation; add_fr=true, ehtim_fr_convention=false, ref::PolBasis=CirBasis())

Constructs the cache that holds the transformation from the chosen on-sky reference basis to the basis that the telescope measures the electric fields given an observation obs. Our convention is that the feed rotations are included in the transformation cache with the add_fr toggle. The user can specify the reference basis using the keyword argument ref which is the (R,L) circular basis by default.

Notes

We use the following definition for our feed rotations in circular basis

    exp(-iθ)  0
    0         exp(iθ)

and in the linear feed basis

    cos(θ) sin(θ)
   -sin(θ) cos(θ)

Warning

eht-imaging can sometimes pre-rotate the coherency matrices. As a result the field rotation can sometimes be applied twice. To compensate for this we have added a ehtim_fr_convention which will fix this.

Comrade.SEFDReferenceType
SiteOrderReference(val::Number, sefd_index = 1)

Selects the reference site based on the SEFD of each telescope, where the smallest SEFD is preferentially selected. The reference gain is set to val and the user can select to use the n lowest SEFD site by passing sefd_index = n.

Notes

This is done on a per-scan basis so if a site is missing from a scan the next highest SEFD site will be used.

Comrade.ScanType
struct Scan{T, I, S}

Composite type that holds information for a single scan of the telescope.

Fields

  • time: Scan time
  • index: Scan indices which are (scan index, data start index, data end index)
  • scan: Scan data usually a StructArray of a <:AbstractVisibilityDatum
Comrade.ScanSegType
struct ScanSeg{S} <: Comrade.ObsSegmentation

Data segmentation such that the quantity is constant over a scan.

Warning

Currently we do not explicity track the telescope scans. This will be fixed in a future version. Right now ScanSeg and TrackSeg are the same

Comrade.ScanTableType
struct ScanTable{O<:Union{Comrade.ArrayConfiguration, Comrade.Observation}, T, S}

Wraps EHTObservation in a table that separates the observation into scans. This implements the table interface. You can access scans by directly indexing into the table. This will create a view into the table not copying the data.

Example

julia> st = scantable(obs)
julia> st[begin] # grab first scan
julia> st[end]   # grab last scan
Comrade.SegmentedJonesCacheType
struct SegmentedJonesCache{D, S<:Comrade.ObsSegmentation, ST, Ti} <: Comrade.AbstractJonesCache

Holds the ancillary information for a the design matrix cache for Jones matrices. That is, it defines the cached map that moves from model visibilities to the corrupted voltages that are measured from the telescope. This uses a segmented decomposition so that the gain at a single timestamp is the sum of the previous gains. In this formulation the gains parameters are the segmented gain offsets from timestamp to timestamp

Fields

  • m1: Design matrix for the first station
  • m2: Design matrix for the second station
  • seg: Segmentation scheme for this cache
  • stations: station codes
  • times: times
Comrade.SingleReferenceMethod
SingleReference(site::Symbol, val::Number)

Use a single site as a reference. The station gain will be set equal to val.

Comrade.TrackSegType
struct TrackSeg <: Comrade.ObsSegmentation

Data segmentation such that the quantity is constant over a track, i.e., the observation "night".

Comrade.TransformedPosteriorType
struct TransformedPosterior{P<:Posterior, T} <: Comrade.AbstractPosterior

A transformed version of a Posterior object. This is an internal type that an end user shouldn't have to directly construct. To construct a transformed posterior see the asflat, ascube, and flatten docstrings.

Comrade.VLBIModelType
VLBIModel(skymodel, instrumentmodel)

Constructs a VLBIModel from a jones pairs that describe the intrument model and the model which describes the on-sky polarized visibilities. The third argument can either be the tcache that converts from the model coherency basis to the instrumental basis, or just the refbasis that will be used when constructing the model coherency matrices.

Comrade.VisibilityAmplitudesType
ComplexVisibilities(;kwargs...)

Type to specify to extract the log closure amplitudes table in the extract_table function. Optional keywords are passed through extract_table to specify additional option.

Special keywords for eht-imaging with Pyehtim.jl

For a list of potential keyword arguments see eht-imaging and add_amp command for obsdata.

VLBISkyModels.DFTAlgMethod
DFTAlg(ac::ArrayConfiguration)

Create an algorithm object using the direct Fourier transform object from the array configuration ac. This will extract the uv positions from the observation to allow for a more efficient FT cache.

VLBISkyModels.DFTAlgMethod
DFTAlg(obs::EHTObservation)

Create an algorithm object using the direct Fourier transform object from the observation obs. This will extract the uv positions from the observation to allow for a more efficient FT cache.

VLBISkyModels.NFFTAlgMethod
NFFTAlg(ac::ArrayConfiguration; kwargs...)

Create an algorithm object using the non-unform Fourier transform object from the array configuration ac. This will extract the uv positions from the observation to allow for a more efficient FT cache.

The optional arguments are: padfac specifies how much to pad the image by, and m is an internal variable for NFFT.jl.

VLBISkyModels.NFFTAlgMethod
NFFTAlg(obs::EHTObservation; kwargs...)

Create an algorithm object using the non-unform Fourier transform object from the observation obs. This will extract the uv positions from the observation to allow for a more efficient FT cache.

The possible optional arguments are given in the NFFTAlg struct.

Base.mapMethod
map(f, args::JonesPairs...) -> JonesPairs

Maps over a set of JonesPairs applying the function f to each element. This returns a collected JonesPair. This us useful for more advanced operations on Jones matrices.

Examples

map(G, D, F) do g, d, f
    return f'*exp.(g)*d*f
end
Comrade.arrayconfigMethod
arrayconfig(vis)

Extract the array configuration from a EHT observation.

Comrade.baselinesMethod
baselines(CP::EHTClosurePhaseDatum)

Returns the baselines used for a single closure phase datum

Comrade.baselinesMethod
baselines(CP::EHTLogClosureAmplitudeDatum)

Returns the baselines used for a single closure phase datum

Comrade.baselinesMethod
baselines(scan::Scan)

Return the baselines for each datum in a scan

Comrade.beamsizeMethod
beamsize(ac::ArrayConfiguration)

Calculate the approximate beam size of the array ac as the inverse of the longest baseline distance.

Comrade.beamsizeMethod
beamsize(obs::EHTObservation)

Calculate the approximate beam size of the observation obs as the inverse of the longest baseline distance.

Comrade.caltableFunction
caltable(obs::EHTObservation, gains::AbstractVector)

Create a calibration table for the observations obs with gains. This returns a CalTable object that satisfies the Tables.jl interface. This table is very similar to the DataFrames interface.

Example

ct = caltable(obs, gains)

# Access a particular station (here ALMA)
ct[:AA]
ct.AA

# Access a the first row
ct[1, :]
Comrade.caltableFunction
caltable(g::JonesCache, jterms::AbstractVector)

Convert the JonesCache g and recovered Jones/corruption elements jterms into a CalTable which satisfies the Tables.jl interface.

Example

ct = caltable(gcache, gains)

# Access a particular station (here ALMA)
ct[:AA]
ct.AA

# Access a the first row
ct[1, :]
Comrade.caltableFunction
caltable(args...)

Creates a calibration table from a set of arguments. The specific arguments depend on what calibration you are applying.

Comrade.dataproductsMethod
dataproducts(d::Posterior)

Returns the data products you are fitting as a tuple. The order of the tuple corresponds to the order of the dataproducts argument in RadioLikelihood.

Comrade.dataproductsMethod
dataproducts(d::RadioLikelihood)

Returns the data products you are fitting as a tuple. The order of the tuple corresponds to the order of the dataproducts argument in RadioLikelihood.

Comrade.dirty_beamMethod
dirty_beam(fov::Real, npix::Int, obs::EHTObservation{T,<:EHTVisibilityDatum}) where T

Computes the dirty beam of the complex visibilities assuming a field of view of fov and number of pixels npix using baseline coverage found in obs.

The dirty beam is the inverse Fourier transform of the (u,v) coverage assuming every visibility is unity and everywhere else is zero.

Comrade.dirty_imageMethod
dirty_image(fov::Real, npix::Int, obs::EHTObservation{T,<:EHTVisibilityDatum}) where T

Computes the dirty image of the complex visibilities assuming a field of view of fov and number of pixels npix using the complex visibilities found in the observation obs.

The dirty image is the inverse Fourier transform of the measured visibilties assuming every other visibility is zero.

Comrade.extract_FRsMethod
extract_FRs

Extracts the feed rotation Jones matrices (returned as a JonesPair) from an EHT observation obs.

Warning

eht-imaging can sometimes pre-rotate the coherency matrices. As a result the field rotation can sometimes be applied twice. To compensate for this we have added a ehtim_fr_convention which will fix this.

Comrade.extract_ampFunction
extract_amp(obs; kwargs...)

Extracts the visibility amplitudes from an obs. This is an internal method for dispatch. Only use this if interfacing Comrade with a new data type.

Comrade.extract_coherencyFunction
extract_coherency(obs; kwargs...)

Extracts the full coherency matrix from an observation. This is an internal method for dispatch. Only use this if interfacing Comrade with a new data type.

Comrade.extract_cphaseFunction
extract_cphase(obs; kwargs...)

Extracts the closure phases from an obs. This is an internal method for dispatch. Only use this if interfacing Comrade with a new data type.

Comrade.extract_lcampFunction
extract_lcamp(obs; kwargs...)

Extracts the log-closure amplitudes from an obs. This is an internal method for dispatch. Only use this if interfacing Comrade with a new data type.

Comrade.extract_tableMethod
extract_table(obs, dataproducts::VLBIDataProducts)

Extract an Comrade.EHTObservation table of data products dataproducts. To pass additional keyword for the data products you can pass them as keyword arguments to the data product type. For a list of potential data products see subtypes(Comrade.VLBIDataProducts).

Example

julia> dlcamp, dcphase = extract_table(obs, LogClosureAmplitudes(;snrcut=3.0), ClosurePhases(;snrcut=3.0, cut_trivial=true))
julia> dcoh = extract_table(obs, Coherencies())
julia> dvis = extract_table(obs, VisibilityAmplitudes())
Comrade.extract_visFunction
extract_vis(obs; kwargs...)

Extracts the stokes I complex visibilities from an obs. This is an internal method for dispatch. Only use this if interfacing Comrade with a new data type.

Comrade.getdataMethod
getdata(obs::EHTObservation, s::Symbol)

Pass-through function that gets the array of s from the EHTObservation. For example say you want the times of all measurement then

getdata(obs, :time)
Comrade.getuvMethod
getuv

Get the u, v positions of the array.

Comrade.instrumentmodelMethod
skymodel(post::Posterior, θ)

Returns the instrument model of a posterior using the parameter valuesθ

Comrade.instrumentmodelMethod
skymodel(lklhd::RadioLikelihood, θ)

Returns the instrument model of a lklhderior using the parameter valuesθ

Comrade.jonesDMethod
jonesD(d1::AbstractVector, d2::AbstractVector, jcache::AbstractJonesCache)
jonesD(f, d1::AbstractVector, d2::AbstractVector, jcache::AbstractJonesCache)

Constructs the pairs Jones D matrices for each pair of stations. The d1 are the d-termsfor the first polarization basis and d2 are the d-terms for the other polarization. The first argument is optional and denotes a function that is applied to every element of jones cache. For instance if d1 and d2 are the log-dterms then f=exp will convert them into the dterms.

The layout for each matrix is as follows:

    1  d1
    d2 1
Comrade.jonesGMethod
jonesG(g1::AbstractVector, g2::AbstractVector, jcache::AbstractJonesCache)
jonesG(f, g1::AbstractVector, g2::AbstractVector, jcache::AbstractJonesCache)

Constructs the pairs Jones G matrices for each pair of stations. The g1 are the gains for the first polarization basis and g2 are the gains for the other polarization. The first argument is optional and denotes a function that is applied to every element of jones cache. For instance if g1 and g2 are the log-gains then f=exp will convert them into the gains.

The layout for each matrix is as follows:

    g1 0
    0  g2
Comrade.jonesRMethod
jonesR(tcache::ResponseCache)

Returns a JonesPair of matrices that transform from the model coherency matrices basis to the on-sky coherency basis, this includes the feed rotation and choice of polarization feeds.

Comrade.jonesStokesMethod
jonesStokes(g1::AbstractArray, gcache::AbstractJonesCache)
jonesStokes(f, g1::AbstractArray, gcache::AbstractJonesCache)

Construct the Jones Pairs for the stokes I image only. That is, we only need to pass a single vector corresponding to the gain for the stokes I visibility. This is for when you only want to image Stokes I. The first argument is optional and denotes a function that is applied to every element of jones cache. For instance if g1 and g2 are the log-gains then f=exp will convert them into the gains.

Warning

In the future this functionality may be removed when stokes I fitting is replaced with the more correct trace(coherency), i.e. RR+LL for a circular basis.

Comrade.jonescacheMethod
jonescache(obs::EHTObservation, segmentation::ObsSegmentation)
jonescache(obs::EHTObservatoin, segmentation::NamedTuple)

Constructs a JonesCache from a given observation obs using the segmentation scheme segmentation. If segmentation is a named tuple it is assumed that each symbol in the named tuple corresponds to a segmentation for thes sites in obs.

Example

# coh is a EHTObservation
julia> jonescache(coh, ScanSeg())
julia> segs = (AA = ScanSeg(), AP = TrachSeg(), AZ=FixedSegSeg())
julia> jonescache(coh, segs)
Comrade.likelihoodMethod
likelihood(d::ConditionedLikelihood, μ)

Returns the likelihood of the model, with parameters μ. That is, we return the distribution of the data given the model parameters μ. This is an actual probability distribution.

Comrade.prior_sampleMethod
prior_sample([rng::AbstractRandom], post::Posterior, args...)

Samples the prior distribution from the posterior. The args... are forwarded to the Base.rand method.

Comrade.prior_sampleMethod
prior_sample([rng::AbstractRandom], post::Posterior)

Returns a single sample from the prior distribution.

Comrade.samplertypeMethod
samplertype(::Type)

Sampler type specifies whether to use a unit hypercube or unconstrained transformation.

Comrade.scantableMethod
scantable(obs::EHTObservation)

Reorganizes the observation into a table of scans, where scan are defined by unique timestamps. To access the data you can use scalar indexing

Example

st = scantable(obs)
# Grab the first scan
scan1 = st[1]

# Acess the detections in the scan
scan1[1]

# grab e.g. the baselines
scan1[:baseline]
Comrade.simulate_observationMethod
simulate_observation([rng::Random.AbstractRNG], post::Posterior, θ)

Create a simulated observation using the posterior and its data post using the parameter values θ. In Bayesian terminology this is a draw from the posterior predictive distribution.

Comrade.skymodelMethod
skymodel(post::Posterior, θ)

Returns the sky model or image of a posterior using the parameter valuesθ

Comrade.skymodelMethod
skymodel(post::RadioLikelihood, θ)

Returns the sky model or image of a posterior using the parameter valuesθ

Comrade.station_tupleMethod
station_tuple(stations, default; reference=nothing kwargs...)
station_tuple(obs::EHTObservation, default; reference=nothing, kwargs...)

Convienence function that will construct a NamedTuple of objects whose names are the stations in the observation obs or explicitly in the argument stations. The NamedTuple will be filled with default if no kwargs are defined otherwise each kwarg (key, value) pair denotes a station and value pair.

Optionally the user can specify a reference station that will be dropped from the tuple. This is useful for selecting a reference station for gain phases

Examples

julia> stations = (:AA, :AP, :LM, :PV)
julia> station_tuple(stations, ScanSeg())
(AA = ScanSeg(), AP = ScanSeg(), LM = ScanSeg(), PV = ScanSeg())
julia> station_tuple(stations, ScanSeg(); AA = FixedSeg(1.0))
(AA = FixedSeg(1.0), AP = ScanSeg(), LM = ScanSeg(), PV = ScanSeg())
julia> station_tuple(stations, ScanSeg(); AA = FixedSeg(1.0), PV = TrackSeg())
(AA = FixedSeg(1.0), AP = ScanSeg(), LM = ScanSeg(), PV = TrackSeg())
julia> station_tuple(stations, Normal(0.0, 0.1); reference=:AA, LM = Normal(0.0, 1.0))
(AP = Normal(0.0, 0.1), LM = Normal(0.0, 1.0), PV = Normal(0.0, 0.1))
Comrade.stationsMethod
stations(g::CalTable)

Return the stations in the calibration table

Comrade.stationsMethod
stations(d::EHTObservation)

Get all the stations in a observation. The result is a vector of symbols.

Comrade.uvpositionsMethod
uvpositions(datum::AbstractVisibilityDatum)

Get the uvp positions of an inferometric datum.

Comrade.vlbimodelMethod
vlbimodel(post::Posterior, θ)

Returns the instrument model and sky model as a VLBIModel of a posterior using the parameter values θ

Comrade.vlbimodelMethod
vlbimodel(post::Posterior, θ)

Returns the instrument model and sky model as a VLBIModel of a posterior using the parameter values θ

ComradeBase.bispectrumMethod
bispectrum(d1::T, d2::T, d3::T) where {T<:EHTVisibilityDatum}

Finds the bispectrum of three visibilities. We will assume these form closed triangles, i.e. the phase of the bispectrum is a closure phase.

ComradeBase.closure_phaseMethod
closure_phase(D1::EHTVisibilityDatum,
              D2::EHTVisibilityDatum,
              D3::EHTVisibilityDatum
              )

Computes the closure phase of the three visibility datums.

Notes

We currently use the high SNR Gaussian error approximation for the closure phase. In the future we may use the moment matching from Monte Carlo sampling.

ComradeBase.closure_phasesMethod
closure_phases(vis::AbstractArray, ac::ArrayConfiguration)

Compute the closure phases for a set of visibilities and an array configuration

Notes

This uses a closure design matrix for the computation.

ComradeBase.closure_phasesMethod
closure_phases(m::AbstractModel, ac::ClosureConfig)

Computes the closure phases of the model m using the array configuration ac.

Notes

This is faster than the closure_phases(m, u1, v1, ...) method since it only computes as many visibilities as required thanks to the closure design matrix formalism from Blackburn et al.[1]

ComradeBase.logclosure_amplitudesMethod
logclosure_amplitudes(vis::AbstractArray, ac::ArrayConfiguration)

Compute the log-closure amplitudes for a set of visibilities and an array configuration

Notes

This uses a closure design matrix for the computation.

ComradeBase.logclosure_amplitudesMethod
logclosure_amplitudes(m::AbstractModel, ac::ClosureConfig)

Computes the log closure amplitudes of the model m using the array configuration ac.

Notes

This is faster than the logclosure_amplitudes(m, u1, v1, ...) method since it only computes as many visibilities as required thanks to the closure design matrix formalism from Blackburn et al.[1]

ComradeBase.visibilityMethod
visibility(d::EHTVisibilityDatum)

Return the complex visibility of the visibility datum

HypercubeTransform.ascubeMethod
ascube(post::Posterior)

Construct a flattened version of the posterior where the parameters are transformed to live in (0, 1), i.e. the unit hypercube.

This returns a TransformedPosterior that obeys the DensityInterface and can be evaluated in the usual manner, i.e. logdensityof. Note that the transformed posterior automatically includes the terms log-jacobian terms of the transformation.

Example

julia> tpost = ascube(post)
julia> x0 = prior_sample(tpost)
julia> logdensityof(tpost, x0)

Notes

This is the transform that should be used if using typical NestedSampling methods, i.e. ComradeNested. For the transformation to unconstrained space see asflat

HypercubeTransform.asflatMethod
asflat(post::Posterior)

Construct a flattened version of the posterior where the parameters are transformed to live in (-∞, ∞).

This returns a TransformedPosterior that obeys the DensityInterface and can be evaluated in the usual manner, i.e. logdensityof. Note that the transformed posterior automatically includes the terms log-jacobian terms of the transformation.

Example

julia> tpost = ascube(post)
julia> x0 = prior_sample(tpost)
julia> logdensityof(tpost, x0)

Notes

This is the transform that should be used if using typical MCMC methods, i.e. ComradeAHMC. For the transformation to the unit hypercube see ascube

ParameterHandling.flattenMethod
flatten(post::Posterior)

Construct a flattened version of the posterior but do not transform to any space, i.e. use the support specified by the prior.

This returns a TransformedPosterior that obeys the DensityInterface and can be evaluated in the usual manner, i.e. logdensityof. Note that the transformed posterior automatically includes the terms log-jacobian terms of the transformation.

Example

julia> tpost = flatten(post)
julia> x0 = prior_sample(tpost)
julia> logdensityof(tpost, x0)

Notes

This is the transform that should be used if using typical MCMC methods, i.e. ComradeAHMC. For the transformation to the unit hypercube see ascube

StatsBase.sampleMethod
sample(post::Posterior, sampler::S, args...; initial_params=nothing, kwargs...)

Sample a posterior post using the sampler. You can optionally pass the starting location of the sampler using initial_params, otherwise a random draw from the prior will be used.

TransformVariables.inverseMethod
inverse(posterior::TransformedPosterior, x)

Transforms the value y from parameter space to the transformed space (e.g. unit hypercube if using ascube).

For the inverse transform see transform

TransformVariables.transformMethod
transform(posterior::TransformedPosterior, x)

Transforms the value x from the transformed space (e.g. unit hypercube if using ascube) to parameter space which is usually encoded as a NamedTuple.

For the inverse transform see inverse

  • 1Blackburn L., et al "Closure Statistics in Interferometric Data" ApJ 2020
  • 1Blackburn L., et al "Closure Statistics in Interferometric Data" ApJ 2020