Model Setup

Parametric models

FunctionDescription
dict_to_model(model_dict, list_free_params)Compile a flat parameter dict into a FlatModel
model_to_vis(model, x, uv)Evaluate complex visibilities for a model (alias: eval_model)
eval_model_grad(model, x, uv)Evaluate visibilities + Jacobian
eval_model_jac!(V, J, ws, model, x, uv)Visibilities + Jacobian from closed-form derivatives, in place (ws = ModelJacWorkspace(model, x, uv))
ModelJacCache()The Jacobian's buffers kept between calls; jac_cache of chi2_flat_fg and residuals_flat_jac
eval_model_sub(model, x, uv; wl, dlam)Visibilities across each spectral channel, for bandwidth smearing
display_model(model_dict, list_free_params)Pretty-print model parameters
model_to_obs(model, x, data)Compute observables (V², T3amp, T3phi) from a model
model_to_residuals(model, x, data)Compute normalised residuals (model - data) / error
model_to_chi2(model, x, data)Compute weighted chi² (alias: chi2_flat)
model_to_chi2_fg(model, x, data)Compute chi² + gradient (alias: chi2_flat_fg)
model_to_image(model, x; nx, pixsize)Synthesize a model image via inverse FFT
model_to_sed(model, x, wl_grid)Compute spectral energy distribution
model_to_flux(model, x; wl)Total flux at zero baseline: real(V(0,0))

The packages each fitter needs are listed under What each optimiser needs.

OITOOLS.dict_to_model — Function
dict_to_model(model_dict, list_free_params; nB_workspace=100) -> FlatModel

Compile a flat parameter dict into a FlatModel ready for evaluation.

Arguments

modeldict : Dict{String,Any} with "component,param" keys. Values may be Float64 (fixed or free) or String (expression). Special string key "component,profile" triggers the Hankel pathway. listfreeparams : Vector{String} of keys to optimize (must be numeric in modeldict). nB_workspace : Pre-allocated baseline grid size for HankelWorkspace buffers. Should be ≥ the number of baselines you will evaluate at.

Returns

A FlatModel, evaluated by evalmodel / evalmodel_grad without Dict lookups.

Example

model_dict = Dict(
    "star,ud"      => 0.8,
    "star,f"       => 0.6,
    "ring,profile" => "exp(-(\$R / \$scale)^2 / 2)",
    "ring,scale"   => 1.5,
    "ring,udout"   => 12.0,
    "ring,f"       => "1 - \$star,f",
)
list_free_params = ["star,ud", "star,f", "ring,scale"]
model = dict_to_model(model_dict, list_free_params)
source
OITOOLS.model_to_vis — Function
model_to_vis(model, x, uv; wl=nothing, mjd=nothing, n=0)

Alias for eval_model. Compute complex visibilities from a parametric model, for consistency with the model_to_obs / model_to_chi2 family.

source
OITOOLS.eval_model — Function
eval_model(model, x, uv; wl=nothing, mjd=nothing, n=0, normalize=true) -> Vector{Complex{T}}

Evaluate the model visibility at the given parameter vector x and baselines uv: Σ fᵢ Vᵢ / Σ fᵢ, normalised by the total flux at each point (model_flux), so a component's f is its flux in any unit and V(0) = 1.

Arguments

model : FlatModel from dicttomodel x : current free-parameter values, length = length(model.listfreeparams) uv : 2×N matrix of (u,v) spatial frequencies in cycles/rad wl : wavelength per UV point (metres), length N — enables $WL (microns) in expressions mjd : MJD per UV point, length N — enables $MJD in expressions n : Bessel order for Hankel components (default 0) plane_wl : the wavelength an image component chooses its plane by (default wl) normalize : divide by the total flux (default). false returns Σ fᵢ Vᵢ, for a model that is one part of a larger sum, beside an image (SPARCO, VI).

eval_model returns one visibility per uv point and does not smear. A model with "smear" => n is averaged over its channels by eval_model_sub and the χ² functions.

Returns

V : complex visibility vector, length N

source
OITOOLS.model_flux — Function
model_flux(model, x; wl = nothing, mjd = nothing) -> Vector

