Imaging (MCMC)

SQUEEZE image reconstruction by Markov-chain Monte Carlo: simulated annealing (reconstruct_squeeze) or parallel tempering (reconstruct_squeeze_tempered, which also returns the log evidence). See SQUEEZE (MCMC).

The image is nelements flux elements on the pixel grid, so it is non-negative with a fixed total flux, non-convex regularizers such as L0 are available, and the result is a mean image over samples.

FunctionDescription
reconstruct_squeeze(x_start, data, ft)MCMC image reconstruction by simulated annealing
SqueezeSparco(; f_star, ud, …)SPARCO chromatic star + background model
reconstruct_squeeze_tempered(data, ft)Parallel-tempered version (needs using Pigeons)
default_nelements(data, nx)Default number of flux elements for a dataset

Both accept monitor = n (draw the image and χ²r / parameter traces every n iterations) and print_every = n (SQUEEZE's text line); both are off by default.

Regularizers

Passed as regularizers = [["l0", λ], ["tv", λ], …], the same convention as reconstruct.

NameForm on the integer histogramTypical λ
"l0"count of nonzero pixels1 – 20
"tv"Σ √(dx²+dy²) / nelements, backward differences200 – 2000
"entropy"Σ_{x>0} lgamma(x) (quantised / Poisson prior)1 – 10
"compactness"Σ r²·x²20 – 500
"centering"centroid / second-moment penalty1 (auto)
"priorimage"Σ -log(prior[pixel]) over elements; see prior_image1 (auto)
Not the same as `reconstruct`'s regularizers

These are SQUEEZE's forms, on the integer histogram with a /nelements normalisation. reconstruct's tv, entropy and compactness are defined on the normalised image, so their λ values do not carry over.

API

OITOOLS.reconstruct_squeeze — Function
reconstruct_squeeze(data, ft; kwargs...)           -> (image, diagnostics)
reconstruct_squeeze(x_start, data, ft; kwargs...)  -> (image, diagnostics)

SQUEEZE-style MCMC image reconstruction.

The image is nelements flux elements on the pixel grid, sampled by Metropolis-Hastings with simulated annealing: non-negative, with fixed total flux, non-convex regularizers such as L0 available, and a mean image over samples as the result.

x_start selects the starting configuration; omit it for SQUEEZE's own default.

valuemeaning
:point_source (default)all elements on the centre pixel (SQUEEZE without -i)
:randomelements placed uniformly at random (independent starts for several chains)
an nx × nx imagethe image digitised into elements (SQUEEZE's -i)

Strings work too ("point_source", "random").

The image size and pixel size come from ft, as in reconstruct / reconstruct_bsmem. A DFT matrix (setup_ft(data, nx, pixsize; mode="dft") or setup_dft) is used directly; from an NFFT plan a DFT matrix is built, since each move needs one column of the transform.

Keyword arguments

  • nelements: number of flux elements (default default_nelements).
  • niter: sweeps; each sweep is nelements proposals.
  • nchains: independent annealing restarts, run on separate threads.
  • regularizers: OITOOLS-style [["l0", λ], ["tv", λ], ...]. Supported names are l0, tv, entropy, compactness, centering, priorimage, in SQUEEZE's forms on the integer histogram (not reconstruct's).
  • weights: observable weights, default [1.0,1.0,1.0] = V², T3amp, T3phi, as in reconstruct (padded to 7 internally).
  • prior_image: an nx × nx map of per-pixel prior probabilities (SQUEEZE's -p), adding -log(p) per element; pixels with p <= 0 cannot hold an element. Its weight is 1, or λ with ["priorimage", λ] in regularizers. A prior image turns auto-centering off.
  • pixsize: only needed to override the value recovered from ft, or to supply one when ft is a bare DFT matrix and outfile is set (the FITS WCS header).
  • tmin, chi2_temp, chi2_target: annealing schedule (C's -tm, -ct, -fc).
  • f_anywhere, f_copycat: fixed proposal fractions.
  • model: an optional SqueezeSparco chromatic star + background model.
  • print_every: SQUEEZE's text diagnostic line every n sweeps.
  • monitor: if > 0, draw the image and traces every monitor sweeps (chain 1, which then runs on the calling thread; needs PythonPlot). monitor_colormap sets the colour map.
  • seed: each chain's random numbers depend only on (seed, chain), whatever the number of threads.

COPYCAT proposals are asymmetric, so with f_copycat > 0 the samples are not from the posterior; f_copycat = 0 makes the moves reversible.

source
reconstruct_squeeze(data, ft; kwargs...)

Start from a point source at the centre of the grid (SQUEEZE without -i); the same as :point_source.

source
reconstruct_squeeze(x_start, data::AbstractArray{<:OIdata}, ft; kwargs...)

Accepts the Matrix{OIdata} from readoifits and the plans from setup_ft directly, for monochromatic, single-epoch data.

source
OITOOLS.reconstruct_squeeze_tempered — Function
reconstruct_squeeze_tempered(data, ft; kwargs...)

Parallel-tempered SQUEEZE reconstruction, built on Pigeons.jl.

Requires Pigeons to be loaded:

using OITOOLS, Pigeons
img, diag = reconstruct_squeeze_tempered(data, ft; n_rounds = 10, n_chains = 10)

Unlike reconstruct_squeeze, which anneals (an optimizer that floors at T = 1), this samples the posterior at β = 1 with a full temperature ladder, and returns a log normalising constant logZ alongside the mean image.

source
OITOOLS.SqueezeSparco — Type
SqueezeSparco(; f_star, ud, env_indx, lambda0, f_bg, bg_indx, free, stepsize)

SPARCO model state for reconstruct_squeeze.

Parameters, in C's order:

#namemeaning
1f_starstellar flux fraction at lambda0
2uduniform-disc diameter of the star, mas (0 = point source)
3env_indxflux power-law index of the environment (the image)
4lambda0reference wavelength, metres, must be > 0
5f_bgover-resolved background flux fraction at lambda0
6bg_indxflux power-law index of the background

free lists the parameters the sampler varies, by name or index; the others are fixed. stepsize is the step per parameter, adapted toward a 0.3 acceptance rate during the run. With a single wavelength the three indices are degenerate, so the model needs polychromatic data.

source

reconstruct_squeeze_tempered needs using Pigeons, which is not installed with OITOOLS.