Skip to main content

convolve_uv

PyPI Python build tests codecov License

pip install convolve-uv
import astropy.units as u
from convolve_uv import convolve_uv
from radio_beam import Beam
from spectral_cube import SpectralCube

cube = SpectralCube.read("my_cube.fits")
target_beam = Beam(major=0.86 * u.arcsec, minor=0.86 * u.arcsec, pa=0 * u.deg)

cube_conv = convolve_uv(image=cube, 
                        target_beam=target_beam,
                        )

convolve-uv is a small Python package that allows for image convolution without loss of resolution.

When using something like convolve_fft in astropy, you generate a kernel in the image domain, Fourier transform (FT) it and the input image, and then perform the multiplication in the Fourier domain to carry out the convolution. Whilst this works well for arbitrary kernels, when the kernel is small enough that the pixel scale does not properly sample it, artefacts can be introduced or the convolution can fail. The way around this is to pad out the kernel slightly so it is properly sampled, but this results in a loss of resolution.

convolve-uv takes a different approach, one that is useful for radio data when the beam of your data and the convolution kernel are both Gaussian (which is almost always the case). This instead builds a transfer function directly in $uv$-space, and multiplies the FT of the image by this transfer function. This means we can generate kernels that are not limited by the pixel scale of the image, and e.g. convolve an elliptical to a round beam without any unnecessary loss of resolution.

To illustrate this, the Figure below shows a demonstration of convolve-uv compared to the astropy convolve_fft. The original beam here is elliptical ($0.86^{\prime\prime} \times 0.65^{\prime\prime}$), and so the round beam is $0.86^{\prime\prime} \times 0.86^{\prime\prime}$. We see that convolve-uv successfully convolves the image to the round beam, while convolve_fft fails to do so due to the undersampling of the kernel. For larger kernels (convolving to a $1^{\prime\prime}$ and $1.5^{\prime\prime}$ beam), the two approaches give the same result.

convolve_uv_demo

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

convolve_uv-0.2.0.tar.gz (118.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

convolve_uv-0.2.0-py3-none-any.whl (34.9 kB view details)

Uploaded Python 3

File details

Details for the file convolve_uv-0.2.0.tar.gz.

File metadata

  • Download URL: convolve_uv-0.2.0.tar.gz
  • Upload date:
  • Size: 118.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for convolve_uv-0.2.0.tar.gz
Algorithm Hash digest
SHA256 eaafb741d68652349148938b88c12eb454b71a3f530ad029a02ef82116750013
MD5 7189796ccd3700c8e3910c118a60732d
BLAKE2b-256 f44aa0695ba3539c718a61cde74295fc0361b60bfa8f60919f749954a802e531

See more details on using hashes here.

File details

Details for the file convolve_uv-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: convolve_uv-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 34.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for convolve_uv-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 bc6621269674d2ee4aa5169bfe6f01ba97cdce2099d6d79283ebebaa66422e62
MD5 1bec49c519c3aadf3e93de6d969893d6
BLAKE2b-256 0793ae118b9c5086b560b22fb52f6a23c20a9d3891a9eddc8848c8ec3b044fd7

See more details on using hashes here.

Release history Release notifications | RSS feed

0.3.0

2 files

This release

0.2.0 This release

2 files

0.1.1

2 files

0.1.0

2 files

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