The model's total flux, Σ f over its components, at each wavelength (and epoch) given, or once without them. eval_model divides the visibilities by it; it is what an OI_FLUX measurement is compared with.

source
OITOOLS.eval_model_grad — Function
eval_model_grad(model, x, uv; wl=nothing, mjd=nothing, n=0) -> (V, J)

Evaluate model visibility and its Jacobian w.r.t. x.

Returns

V : complex visibility vector (length nB) J : Jacobian, Matrix{Complex{T}} of shape (nB, length(x)); T follows x and uv

From closed-form derivatives, by eval_model_jac. Parameters that are not floating-point numbers (a ForwardDiff Dual, when a Hessian is taken through this function) and Bessel orders n ≠ 0 go through eval_model_grad_ad.

source
OITOOLS.eval_model_jac! — Function
eval_model_jac!(V, J, ws, model, x, uv; wl = nothing, mjd = nothing, plane_wl = wl) -> (V, J)

The model's visibilities V (length N) and their Jacobian J (N × length(x), complex) with respect to the free parameters, in place, from closed-form derivatives. ws is a ModelJacWorkspace for this model, x and uv. Same conventions as eval_model; eval_model_grad_ad computes the same by automatic differentiation.

source
eval_model_jac!(cache::ModelJacCache, model, x, uv; wl, mjd, plane_wl) -> (V, J)

eval_model_jac! into the cache's buffers, which are rebuilt when they do not fit.

source
OITOOLS.ModelJacWorkspace — Type
ModelJacWorkspace(model, x, uv)

Buffers for eval_model_jac!: sized for model, for length(x) free parameters and size(uv, 2) uv points, in the precision eval_model would use for x and uv. One per thread; reusable for any parameter values with the same model and the same number of points.

source
OITOOLS.ModelJacCache — Type
ModelJacCache()

Buffers for a caller that evaluates the Jacobian of one model many times: a ModelJacWorkspace and V, J, rebuilt only when the model, the number of uv points, the number of free parameters or the precision changes. Pass it to eval_model_jac! or as jac_cache to model_to_chi2_fg and residuals_flat_jac. The V and J returned belong to the cache and the next call overwrites them. A smeared χ² keeps its sub-wavelength points here too. A cache is not shared between tasks: make one per task.

source
OITOOLS.eval_model_sub — Function
eval_model_sub(model, x, uv; wl, dlam, mjd = nothing, nsub = model.smear, n = 0)
    -> Matrix{Complex{T}}

The model's visibilities across each spectral channel: an N × nsub matrix whose column k holds every uv point at its channel's k-th sub-wavelength.

A channel is wl ± dlam/2 (metres, per point or one value for all), sampled at the midpoints of nsub equal steps in WAVENUMBER, a flat spectrum across the channel. A point's uv, which is its baseline over the channel's central wavelength, is rescaled to each sub-wavelength, and $WL takes the sub-wavelength. An image component keeps the channel's own plane at every sub-wavelength. A point with no width (dlam 0 or not finite) repeats its central value.

For a model with "smear" => nsub (2 or more, or "auto") and data with channel widths, the χ² functions, residuals_flat and model_to_obs average the observables over the columns (V² as the mean of |V|², a triple product as the mean of the products), or with "smear_mode" => "coherent" average the visibilities first.

source
OITOOLS.smear_samples — Function
smear_samples(model, data) -> Int

How many sub-wavelengths per channel model uses on data: smear as given, or for "smear" => "auto" CANDID's rule (_estimateNsmear), four samples per cycle of the largest phase change across a channel, at least 3. The phase change is that of a point at the model's extent (FlatModel.smear_radius, fixed when the model is compiled, so a fit never sees the sampling change) on the data's longest projected baseline.

source
OITOOLS.display_model — Function
display_model(model_dict, list_free_params; lb, ub)

Print the model by component: each parameter's value or expression, free or fixed, and its bounds, with warnings for values outside their bounds, empty bounds, fluxes, and references to missing parameters (see model_warnings).

source
OITOOLS.model_warnings — Function
model_warnings(model_dict, list_free_params; lb, ub) -> Vector{String}

