Skip to main content

Patchwork

Actions Status Documentation Status PyPI version PyPI platforms Coverage

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.

A pirate ship sailing at night under patchwork sails

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.2.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 askap-patchwork 0.2.0
File Size Uploaded Provenance Actions
askap_patchwork-0.2.0.tar.gz 402.7 kB With provenance Details for askap_patchwork-0.2.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for askap-patchwork 0.2.0
File Interpreter ABI Platform Actions
askap_patchwork-0.2.0-py3-none-any.whl Python 3 none any Details for askap_patchwork-0.2.0-py3-none-any.whl

Total release size: 517.6 kB

Release files / askap_patchwork-0.2.0.tar.gz

Download URL askap_patchwork-0.2.0.tar.gz
Size 402.7 kB
Tags Source
SHA-256 checksum
How to use checksums
7b9ef78081e385683eae1e4c8f25e2136b78abbbc9c4b6fb5059602bde805d70
BLAKE2b-256 checksum
How to use checksums
af9f1b121eb1a2540ef86e154845ca07e50c8ba6a1e4da14435915cc716b3385
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 28, 2026.

Transparency log

Release files / askap_patchwork-0.2.0-py3-none-any.whl

Download URL askap_patchwork-0.2.0-py3-none-any.whl
Size 114.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1589d0c903d58dd09e2a3100f16b039c4415031de1988c94975ab33487303a1f
BLAKE2b-256 checksum
How to use checksums
466e8c6acbe4fec641cf8fb423995786b563603c4d0616d202fe964cbbf7956f
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 28, 2026.

Transparency log

Security for askap-patchwork 0.2.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 askap_patchwork-0.2.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 28, 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