Skip to content

virgil 0.4.1

Latest

Choose a tag to compare

@benjaminpope benjaminpope released this 23 Oct 10:45
· 1130 commits to main since this release
ee5757d

virgil 0.4.1

pip install --upgrade virgil-astro==0.4.1

0.4.1 is a consolidation release with no new model families. The code is shorter to read and safer by default on
aperture-masking and DISCO data, and virgil can now write the OIFITS files it reads. The full radio work
is planned for 0.4.2.

What's new

  • Write OIFITS from an OIData. write_oifits(data, path) round-trips through read_oifits, including
    closure-only (AMI) data. The pipelines now write data/processed.oifits for closure-only data and for data with
    flagged visibilities.
  • No more alias-copy detections by default. On lattice uv coverage (aperture masks, DISCO),
    BinaryPipeline and OrbitPipeline cap the default search box at half an alias cell. An explicit
    max_sep_mas is never capped.
  • OrbitPipeline checks its own verdict. It drops the night with the worst χ²/N, refits, and records
    whether the verdict and the winning alias band survive in modes.robustness.
  • Better-conditioned fits.
    • fit(precondition="diag") (provisional).
    • The L-BFGS history defaults to 100 vectors, up from 50.
    • Maximum-entropy imaging takes 30–40% fewer steps.
  • Radio CLEAN (virgil.radio_clean, provisional). This is a Cotton–Schwab CLEAN of ComplexVisData, with
    Högbom and multi-scale minor cycles, masks and a fitted restoring beam.
    See the guide.
  • A public References page lists every source that
    virgil cites or ports.

Upgrading from 0.4.0

Most code runs unchanged. Check these points:

If your code… In 0.4.1… Do this
fits with CalibrationNuisance and relies on its default priors gains and error scales have Jeffreys priors (fit coordinate ln x). Offsets are uniform over offset_beams beams (default 3): a narrower box, now enforced. Check info["at_bound"]. To restore the old boxes, pass priors(gain=, sigma=, offset=).
calls fit with L-BFGS and no lbfgs_memory the history is 100 vectors (was 50), cut to stay under 1 GiB, with a warning. LM ignores it. Pass lbfgs_memory= to choose a value.
runs BinaryPipeline or OrbitPipeline on lattice coverage without max_sep_mas the default box is capped at half an alias cell, recorded in summary["search"]["alias_cap_mas"]. Pass max_sep_mas to search wider.
calls write_oifits(tables=...) the argument is named data. Rename it. tables= warns until 0.5.
calls OrbitPipeline(epochs, path) with the output path positional output is keyword-only. Write OrbitPipeline(epochs, output=path). The positional form warns until 0.5.
calls ComplexVisData.dirty_beam(nuisance, values) values now comes before nuisance, as in dirty_image (a provisional API, no shim). Swap the arguments.
reads virgil.name it is removed. Use virgil.__version__.
relies on import virgil loading matplotlib it no longer does. virgil.plotting and virgil.oifits load on first use. Import matplotlib yourself.
sets t_ref = 0 on an orbit class it still warns, and the warning now says it becomes an error in 0.5. Set a real reference epoch.

Results and summary.json are otherwise unchanged.

Added

  • write_oifits(OIData). Errors, flags, wavelengths, (u, v) and times survive a round trip.
    • Closure phases without station indices get placeholder stations.
    • Channel widths are written as EFF_BAND; unknown widths are estimated and marked BANDEST.
    • Data whose channel widths differ between baselines of one channel are skipped, with the reason in
      processed_oifits_skipped. 0.4.0 wrote them with EFF_BAND = 0.
  • OrbitPipeline drop-a-night check (night_dropped). It is skipped below 3 nights or with
    drop_outlier_night=False.
  • fit(precondition="diag") and gauss_newton_diag (both provisional).
    • MaxEntropy's entropy metric and MaxEntropy.residuals let LM fit an image, in float64 only.
    • Preconditioning does not make weak-weight fits converge in float32.
  • virgil.radio_clean (provisional): clean, RadioCleanResult, fit_beam and restore.
  • CalibrationNuisance(sigmas="profile") and ComplexVisData.sigma_hat.
  • lattice_alias_limit works per channel.

Fixed

  • fit_orbit_aliases no longer runs out of memory on data with gains and many nights. It accumulates the
    Hessian in groups of nights that fit memory_budget, and results agree to rounding.
  • ImproperUniform priors with an event_shape no longer raise in gauss_newton_mass.

Known issues

  • Closure phases near a visibility null (#309). A closure
    phase jumps by π where a model visibility passes through zero, so its gradient is unbounded there. An image fit
    that drifts to such a null can stall. V² and the regularizers are unaffected. This was accepted for 0.4.0 and is
    carried into 0.4.1; a fix is planned.
  • Radio is provisional. virgil.radio_clean and the radio visibility classes are not yet independently
    checked against CASA. That work is the focus of 0.4.2.

Smaller and easier to read

Measured on src/virgil:

0.4.0 0.4.1
Docstrings over 60 lines 19 0 (CI gate)
Docstrings over 40 lines 63 30
Docstring lines in total 15,503 14,040 (−9%)
Private helpers called from one place 456 418 (−8%)
Source lines in total 56,804 56,790
  • Docstrings.
    • Every public docstring is 60 lines or fewer, enforced in CI, and is cut to its calling contract.
    • Derivations moved to the docs (orbit_methods, the guides).
    • Every caveat a caller needs survives, either as one docstring line or as a # deliberate: comment at the
      line it explains.
    • Sources are cited in one Source: line linking to the References page.
  • Private helpers. About 40 single-use helpers were inlined and duplicate helpers merged, with no change in
    results.
  • Size. The source stayed the same length, although about 1,400 lines of features were added.
  • Next. 0.4.2 goes further on single-use helpers.

Other

  • to_kepler runs as one jitted kernel, 2–6× faster for an eager call.
  • CI is faster: the orbit tests are sharded and timings come from CI runs.

Full details are in CHANGELOG.md.