Problems in a model that can be found without fitting it, one sentence each:

  • a free parameter's starting value outside its bounds, or bounds with lb ≥ ub;
  • numeric fluxes summing to zero or less (the visibilities are divided by the total flux);
  • every flux free, so their common scale is undetermined (fix one, or write one as 1 − the others);
  • an expression referring to a parameter that is not in the model, or to an implicit variable its kind of expression does not have ($WL in a profile); evaluating the model then raises an UndefVarError that does not name the key;
  • a key the parser ignores: a non-shape key no expression refers to (unused, or misspelt such as star,diamm), or a shape key of another kind than the one that set the component's kind (ud beside diamin, which make a ring);
  • $WL (microns) compared with or divided by a constant below 1e-3, which looks like metres.

Fluxes given as expressions are not checked. display_model prints the bound, flux and reference warnings.

source
OITOOLS.model_to_obs — Function
model_to_obs(model, x, data) -> (v2, t3amp, t3phi, visamp, visphi)

The model observables at parameter vector x, matching the data: a NamedTuple with fields v2, t3amp, t3phi (degrees), visamp, visphi (degrees). Empty vectors are returned for observable types not present in data.

source
OITOOLS.model_to_residuals — Function
model_to_residuals(model, x, data)

Normalised residuals (model - data) / error as a NamedTuple with fields v2, t3amp, t3phi, visamp, visphi. Phase differences are wrapped to [-180, 180] before division.

source
OITOOLS.model_to_chi2 — Function
model_to_chi2(model, x, data; weights=[1,1,1,0,0,0,0], verb=false)

Alias for chi2_flat. Compute the weighted chi-squared of a parametric model against data, for consistency with the model_to_obs / model_to_vis family.

source
OITOOLS.model_to_chi2_fg — Function
model_to_chi2_fg(model, x, data; weights=[1,1,1,0,0,0,0], verb=false)

Alias for chi2_flat_fg. Compute chi-squared and its gradient w.r.t. x, for consistency with the model_to_obs / model_to_vis family.

source
OITOOLS.model_to_image — Function
model_to_image(model, x; nx=256, pixsize=0.1, oversample=1, normalize=true, wl=nothing)
    -> Matrix{Float64}

Synthesise an image from a FlatModel at parameter vector x.

The model visibility is evaluated on the FFT frequency grid (half of it, by Hermitian symmetry) and transformed by an inverse real FFT.

Arguments

  • model::FlatModel — compiled model from dict_to_model
  • x::AbstractVector — current free-parameter values

Keywords

  • nx — image size in pixels (default 256)
  • pixsize — pixel size in mas (default 0.1)
  • oversample — oversampling factor (default 1)
  • normalize — normalize image to unit sum (default true)
  • wl — wavelength in metres (scalar), as every wl argument; enables $WL (microns in the expressions) in spectrum expressions

Returns

img — nx × nx Matrix{Float64}

source
OITOOLS.model_to_sed — Function
model_to_sed(model, x, wl_grid) -> (total, components)

The spectral energy distribution of a FlatModel: the total flux and each component's flux (its f / spectrum resolved) at each wavelength.

Arguments

  • model::FlatModel — compiled model from dict_to_model
  • x::AbstractVector — current free-parameter values
  • wl_grid — wavelengths in metres, as uv_lam and every wl argument; expressions see $WL in microns.

Returns

  • total::Vector{T} — total flux at each wavelength, Σ f (model_flux), in the parameters' type
  • components::Dict{String,Vector{T}} — per-component flux, in the same type
source
OITOOLS.model_to_flux — Function
model_to_flux(model, x; wl=nothing)

Total flux of the model at zero baseline: real(V(0,0)).

For a chromatic model, wl (metres) is a scalar or a 1-element vector. See also model_to_sed.

source

Bandwidth smearing

A model with the global key "smear" => n (2 or more) is averaged over each spectral channel wherever it meets data: model_to_chi2, its gradient, residuals_flat, model_to_obs, every fitter built on them, and simulate_from_oifits. Each channel, EFF_WAVE ± EFF_BAND/2, is sampled at n sub-wavelengths, evenly in wavenumber; V² is the channel mean of |V|², a triple product the mean of the products, a visibility the mean visibility, as in PMOIRED and CANDID. Smearing affects a companion near or beyond the smearing radius R λ / (2 B_max) and fills in visibility nulls. Without the key, or with 0 or 1, there is no smearing. SPARCO's image + model criterion refuses a smeared model.

