Imaging (+ Modeling)

Hybrid model + image reconstruction: a parametric model handles compact/unresolved components while an image captures the extended emission.

FunctionDescription
reconstruct_hybrid(x0, params, model, data, ft)Alternating image VMLMB + parameter NelderMead
reconstruct_sparco_flat(x0, params, model, data, ft)Joint VMLMB over params + image (legacy)
model_and_image_to_chi2_fg(model, params, image, g_image, ft, data)Hybrid model+image chi² + gradient (mono or poly)
cvis_to_chi2_fg(V, data)Chi² + complex adjoint source from complex visibilities (building block)
OITOOLS.reconstruct_hybridFunction
reconstruct_hybrid(x_start, params_start, model, data, ft;
                          w_name="W", regularizers=[], weights=[1,1,1],
                          maxiter=200, rounds=5, verb=false, vonmises=false,
                          params_lower=nothing, params_upper=nothing, ...)

SPARCO image reconstruction using a flat-model parametric component.

Alternates between:

  1. Image VMLMB: optimize image pixels with parameters fixed, using model_and_image_to_chi2_fg + regularization.
  2. Parameter NelderMead: optimize model parameters with the image fixed, using optimize_sparco_flat_parameters.

This separation avoids the scale-mismatch problem of jointly optimizing parameters and image pixels in a single VMLMB run.

Returns (params_final, x_final).

source
OITOOLS.model_and_image_to_chi2_fgFunction
model_and_image_to_chi2_fg(model, x_params, image, g_image, ft, data::OIdata;
                            w_name=nothing, weights=[1,1,1], verb=false, vonmises=false)

Hybrid chi2+gradient combining a parametric model with an image (monochromatic).

When w_name is provided, the image weight W(λ) is evaluated from the named model output and V_total = V_model + W(λ) · V_image.

When w_name is nothing, uses the SPARCO flux convention: V_total = (1 - V_model(0,0)) · V_image + V_model.

Mutates g_image in-place. Returns (chi2, g_params).

source
model_and_image_to_chi2_fg(model, x_params, image, g_image, ft, data::Vector{<:OIdata};
                            w_name="W", weights=[1,1,1,0,0,0,0], verb=false, vonmises=false)

Polychromatic hybrid chi2+gradient for a parametric model + power-law grey image.

A single grey image is modulated by W(λ) at each wavelength channel, following the SPARCO convention: V_total(λ) = V_model(λ) + W(λ) · V_image.

Mutates g_image in-place. Returns (chi2, g_params).

source
OITOOLS.cvis_to_chi2_fgFunction
cvis_to_chi2_fg(V, data; weights=[1,1,1,0,0,0,0], vonmises=false)
    -> (Float64, Vector{ComplexF64})

Compute chi-squared and the complex adjoint source g_cvis from complex visibilities V and interferometric data data.

This is the core building block for all gradient-based chi² code paths (model fitting, image reconstruction, SPARCO, hybrid model+image). It handles per-channel observables: V², T3amp, T3phi, visamp, visphi. It does not handle flux or differential phase (cross-channel observables).

The adjoint source g_cvis satisfies:

  • g_params = real(Jᵀ · g_cvis) for any model Jacobian J
  • g_image = real(DFTᵀ · g_cvis) for DFT image reconstruction
  • g_image = real(NFFT^H · conj(g_cvis)) for NFFT image reconstruction
source