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.
| Function | Description |
|---|---|
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.
| Name | Form on the integer histogram | Typical λ |
|---|---|---|
"l0" | count of nonzero pixels | 1 – 20 |
"tv" | Σ √(dx²+dy²) / nelements, backward differences | 200 – 2000 |
"entropy" | Σ_{x>0} lgamma(x) (quantised / Poisson prior) | 1 – 10 |
"compactness" | Σ r²·x² | 20 – 500 |
"centering" | centroid / second-moment penalty | 1 (auto) |
"priorimage" | Σ -log(prior[pixel]) over elements; see prior_image | 1 (auto) |
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.
| value | meaning |
|---|---|
:point_source (default) | all elements on the centre pixel (SQUEEZE without -i) |
:random | elements placed uniformly at random (independent starts for several chains) |
an nx × nx image | the 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 (defaultdefault_nelements).niter: sweeps; each sweep isnelementsproposals.nchains: independent annealing restarts, run on separate threads.regularizers: OITOOLS-style[["l0", λ], ["tv", λ], ...]. Supported names arel0,tv,entropy,compactness,centering,priorimage, in SQUEEZE's forms on the integer histogram (notreconstruct's).weights: observable weights, default[1.0,1.0,1.0]= V², T3amp, T3phi, as inreconstruct(padded to 7 internally).prior_image: annx × nxmap of per-pixel prior probabilities (SQUEEZE's-p), adding-log(p)per element; pixels withp <= 0cannot hold an element. Its weight is 1, or λ with["priorimage", λ]inregularizers. A prior image turns auto-centering off.pixsize: only needed to override the value recovered fromft, or to supply one whenftis a bare DFT matrix andoutfileis 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 optionalSqueezeSparcochromatic star + background model.print_every: SQUEEZE's text diagnostic line every n sweeps.monitor: if > 0, draw the image and traces everymonitorsweeps (chain 1, which then runs on the calling thread; needs PythonPlot).monitor_colormapsets 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.
reconstruct_squeeze(data, ft; kwargs...)Start from a point source at the centre of the grid (SQUEEZE without -i); the same as :point_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.
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.
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:
| # | name | meaning |
|---|---|---|
| 1 | f_star | stellar flux fraction at lambda0 |
| 2 | ud | uniform-disc diameter of the star, mas (0 = point source) |
| 3 | env_indx | flux power-law index of the environment (the image) |
| 4 | lambda0 | reference wavelength, metres, must be > 0 |
| 5 | f_bg | over-resolved background flux fraction at lambda0 |
| 6 | bg_indx | flux 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.
OITOOLS.default_nelements — Function
default_nelements(data, nx)C's heuristic (squeeze.c:298): 2·ceil(nx · ndata^(1/3)), floored at 500.
reconstruct_squeeze_tempered needs using Pigeons, which is not installed with OITOOLS.