"smear" => "auto" chooses n per dataset by CANDID's rule (four samples per cycle of the largest phase change across a channel, at least 3) for a point at the model's extent: each component's offset plus half its size, at the values the dict holds when the model is compiled. smear_samples reports n.

"smear_mode" => "coherent" averages the visibility over the channel and forms the observables from that average, as for an ABCD or coherent-flux measurement (GRAVITY) and in CANDID. The default, "incoherent", corresponds to power-spectrum estimators (fringe-scanning combiners). Smearing of V² and closure phase depends on the fringe encoding and the estimator (Lachaume & Berger 2013, MNRAS 435, 2501). For a binary the two modes differ by f²(1 − sinc²).

Spectral lines

A component's flux can carry spectral lines, with PMOIRED's keys and formulas: c,line_<n>_wl0 (µm), c,line_<n>_f (the peak added to the continuum; < 0 for absorption) and one profile with its width in nm: c,line_<n>_lorentzian (FWHM), c,line_<n>_gaussian (FWHM, with an optional c,line_<n>_power), c,line_<n>_truncexp (with c,line_<n>_pow) or c,line_<n>_trunclor (one-sided: redward for a positive width, blueward for a negative one). The component's flux at each wavelength is its continuum (c,f, or 1) plus its lines, and weights its visibility, so the lines appear in V, the phases, the closure phases and the flux. Each key is an ordinary parameter; a line centre written as a velocity: "A,line_brg_wl0" => "2.16612 * (1 + \$vA / 2.998e5)".

OITOOLS.line_lorentzian — Function
line_lorentzian(wl, wl0, f, fwhm)

A Lorentzian line of peak f at wl0 (µm), FWHM fwhm (nm), at wavelength wl (µm): PMOIRED's line_<n>_lorentzian.

source
OITOOLS.line_gaussian — Function
line_gaussian(wl, wl0, f, fwhm, power = 2)

A Gaussian line (generalised by power) of peak f at wl0 (µm), FWHM fwhm (nm): PMOIRED's line_<n>_gaussian with line_<n>_power.

source
OITOOLS.line_truncexp — Function
line_truncexp(wl, wl0, f, width, pow = 1)

PMOIRED's one-sided exponential line (line_<n>_truncexp, line_<n>_pow): exp(−|Δλ|^pow / w^pow) redward of wl0, and a ten times narrower exp(−|Δλ|^2pow / (w/10)^2pow) blueward; width in nm.

source
OITOOLS.line_trunclor — Function
line_trunclor(wl, wl0, f, width)

PMOIRED's one-sided Lorentzian (line_<n>_trunclor): the Lorentzian of FWHM |width| (nm) redward of wl0 for width > 0, blueward for width < 0.

source

Visibility functions

Visibilities through the model dictionary:

model = dict_to_model(Dict{String,Any}("star,ud" => 6.5, "star,f" => 1.0), String[])
V     = eval_model(model, Float64[], data.uv)

The component types and their parameters are listed in Component types.

eval_model returns Complex{T} (T from x and uv); the imaginary part is zero for a centred, symmetric component.

Build the model once and pass the varying values as free parameters: the result is the same as with the values in the dict, and dict_to_model takes about 15 µs against 3 µs for evaluating a uniform disc at 300 uv points:

model = dict_to_model(Dict{String,Any}("star,ud" => 6.5, "star,f" => 1.0), ["star,ud"])
V     = eval_model(model, [diameter], data.uv)     # vary the value, keep the model

One component at a time

The analytic visibility of one centred component, without a model dictionary; the dictionary interface uses the same functions. They are public, not exported: OITOOLS.vis_ud.

