Skip to main content

Spotless - Radio Interferometry Imaging Algorithm

This is a point-source deconvolution algorithm (part of the CLEAN family) that works without gridding. [http://www.iram.fr/IRAMFR/GILDAS/doc/html/map-html/node37.html]

This is essentially a grid-free version of the Cotton-Schwab algorithm with a different convergence an optimization steps. [Relaxing the isoplanatism assumption in self-calibration; applications to low-frequency radio interferometry]

It does not require W-projection and handles non-coplanar antennas without difficulty. It also works on all-sky images just fine.

How does Spotless work

The CLEAN algorithm is essentially deconvolution by repeated subtraction. I think this is silly, hence spotless. Spotless works by building up a model of the field of view in terms of point sources using model-fitting in visibility space.

Spotless deconvolutes the measured visibilities $V(u,v,w)$ into a sum of $N$ point-source visibilities $V_P(\theta, \phi)$ where $\theta$ and $\phi$ are the co-ordinates of the point source: i.e.,

$$ V(u,v,w) = \sum_{i=0}^{N} A_i V_P(\theta_i, \phi_i) + V_r(u,v,w) $$

where the $A_i$ are the brightness of each point source, and $V_r$ are the residual visibilities.

Spotless has two algorithms for doing this. The first, like CLEAN, is sequential location of point sources:

\begin{eqnarray*}
V(u,v,w) & = & A_0 V_P(\theta_0, \phi_0) + V_1(u,v,w) \\
V_1(u,v,w) & = & A_1 V_P(\theta_1, \phi_1) + V_2(u,v,w) \\
 ... \\
V_N(u,v,w) & = & A_N V_P(\theta_N, \phi_N) + V_{N+1}(u,v,w)
\end{eqnarray*}

At each step the new point source is located using a minimizer from the residuals at that step:

\begin{eqnarray*}
  P_i & = & \min_{A, \theta, \phi} E(V_0) \\
      & = & \min_{A, \theta, \phi} E(V - A V_P(\theta, \phi))
\end{eqnarray*}

where $E(V)$ is the total energy in the visibilities. So we find the point source that minimizes the remaining energy.

The nice thing is that the energy can be calculated directly from the visibilities, and so no gridding is required at all, either in image space or in visibility space.

This is possible because the integral of the fourier transform (F.T.) of the visibilities can be calculated directly from the visibilities without the F.T. This is Parseval's Theorem, for the DFT it becomes

\sum_{n=0}^{N-1} \left| x_n \right|^2 = \frac{1}{N} \sum_{k=0}^{N-1} \left| X_k \right|^2

Thus as the visibilities are the F.T of the sky brightness, the sum of the absolute value of the visibilities is proportional to the energy in the 'image'

E(V)  \propto  \sum_{k=0}^{N-1} v_i v_i^\star

MultiSpotless

Multispotless (--multimodel command line option) uses a better (but slower) sequential location. It builds up a multiple-point-source model as the algorithm progresses.

Termination Criterion

Both spotless variants terminate when the power in the residual stops decreasing, when --max-steps is reached, or when a step removes less than 1% of the residual power at the start of the run (--threshold). The source fitted in that last step stays in the model.

There is always another source to fit, since each one starts at the brightest point left in the residual image, so on real data it is the threshold that usually ends a run. Raise the threshold for a quicker run with fewer sources, or lower it for a lower residual. --multimodel keeps removing over 1% a step for longer, and on large data sets goes on to --max-steps.

Results

Dirty Image Spotless Image

For more information see the TART Github repository

Install Instructions

tart_tools is available from standard python package repositories. Try:

pip install spotless

Running it on live data

spotless --api https://tart.elec.ac.nz/signal --display
gridless --api https://tart.elec.ac.nz/signal --display

Command Line Usage

Data Sources

Spotless can read visibilities from three sources:

Source Flag Example
TART API --api spotless --api https://tart.elec.ac.nz/signal
CASA Measurement Set --ms spotless --ms test_data/test.ms
JSON snapshot file --file spotless --file observation.json

Imaging Options

  --fov FOV             Field of view (e.g., 160deg)
  --res RES             Resolution (e.g., 120arcmin)
  --healpix             Use HEALPix pixelisation
  --nvis NVIS           Number of visibilities to use (default: 1000)
  --channel CHANNEL     Frequency channel (default: 0)

Output Formats

  --display             Show image interactively
  --PNG                 Save as PNG
  --PDF                 Save as PDF
  --fits                Save as FITS (not implemented yet: exits with an
                        error until tmolteno/disko#10 lands, see issue #1)
  --HDF FILENAME        Save field of view as HDF5
  --save-model-json FILE  Save point-source model as JSON
  --dir DIR             Output directory (default: .)
  --title TITLE         Prefix for output filenames

Algorithms

Flag Description
(default) Sequential Spotless — finds one source at a time
--multimodel MultiSpotless — jointly optimises all sources

Other Flags

  --show-model          Show the model source locations
  --beam [BEAM]         Antenna beam pattern for the model: 'tart' for the built-in
                        TART beam, or a JSON file (see Beam patterns)
  --psf                 Image the synthesised beam: the response to a source at
                        the zenith
  --max-steps N         Maximum deconvolution steps (default: 50)
  --threshold PERCENT   Stop when a step removes less than this percentage of the
                        residual power at the start of the run (default: 1)
  --log FILE            Save deconvolution statistics to FILE
  --version             Print version and exit
  --debug               Enable debug logging

Rendering with disko_draw

spotless no longer writes SVG or overlays a source catalog. Save the field of view with --HDF and do both with disko_draw:

spotless --ms test_data/test.ms --healpix --fov 160deg --res 120arcmin --HDF fov.h5
disko_draw fov.h5 --show-sources --SVG fov.svg

--SVG and --show-sources now exit with a pointer to this.

Beam patterns

By default every antenna is taken to respond equally over the whole sky. --beam gives the model an antenna beam pattern instead, so that sources are fitted with the flux they have before the beam:

spotless --ms test_data/test.ms --healpix --fov 160deg --res 120arcmin --beam tart

--beam takes the same values as tartball, which reads them from tart-beam:

Value Meaning
tart The built-in TART beam: roughly uniform above 10° elevation, falling to zero at the horizon
A JSON file A beam saved by tart_beam.Beam.to_json(), or a list of {el, az, gain} samples in degrees, which is fitted when loaded

A bare --beam means tart.

  • Both spotless and --multimodel fit through the beam.
  • The model JSON records the beam under "beam". The images stay as the instrument sees them, so that the model and the residual still add up to the dirty image.
  • The gain is not taken below 1% above the horizon. The beam falls to zero there, and a flux corrected for it would be dominated by noise.
  • With --PNG or --PDF, the beam image shows the pattern over the field of view. The synthesised beam, which --beam used to stand for, is --psf.

Examples

# Image a measurement set with MultiSpotless, save as PNG
spotless --ms test_data/test.ms --healpix --fov 160deg --res 120arcmin \
    --multimodel --PNG --title my_source

# Live all-sky imaging from the TART telescope
spotless --api https://tart.elec.ac.nz/signal --display \
    --healpix --fov 180deg --res 60arcmin

# Calibrate using the spotless model
spotless_calibrate --api https://tart.elec.ac.nz/signal

Performance

Compute

Spotless benefits from multi-threaded BLAS libraries for numpy operations. Set the following environment variables to use multiple cores:

# Linux / macOS
export OPENBLAS_NUM_THREADS=4
export OMP_NUM_THREADS=4

# Or set for a single run
OPENBLAS_NUM_THREADS=4 spotless --ms data.ms --healpix

For large measurement sets, use --nvis to limit the number of visibilities used in the peak search (the optimizer uses all visibilities for accuracy).

Memory

Since disko 1.4.4, the harmonic cache uses a blocked, matrix-free operator with a hard 500 MB cap. Memory no longer scales as O(n_vis x n_pix); instead it is bounded by the block cache plus per-sphere pixel arrays.

Sphere copies share immutable geometry arrays (l, m, n, el_r, az_r, pixel_areas) by reference, so each copy costs only n_pix x 8 bytes (the pixels array) instead of ~9 x n_pix x 8 bytes.

nside n_pix per sphere copy harmonic cache
64 49,152 0.4 MB <= 500 MB
128 196,608 1.6 MB <= 500 MB
256 786,432 6.3 MB <= 500 MB
512 3,145,728 25.2 MB <= 500 MB

Guidelines:

  • Use the coarsest resolution acceptable for your science (--res).
  • Limit visibilities with --nvis for initial exploration.
  • Use --fov to restrict the field of view for targeted high-resolution imaging.

Documentation

A LaTeX article describing the algorithm in detail is available in doc/spotless.tex. Build with:

cd doc && make

Generate example images and convert to PNG:

cd doc && make images && make pngs

TODO

  • Add Gaussian Source Model
  • Prove the relationship between power in the image and visibilty amplitudes. This might only work when the image tends towards a random one. But this is OK since as we remove the sources the residual becomes more and more random.
  • Run an MCMC on the multimodel option to estimate uncertainty in the model. Then use this uncertainty as a stopping criterion (when new model components no longer have certain amplitude or position)

Author

Development work

If you are developing this package, install uv and then:

	make sync

This installs all dependencies (including dev tools like flake8) in a virtual environment. To run tests: make test To lint: make lint

Changes

See CHANGES.md.

Metadata

Release files for spotless 0.10.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for spotless 0.10.0
File Size Uploaded Provenance Actions
spotless-0.10.0.tar.gz 15.0 MB With provenance Details for spotless-0.10.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for spotless 0.10.0
File Interpreter ABI Platform Actions
spotless-0.10.0-py3-none-any.whl Python 3 none any Details for spotless-0.10.0-py3-none-any.whl

Total release size: 15.1 MB

Release files / spotless-0.10.0.tar.gz

Download URL spotless-0.10.0.tar.gz
Size 15.0 MB
Tags Source
SHA-256 checksum
How to use checksums
157857af0188b2a9bc05a5e2ae8967b62586637b12588b2b7b9ee1e63bd18933
BLAKE2b-256 checksum
How to use checksums
c540fdabdd95b8b777e90ddc5cf7a203d664bb2ec1c0f0ffa5d5b364e8f0f0bd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Release files / spotless-0.10.0-py3-none-any.whl

Download URL spotless-0.10.0-py3-none-any.whl
Size 55.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
15617e01d00032a1c38df0211b410762d7124df8768f1f8c103ca08c5bb16207
BLAKE2b-256 checksum
How to use checksums
bf50cf474e2abb292ec6516d8e2d0aa05f22510fb0133b8d127d8e44b836866c
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

Security for spotless 0.10.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for spotless-0.10.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 25, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page