featherpy.core

Core feathering utilities

Classes

FeatheredData

Feathered data.

FitsData

Data from a FITS file.

Visibilities

Data in the Fourier domain.

Functions

feather(→ FeatheredData)

Feather the data

feather_from_fits(→ None)

Feather two FITS files

fft_data(→ Visibilities)

Apply FFTs and deconvolution to the data

get_data_from_fits(→ FitsData)

Get data from a FITS file

jansky_per_beam_to_jansky_per_sr(→ astropy.units.Quantity)

Convert data from Jansky per beam to Jansky per steradian

jansky_per_sr_to_jansky_per_beam(→ astropy.units.Quantity)

Convert data from Jansky per steradian to Jansky per beam

kelvin_to_jansky_per_beam(→ astropy.units.Quantity)

Convert data from Kelvin to Jansky per beam

make_beam_fft(→ numpy.typing.ArrayLike)

Make the FFT of a beam in the same shape as the data

reproject_low_res(→ astropy.units.Quantity)

Reproject the low resolution data to the high resolution WCS

write_feathered_fits(→ None)

Write feathered data to a FITS file

Module Contents

class featherpy.core.FeatheredData

Bases: NamedTuple

Feathered data.

feathered_fft: numpy.typing.ArrayLike

The feathered data in the Fourier domain.

feathered_image: astropy.units.Quantity

The feathered image.

high_res_fft_weighted: numpy.typing.ArrayLike

The high resolution data in the Fourier domain, weighted for feathering.

high_res_weights: numpy.typing.ArrayLike

The weights for the high resolution data.

low_res_fft_weighted: numpy.typing.ArrayLike

The low resolution data in the Fourier domain, weighted for feathering.

low_res_weights: numpy.typing.ArrayLike

The weights for the low resolution data.

class featherpy.core.FitsData

Bases: NamedTuple

Data from a FITS file.

beam: radio_beam.Beam

The beam.

data: astropy.units.Quantity

The data.

wcs: astropy.wcs.WCS

The WCS.

class featherpy.core.Visibilities

Bases: NamedTuple

Data in the Fourier domain.

high_res_data_fft: numpy.typing.ArrayLike

The high resolution data.

low_res_data_fft_corr: numpy.typing.ArrayLike

The low resolution data, deconvolved with the low resolution beam and reconvolved with the high resolution beam.

uv_distance_2d: astropy.units.Quantity

The 2D array of uv distances.

featherpy.core.feather(low_res_data_fft_corr: numpy.typing.ArrayLike, high_res_data_fft: numpy.typing.ArrayLike, high_res_beam: radio_beam.Beam, uv_distance_2d: astropy.units.Quantity, feather_centre: astropy.units.Quantity, feather_sigma: astropy.units.Quantity, low_res_scale_factor: float | None = None) FeatheredData

Feather the data

Parameters:
  • low_res_data_fft_corr (ArrayLike) – A 2D array of the low resolution data in the Fourier domain

  • high_res_data_fft (ArrayLike) – A 2D array of the high resolution data in the Fourier domain

  • high_res_beam (Beam) – The high resolution beam

  • uv_distance_2d (u.Quantity) – A 2D array of the uv distances

  • feather_centre (u.Quantity) – The centre of the feathering function (in meters)

  • feather_sigma (u.Quantity) – The width of the feathering function (in meters)

  • low_res_scale_factor (float | None, optional) – Scaling factor for the low res data. Defaults to None.

Raises:
  • ShapeError – If the data shapes do not match

  • UnitError – If feather_centre is not in meters

  • UnitError – If feather_sigma is not in meters

  • UnitError – If uv_distance_2d is not in meters

Returns:

feathered_image, feathered_fft, low_res_fft_weighted, high_res_fft_weighted, low_res_weights, high_res_weights

Return type:

FeatheredData

featherpy.core.feather_from_fits(low_res_file: pathlib.Path, high_res_file: pathlib.Path, output_file: pathlib.Path, feather_centre: astropy.units.Quantity, feather_sigma: astropy.units.Quantity, frequency: astropy.units.Quantity, outer_uv_cut: astropy.units.Quantity | None = None, low_res_unit: astropy.units.Unit | None = None, high_res_unit: astropy.units.Unit | None = None, do_feather_plot: bool = False, overwrite: bool = False, low_res_scale_factor: float | None = None, deconvolve_beam: bool = True) None

Feather two FITS files

Parameters:
  • low_res_file (Path) – Path to the low resolution FITS file

  • high_res_file (Path) – Path to the high resolution FITS file

  • output_file (Path) – Path to the output feathered FITS file

  • feather_centre (u.Quantity) – Overall UV centre of the feathering function

  • feather_sigma (u.Quantity) – Width of the feathering function

  • frequency (u.Quantity) – Frequency of the data

  • outer_uv_cut (u.Quantity | None, optional) – UV cut to apply to low res data. Defaults to None.

  • low_res_unit (u.Unit | None, optional) – Units of low resolution data. Defaults to None.

  • high_res_unit (u.Unit | None, optional) – Units of high resolution data. Defaults to None.

  • do_feather_plot (bool, optional) – Make feather plots. Defaults to False.

  • overwrite (bool, optional) – Overwrite output data. Defaults to False.

  • low_res_scale_factor (float | None, optional) – Scaling factor for the low res data. Defaults to None.