FunctionLaw
vis_ud(θ, ρ)uniform disc
vis_ldlin(θ, u, ρ)linear, I(μ) = 1 - u(1-μ)
vis_ldquad(θ, u, w, ρ)quadratic, I(μ) = 1 - u(1-μ) - w(1-μ)²
vis_ldsqrt(θ, c, d, ρ)square root, I(μ) = 1 - c(1-μ) - d(1-√μ)
vis_ldclaret4(θ, c1, c2, c3, c4, ρ)Claret four-parameter
vis_ldpow(θ, α, ρ)power law, I(μ) = μ^α

θ is in mas and ρ = √(u²+v²) in cycles/rad, the unit of OIdata.uv: ρ = sqrt.(uv[1,:].^2 .+ uv[2,:].^2). The result is real. Any parameter may be a vector (one value per wavelength). Gaussians and other elliptical components go through the dictionary.

OITOOLS.vis_ud — Function
vis_ud(θ, ρ)

Visibility of a uniform disc of diameter θ, V = 2J₁(t)/t with t = πθρ.

θ is in mas and ρ = √(u²+v²) in cycles/rad, the unit of OIdata.uv: ρ = sqrt.(uv[1,:].^2 .+ uv[2,:].^2). The result is real, 1 at ρ = 0. Any parameter may be a vector (for example one value per wavelength).

source
OITOOLS.vis_ldlin — Function
vis_ldlin(θ, u, ρ)

Linearly limb-darkened disc, I(μ) = 1 - u(1-μ), of diameter θ in mas.

Units and conventions as vis_ud.

source
OITOOLS.vis_ldquad — Function
vis_ldquad(θ, u, w, ρ)

Quadratically limb-darkened disc, I(μ) = 1 - u(1-μ) - w(1-μ)², of diameter θ in mas.

Units and conventions as vis_ud.

source
OITOOLS.vis_ldsqrt — Function
vis_ldsqrt(θ, c, d, ρ)

Square-root limb darkening, I(μ) = 1 - c(1-μ) - d(1-√μ), for a disc of diameter θ in mas.

c is the linear coefficient and d the square-root one, in Claret's order. Units as vis_ud.

source
OITOOLS.vis_ldclaret4 — Function
vis_ldclaret4(θ, c1, c2, c3, c4, ρ)

Claret's four-parameter limb darkening, I(μ) = 1 - Σₖ cₖ (1 - μ^{k/2}), for a disc of diameter θ in mas.

Units as vis_ud.

source
OITOOLS.vis_ldpow — Function
vis_ldpow(θ, α, ρ)

Power-law limb-darkened disc, I(μ) = μ^α, of diameter θ in mas.

Units and conventions as vis_ud.

source

Free-form limb darkening

A disc whose I(μ) is set by its values at N nodes μ_k = (k-1)/(N-1):

md = Dict{String,Any}("star,ldspline" => 8.4,         # diameter, mas
                      "star,ld1" => 0.60, "star,ld2" => 0.70,
                      "star,ld3" => 0.80, "star,ld4" => 0.90,   # I(μ_k)/I(1); I(1) = 1
                      "star,f" => 1.0)

ldspline interpolates a natural cubic spline in μ through the nodes, ldpiecewise straight lines. N is the number of ld<k> keys plus one. The visibility is exact for any node values: the Hankel transform of each basis function is tabulated once per (basis, N), with its derivative, so the cost and the Jacobian are those of a closed-form law. A linear law is represented exactly by either basis.

FunctionDescription
ld_free!(model_dict, free, comp; n, basis, monotonic, lb, ub)Make a disc free-form, its nodes taken from its current profile; monotonic fits the ratios ldq<k> ∈ [0, 1]
ld_profile(model_dict, comp, μ)I(μ)/I(1) of any disc law or free-form disc
ld_nodes(n)The node positions in μ
OITOOLS.ld_free! — Function
ld_free!(model_dict, free, component; n = 5, basis = :spline, monotonic = false,
         lb = nothing, ub = nothing) -> model_dict

Make the disc component a free-form limb-darkened disc with n nodes, in place: its diameter and whether it is free are kept, and the nodes take the values of the profile it had (any law, or a free-form disc with another n or basis), so a fit continues from it.

basis is :spline (c,ldspline) or :piecewise (c,ldpiecewise). The nodes are c,ld1 … c,ld<n-1>, I(μk)/I(1) at μk = (k-1)/(n-1), all free.

