Patchwork
The pirate quilt!
patchwork is a Python library and set of command-line tools for linear mosaicking of radio images. Each image is resampled onto a common pixel grid, weighted by its primary beam and its noise, and added to the mosaic. The images can first be convolved to a common restoring beam.
The library uses numpy and astropy, and a separate pipeline runs the same steps on a dask cluster.
Documentation
The documentation is on Read the Docs.
Usage
# Convolve a set of beam images to their common restoring beam and mosaic
# them, weighting by a Gaussian primary beam and their noise
patchwork mosaic beam*.fits --convolve natural --output-base field
# Or only convolve them, writing beam*.conv.fits
patchwork convolve beam*.fits
# Or rotate Q and U cubes referenced to north at the boresight to north at each
# pixel, writing beam*.rot.fits with their frame recorded in the header
patchwork rotate beam*.{q,u}.fits --frame-centre 12.5 -81.0
# Mosaic Stokes I, Q and U together, rotating Q and U into the frame of the
# mosaic and removing the leakage of Stokes I with an ASKAP holography cube
patchwork mosaic beam*.{i,q,u}.fits --remove-leakage \
--pb-model holography --holography-cube akpb.iquv.cube.fits \
--frame-centre 12.5 -81.0 --output-base field
# Cubes are mosaicked in the same way, here each with its weights log, and
# every channel convolved to a common beam first, in eight processes
patchwork mosaic beam*.{i,q,u}.cube.fits --weights beam*.{i,q,u}.weights.txt \
--frame-centre 12.5 -81.0 --convolve natural --output-base field \
--max-workers 8 --processes
# patchwork-pipeline takes the same arguments, and spreads the work over a
# dask cluster: a local one, or one described in a YAML file
patchwork-pipeline beam*.{i,q,u}.cube.fits --weights beam*.{i,q,u}.weights.txt \
--frame-centre 12.5 -81.0 --convolve natural --output-base field \
--cluster-config slurm.yaml
patchwork runs on one machine, with --max-workers threads, or processes with
--processes, and does not use dask. patchwork-pipeline does the same work,
convolution included, on a dask cluster.
Images and cubes are given as one list: each one's Stokes parameter is read from
its header, and those on one pixel grid are taken to be one beam. The mosaics
are labelled by Stokes parameter, such as field.i.mosaic.fits and
field.qu.weight.fits, or field.i.cube.fits for cubes.
Two dependencies are optional: numba, which speeds up the resampling, and zarr, which is needed for zarr output.
pip install "askap-patchwork[numba,zarr]"
Installation
Releases are on PyPI:
# PyPI release
pip install askap-patchwork
To install the latest commit from GitHub:
# Direct git install (latest push)
pip install git+https://github.com/flint-crew/patchwork.git
Or from a local clone:
git clone https://github.com/flint-crew/patchwork.git
cd patchwork
pip install -e .
With uv, uv sync installs the versions pinned in
uv.lock:
git clone https://github.com/flint-crew/patchwork.git
cd patchwork
uv venv
uv sync
Contributions
Report problems and propose changes through GitHub issues and pull requests.
To install the development tools:
git clone https://github.com/flint-crew/patchwork.git
cd patchwork
pip install -e . --group dev # --group needs pip 25.1 or newer
Or, using uv:
git clone https://github.com/flint-crew/patchwork.git
cd patchwork
uv sync --group dev
Metadata
Release files for askap-patchwork 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| askap_patchwork-0.1.2.tar.gz | 394.1 kB | With provenance | Details for askap_patchwork-0.1.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| askap_patchwork-0.1.2-py3-none-any.whl | Python 3 | none | any | Details for askap_patchwork-0.1.2-py3-none-any.whl |
Total release size: 505.6 kB
Release files / askap_patchwork-0.1.2.tar.gz
| Download URL | askap_patchwork-0.1.2.tar.gz |
|---|---|
| Size | 394.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
78ea4f60a1785d8270d9dbc7315fc551c76160f4547913637398766efa44b39f
|
|
BLAKE2b-256 checksum How to use checksums |
10a8a4c607864ba558d25517093bdb9526190971b02dcebdda08219d1ae66d08
|
| 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 23, 2026.
Transparency logRelease files / askap_patchwork-0.1.2-py3-none-any.whl
| Download URL | askap_patchwork-0.1.2-py3-none-any.whl |
|---|---|
| Size | 111.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c672da58a234b80f2e1e9ccbc9742ef42c436e04237c8bdcaa9a71a98556338d
|
|
BLAKE2b-256 checksum How to use checksums |
6501280ca063fa6a443672d1379cdeb055300406286576f70b519f04d05ac7d3
|
| 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 23, 2026.
Transparency logSecurity for askap-patchwork 0.1.2
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.
Attestation for askap_patchwork-0.1.2.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 23, 2026.
Transparency logA 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.