Raises:
  • FileExistsError – If output file exists and overwrite is False

  • ValueError – If outer_uv_cut is negative

  • ValueError – If outer_uv_cut is less than feather_centre

  • UnitError – If low_res_data is not in (or convertible to) Jy/beam

  • UnitError – If high_res_data is not in (or convertible to) Jy/beam

featherpy.core.fft_data(low_res_data: astropy.units.Quantity, high_res_data: astropy.units.Quantity, low_res_beam: radio_beam.Beam, high_res_beam: radio_beam.Beam, wcs: astropy.wcs.WCS, wavelength: astropy.units.Quantity, outer_uv_cut: astropy.units.Quantity | None = None, deconvolve_beam: bool = True) Visibilities

Apply FFTs and deconvolution to the data

Parameters:
  • low_res_data (u.Quantity) – Low resolution data (must be in Jy/sr)

  • high_res_data (u.Quantity) – High resolution data (must be in Jy/sr)

  • low_res_beam (Beam) – Low resolution beam

  • high_res_beam (Beam) – High resolution beam

  • wcs (WCS) – WCS of the data

  • wavelength (u.Quantity) – Wavelength of the data

  • outer_uv_cut (u.Quantity | None, optional) – UV cut to apply to low res data. Defaults to None.

Raises:
  • UnitError – If low_res_data is not in Jy/sr

  • UnitError – If high_res_data is not in Jy/sr

  • ShapeError – If the data shapes do not match

Returns:

low_res_data_fft_corr, high_res_data_fft, uv_distance_2d

Return type:

Visibilities

featherpy.core.get_data_from_fits(file_path: pathlib.Path, unit: astropy.units.Unit | None = None, ext: int = 0) FitsData

Get data from a FITS file

Parameters:
  • file_path (Path) – Path to the FITS file

  • unit (u.Unit | None, optional) – Units of the data. Defaults to None.

  • ext (int, optional) – FITS extension to use. Defaults to 0.

Raises:
  • ShapeError – If the data is not 2D

  • UnitError – If no unit is provided and no BUNIT keyword is found in the header

Returns:

data, beam, wcs

Return type:

FitsData

featherpy.core.jansky_per_beam_to_jansky_per_sr(data_jy: astropy.units.Quantity, beam: radio_beam.Beam) astropy.units.Quantity

Convert data from Jansky per beam to Jansky per steradian

Parameters:
  • data_jy (u.Quantity) – Data in Jansky per beam

  • beam (Beam) – Beam

Returns:

Data in Jansky per steradian

Return type:

u.Quantity

featherpy.core.jansky_per_sr_to_jansky_per_beam(data_jy_sr: astropy.units.Quantity, beam: radio_beam.Beam) astropy.units.Quantity

Convert data from Jansky per steradian to Jansky per beam

Parameters:
  • data_jy_sr (u.Quantity) – Data in Jansky per steradian

  • beam (Beam) – Beam

Returns:

Data in Jansky per beam

Return type:

u.Quantity

featherpy.core.kelvin_to_jansky_per_beam(data_kelvin: astropy.units.Quantity, beam: radio_beam.Beam, frequency: astropy.units.Quantity) astropy.units.Quantity

Convert data from Kelvin to Jansky per beam

Parameters:
  • data_kelvin (u.Quantity) – Data in Kelvin

  • beam (Beam) – Beam

  • frequency (u.Quantity) – Frequency of the data

Returns:

Data in Jansky per beam

Return type:

u.Quantity

featherpy.core.make_beam_fft(beam: radio_beam.Beam, data_shape: tuple[int, int], pix_scale: astropy.units.Quantity) numpy.typing.ArrayLike

Make the FFT of a beam in the same shape as the data

Parameters:
  • beam (Beam) – The beam

  • data_shape (tuple[int, int]) – Shape of the data

  • pix_scale (u.Quantity) – Pixel scale (assumed to be the same in x and y)

Returns:

Beam FFT array

Return type:

ArrayLike

featherpy.core.reproject_low_res(low_res_data: astropy.units.Quantity, low_res_wcs: astropy.wcs.WCS, high_res_wcs: astropy.wcs.WCS) astropy.units.Quantity

Reproject the low resolution data to the high resolution WCS

Parameters:
  • low_res_data (u.Quantity) – Low resolution data

  • low_res_wcs (WCS) – Low resolution WCS

  • high_res_wcs (WCS) – High resolution WCS

Returns:

Reprojected low resolution data

Return type:

u.Quantity

featherpy.core.write_feathered_fits(output_file: pathlib.Path, feathered_data: astropy.units.Quantity, wcs: astropy.wcs.WCS, beam: radio_beam.Beam, overwrite: bool = False) None

Write feathered data to a FITS file

Parameters:
  • output_file (Path) – Path to the output FITS file

  • feathered_data (u.Quantity) – Feathered data (must be in Jy/sr)

  • wcs (WCS) – WCS of the data

  • beam (Beam) – Beam of the data

  • overwrite (bool, optional) – Whether to overwrite. Defaults to False.