With monotonic = true the free parameters are the ratios c,ldq<k> = I(μk)/I(μ{k+1}) in [0, 1], and each c,ld<k> is the expression multiplying them, so I(μ) never increases toward the limb at the nodes. lb and ub, when given, receive the bounds of the new parameters and lose those of the removed ones.

source
OITOOLS.ld_profile — Function
ld_profile(model_dict, component, μ) -> Vector{Float64}

The intensity across a disc, I(μ)/I(1), at each μ, for any disc law (ud, ldlin, ldquad, ldsqrt, ldpow, ldclaret4) and for the free-form discs (ldspline, ldpiecewise). Coefficients that are expressions are evaluated.

source
OITOOLS.ld_nodes — Function
ld_nodes(n) -> Vector{Float64}

The μ of a free-form disc's n nodes: evenly spaced from 0 (the limb) to 1 (the centre).

source

Error bars on the profile

fit_ld_profile_vi (needs using VarInf) returns I(μ) with a band. The disc's profile is put on ngrid nodes (24) joined by straight lines, log I = log I₀ + f with I₀ the disc's current profile and f a correlated field whose amplitude and power spectrum are inferred with the profile (prior = :learned, VarInf's correlated field); the diameter is log-normal about its current value with a 10 % width. The run starts at the posterior's maximum, found from a scan of the diameter over ±22 %, draws its samples with geoVI (or MGVI), and is bagged over 20 bootstrap replicates of the data.

using OITOOLS, VarInf
m = Dict{String,Any}("star,ldlin" => 8.4, "star,u" => 0.3, "star,f" => 1.0)
r0 = fit_model_lsqfit(m, ["star,ldlin", "star,u"], data)
m["star,ldlin"], m["star,u"] = r0.x_opt
r = fit_ld_profile_vi(m, "star", data; scale_errors = true)
r.μ, r.I_median, r.I_lo, r.I_hi        # I/I(1) and its 16–84 % band
r.diameter_median, r.diameter_std
  • Start from a law fitted to the same data. The profile's prior is centred on that law.
  • Visibilities past the first null leave several minima in the diameter. The scan covers ±22 % of the starting value. chi2r far above chi2r_map in the result means the run did not converge.
  • The band assumes the error bars. With scale_errors = true, they are multiplied by √χ²r when the free-form profile's best fit has χ²r > 1 (error_scale in the result).
  • bootstrap = 20 is bagged VI (0 for a single run): the run is repeated on 20 block-bootstrap replicates of the data (configurations drawn with replacement) and their samples pooled. The band then holds the spread of the profile between replicates as well, which error bars or a model that do not describe the data widen. single in the result is the run on the full data. The replicates run on all threads; with the learned prior, 20 replicates take 12–19 s on 6 threads for α Cen A's coverage. A single run with the learned prior is overconfident (the truth in its band at about half the nodes).
  • Quote the medians (I_median, F_median, diameter_median): the samples of log I are near Gaussian, so the mean of I lies off the bulk of the samples where the data are weak.
  • Closure phases are not used by default: those of a symmetric disc are 0 or 180°, which V² already gives.
  • Calibration of the default, on data simulated with α Cen A's uv coverage and noise (σ(V²) = 2.5 %·V² + 3.5e-4), for stars with power-law, square-root, quadratic and 4-coefficient (Claret) profiles at 3 to 14 mas. For μ ≥ 0.3, I/⟨I⟩ is within 0.8–2.5 % from 6 mas up (1–5 % at 3 mas), with the truth in the 16–84 % band at 68–100 % of the nodes; from 6 mas up the diameter is within 0.2–0.6 %, in its band in 50–100 % of the stars. At 0.1 ≤ μ ≤ 0.2 the error is 6–16 % from 6 mas up and the band holds the truth at 19–100 % of the nodes, the least for power-law and quadratic limbs; below μ = 0.1 the profile is the prior's (0–100 %, mostly under 50 %). A power-law fit to the same stars, when they are not power laws, misses the diameter by 0.3–1 % (0–12 % in its band from 6 mas up) and I/⟨I⟩ by 0.8–3.4 % for μ ≥ 0.3.
  • MGVI is faster; geoVI follows the curved posterior that the diameter and the limb intensity make together.
  • prior = :fixed fixes the Gaussian process instead (Matérn-3/2, length_scale 0.3 in μ, amplitude 0.3 in log I). Its bands are wider: bagged, the truth is in them at 89–100 % of the nodes for μ ≥ 0.3, at 2–6 % error, and at the limb more often than with the learned prior. Against Hamiltonian Monte Carlo on the same posterior its band is 1.0–1.13 times as wide and the mean within 0.25σ.
OITOOLS.fit_ld_profile_vi — Function
fit_ld_profile_vi(model_dict, component, data; kwargs...) -> LDProfileVIResult

The intensity profile I(μ) of the disc component, with error bars, by variational inference (needs using VarInf). The disc's profile becomes a field on ngrid nodes even in μ, joined by straight lines (ldpiecewise), log I = log I₀ + f, with I₀ the disc's current profile (any law, or a free-form disc) and f a Gaussian process; the diameter is log-normal about its current value. The run starts at the posterior's maximum, found from the lowest minima of a scan of the diameter over ±22 %; posterior samples come from MGVI or geoVI. The rest of the model is held at its values.

Keywords:

  • ngrid = 24: nodes of the profile.
  • prior = :learned: f is VarInf's correlated field, its power spectrum inferred, with the log-normal amplitude prior fluct = (mean, std) (default (0.3, 0.2), in log I) and the slope prior slope = (mean, std) (default (-4.0, 1.0)), on a grid padded to twice its length. prior = :fixed: f is a Gaussian process with a Matérn-3/2 kernel of length length_scale (in μ, default 0.3) and amplitude amplitude (in log I, default 0.3).
  • diameter_std = 0.1: the prior's relative width on the diameter.
  • method = :geovi or :mgvi; n_iterations = 6, n_samples = 4 per iteration; n_draws = 50: antithetic pairs drawn about the final mean for the statistics (split between the replicates when bagging).
  • weights: observables, as in fit_model; by default V² and T3amp. Closure phases of a symmetric disc are 0 or 180° and add only the side of a null, which V² gives; their wrapped residuals are steps the samplers cannot follow.
  • scale_errors = false: with true, error bars too small for the free-form profile's best fit (χ²r > 1 there) are multiplied by √χ²r before sampling. The band assumes the error bars; without this, underestimated ones make the profile follow the calibration's systematics.
  • bootstrap = 20: bagged VI with n ≥ 2 replicates, a single run with 0. The run is repeated on n bootstrap replicates of the data (configurations drawn with replacement), each from the full data's maximum and with its error scale, and their samples pooled with equal weight, max(4, cld(n_draws, n)) antithetic pairs each. Data with one configuration get a single run. The pool's spread is the posterior's plus the spread of its centre between replicates, which grows when the error bars or the model do not describe the data. The replicates run on all threads.
  • seed, verb.
source
OITOOLS.LDProfileVIResult — Type
LDProfileVIResult

What fit_ld_profile_vi returns. μ is the grid; the profiles are I(μ)/I(1) (I_*) and I(μ)/⟨I⟩, normalised by the mean intensity over the disc (F_*), which the visibilities measure directly. *_mean/*_median/*_std are over the posterior samples (columns of I_samples, F_samples); *_lo/*_hi their 16th and 84th percentiles. The median is the profile to quote: the samples of log I are near Gaussian, so those of I are skewed and their mean lies off the bulk where the data are weak. diameter, diameter_median and diameter_std likewise. The samples are drawn about centre: :mean, the variational mean, or :map, the posterior's maximum, when the variational mean diverged (χ²r more than twice the maximum's). model is the model with the disc as a ldpiecewise disc on the grid at that centre (a point of the posterior; the samples' mean need not be one), free its free parameters, and chi2r the data's reduced χ² there; chi2r_map is the same at the posterior's maximum, where the run starts. error_scale is the factor the data's error bars were multiplied by (1 unless scale_errors). With bagging, bootstrap is the number of replicates pooled and single the run on the full data alone; the samples and their statistics are the pool's, the centre, model and chi2r the full data's. Without, bootstrap is 0 and single is nothing.

source