virgil.observables
Spectro-interferometric observables that follow the visibilities and phases
in an OIData data vector: OI_FLUX spectra (absolute
up to a grey scale, or normalized), correlated fluxes, |V| beside V², triple
amplitudes, and continuum-normalized differential phases. Read them with
read_oifits(..., extras=...) or OIData(path, extras=...); the guide is
Spectro-interferometric observables.
Spectro-interferometric observables beside V² and closure phase.
OIData keeps its visibilities (vis) and
phases (phi) as before. The observables here are further blocks of the
same data vector, in OIData.extras, read with
read_oifits(..., extras=...). Each block
predicts its data and whitens its own residuals:
"flux":OI_FLUXas a spectrum known up to a grey scale,F(λ) = k Σ fᵢ(λ)fromtotal_spectrum(FluxSpectrum);"nflux":OI_FLUXnormalized to its continuum, F(λ)/F_c(λ), the same with the model normalized over the continuum channels;"corrflux": correlated fluxes (VISAMPwithAMPTYP = 'correlated flux'), k |Σ fᵢ(λ) Vᵢ|, up to a grey scale;"visamp": |V| (VISAMP,AMPTYP = 'absolute') beside V² (VisibilityAmplitude);"t3amp": triple amplitudes |V_ab V_bc V_ac| (TripleAmplitude);"visphi": differential phases, the exact arg V(λ) with the pipeline's continuum normalization applied as a linear operator (DifferentialPhase).
Grey scales are marginalized, not fitted, under a prior you state; the differential phases apply the pipeline's continuum normalization to the exact model phase. See spectro-interferometric observables.
FluxSpectrum
Bases: _Block
A spectrum known up to a grey scale: OI_FLUX or correlated fluxes.
The model of sample i (wavelength λᵢ, scale group gᵢ) is
mᵢ = Σ_j w_j tᵢ xᵢʲ, w ~ N((μ, 0, ...), diag(s, τ_1 μ, ...)²),
with t the model's template: the total spectrum Σ fᵢ(λ) ("flux"),
the same divided by its continuum fit per row ("nflux"), or the total
spectrum times |V| ("corrflux"), normalized to a mean of 1 per scale
group (except "nflux"). x is λ scaled to [-1, 1] across the group, so
w_0 = k is the grey scale and w_j (j ≥ 1) an optional polynomial.
(μ, s) is the stated prior on k in the data's units ((1, 0.1) by
default for "nflux"), τ the polynomial's relative widths. The Gaussian
is a proposal for the Jeffreys 1/k, which is improper: evidence
comparisons need a proper prior on bounded k (see
the grey scale).
The weights are marginalized analytically.
Build with :meth:build; change the prior, groups and widths with
OIData.with_flux_scale.
wavel
instance-attribute
sample
instance-attribute
row
instance-attribute
frame
instance-attribute
station
instance-attribute
mjd
instance-attribute
group
instance-attribute
members
instance-attribute
count
instance-attribute
poly
instance-attribute
mu
instance-attribute
cont_rows
instance-attribute
cont_basis
instance-attribute
cont_fit
instance-attribute
kind = eqx.field(static=True)
class-attribute
instance-attribute
widths
instance-attribute
scale
instance-attribute
poly_width
instance-attribute
per = eqx.field(static=True)
class-attribute
instance-attribute
continuum = eqx.field(static=True)
class-attribute
instance-attribute
continuum_order = eqx.field(static=True)
class-attribute
instance-attribute
model_dependent_covariance = True
class-attribute
instance-attribute
build(kind, values, errors, wavel, row, frame, station, sample=None, mjd=None, per='dataset', scale=None, poly_order=0, poly_width=0.1, continuum=None, continuum_order=0)
classmethod
Build from per-sample arrays (see the class notes).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
kind
|
(flux, nflux, corrflux)
|
|
"flux"
|
values
|
array - like
|
The data and their uncertainties, one per sample. |
required |
errors
|
array - like
|
The data and their uncertainties, one per sample. |
required |
wavel
|
array - like
|
Each sample's wavelength (metres). |
required |
row
|
array - like
|
Each sample's row (one spectrum), frame (exposure) and station
(a telescope's |
required |
frame
|
array - like
|
Each sample's row (one spectrum), frame (exposure) and station
(a telescope's |
required |
station
|
array - like
|
Each sample's row (one spectrum), frame (exposure) and station
(a telescope's |
required |
sample
|
array-like of int
|
For |
None
|
mjd
|
array - like
|
Each sample's time (days), for splitting by epoch. |
None
|
per
|
(dataset, row, frame, station)
|
One grey scale for all the samples (default), or one per row, frame or station (telescope or baseline). |
"dataset"
|
scale
|
(float, float)
|
The prior |
None
|
poly_order
|
int
|
Also marginalize a polynomial in λ of this order times the template (default 0: a grey scale only). |
0
|
poly_width
|
float
|
Prior width of each polynomial coefficient, relative to the scale's prior mean. |
0.1
|
continuum
|
sequence of (lo, hi)
|
For |
None
|
continuum_order
|
int
|
For |
0
|
rebuild(values=None, errors=None, keep=None, **settings)
The same block with new settings, data, or only some samples.
subset(keep, new_index, flux_keep=None)
predict(model, cvis)
whiten(prediction, data, errors)
posterior(prediction, data, errors)
Conditional posterior of the weights w per group: mean and cov.
mean[g, 0] is the grey scale k of group g, multiplying the
template; mean[g, j] (j ≥ 1) the polynomial coefficients. The
Gaussian prior is a proposal for k's Jeffreys prior (see the
module notes).
simulated(prediction, cvis, noise, key=None)
VisibilityAmplitude
Bases: _Block
|V| at samples, e.g. VISAMP beside VIS2DATA ("visamp").
V² and |V| from the same measurement are not independent; reading both counts it twice unless the pipeline measured them separately.
sample
instance-attribute
kind = eqx.field(static=True, default='visamp')
class-attribute
instance-attribute
predict(model, cvis)
subset(keep, new_index, flux_keep=None)
TripleAmplitude
Bases: _Block
|V_ab V_bc V_ac| of closure triangles (T3AMP, "t3amp").
i1
instance-attribute
i2
instance-attribute
i3
instance-attribute
kind = eqx.field(static=True, default='t3amp')
class-attribute
instance-attribute
predict(model, cvis)
subset(keep, new_index, flux_keep=None)
DifferentialPhase
Bases: _Block
Continuum-normalized phases (VISPHI, "visphi").
values and errors are the per-sample phases (radians) and their
uncertainties. Per frame, each baseline's phases are unwrapped along
wavelength and mapped by Y = Qᵀ Φ Wᵀ, where W holds the line-window
rows of N = I − L (continuum_operator) and Q is an orthonormal basis
of the telescope-differenced phases (closure-free, with closure phases in
the data) or the identity. The covariance is whitened by its Cholesky
factor per frame. With prior_width, the offsets and slopes are
instead marginalized under a finite Gaussian prior (the projection is its
flat limit), using the low-rank blocks of virgil.gains.
Residuals are treated as linear, which holds while the phases are well
below π. See
differential phases.
Build with :meth:build, or change the windows with
OIData.with_continuum.
sample
instance-attribute
wavel
instance-attribute
frame
instance-attribute
stations
instance-attribute
row
instance-attribute
grid
instance-attribute
chan
instance-attribute
q
instance-attribute
w
instance-attribute
valid
instance-attribute
keep
instance-attribute
basis
instance-attribute
continuum = eqx.field(static=True)
class-attribute
instance-attribute
lines = eqx.field(static=True)
class-attribute
instance-attribute
order = eqx.field(static=True)
class-attribute
instance-attribute
closure_free = eqx.field(static=True)
class-attribute
instance-attribute
prior_width = None
class-attribute
instance-attribute
kind = eqx.field(static=True, default='visphi')
class-attribute
instance-attribute
chol = None
class-attribute
instance-attribute
n_independent
property
build(values, errors, sample, wavel, frame, stations, row=None, continuum=None, lines=None, order=1, closure_free=True, prior_width=None)
classmethod
Build from per-sample phases (see the class notes).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
array - like
|
Phases (radians) and uncertainties, one per sample. |
required |
errors
|
array - like
|
Phases (radians) and uncertainties, one per sample. |
required |
sample
|
array-like of int
|
The visibility sample of each phase. |
required |
wavel
|
array - like
|
Each phase's wavelength (metres), frame, and station pair. |
required |
frame
|
array - like
|
Each phase's wavelength (metres), frame, and station pair. |
required |
stations
|
array - like
|
Each phase's wavelength (metres), frame, and station pair. |
required |
row
|
array-like of int
|
Which phases form one spectrum (one baseline of one frame); by default, those with the same frame and station pair. |
None
|
continuum
|
sequence of (lo, hi)
|
Wavelength ranges (metres). The continuum is fitted over the continuum channels and the line channels are kept. Either defaults to the complement of the other; with neither, every channel is both. |
None
|
lines
|
sequence of (lo, hi)
|
Wavelength ranges (metres). The continuum is fitted over the continuum channels and the line channels are kept. Either defaults to the complement of the other; with neither, every channel is both. |
None
|
order
|
int
|
1 (default): subtract a mean and a slope in wavenumber (an offset and a delay); 0: a mean. |
1
|
closure_free
|
bool
|
Keep only the telescope-differenced part of each frame's phases, orthogonal to the closure phases (default True; use it whenever the data have closure phases). |
True
|
prior_width
|
float or (float, float)
|
Marginalize the offset (and slope, per unit of the scaled
wavenumber, which spans 1 across the channels) of each
baseline and frame under Gaussian priors of these widths
(radians), over the channels of both windows, instead of
projecting them out ( |
None
|
rebuild(values=None, errors=None, keep=None, **settings)
The same block with new settings, data, or only some samples.
subset(keep, new_index, flux_keep=None)
data()
predict(model, cvis)
covariance(errors=None)
Per frame, the covariance of the outputs, (F, K R, K R).
Padded outputs get unit variance, so the matrices are invertible.
with_errors(errors)
data_errors()
whiten(prediction, data, errors)
simulated(prediction, cvis, noise, key=None)
continuum_operator(wavel, continuum, order=1)
The continuum fit of one spectrum, as a matrix.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
wavel
|
array - like
|
The channels' wavelengths (metres). |
required |
continuum
|
array-like of bool
|
Which channels are continuum. |
required |
order
|
int
|
0 fits a mean; 1 (the default) a mean and a slope in wavenumber 1/λ, which is an offset and a delay for a phase. |
1
|
Returns:
| Type | Description |
|---|---|
ndarray
|
|
in_ranges(wavel, ranges)
Whether each wavelength lies in one of ranges, [(lo, hi), ...].