arrakis.utils.fitsutils

FITS utilities

Functions

fix_header(→ astropy.io.fits.Header)

Make cutout header the same as original header

getdata([cubedir, tabledir, mapdata, verbose])

Get the spectral and source-finding data.

getfreq(→ Union[astropy.units.Quantity, ...)

Get list of frequencies from FITS data.

head2dict(→ Dict[str, Any])

Convert FITS header to a dict.

Module Contents

arrakis.utils.fitsutils.fix_header(cutout_header: astropy.io.fits.Header, original_header: astropy.io.fits.Header) astropy.io.fits.Header[source]

Make cutout header the same as original header

Parameters:
  • cutout_header (fits.Header) – Cutout header

  • original_header (fits.Header) – Original header

Returns:

Fixed header

Return type:

fits.Header

arrakis.utils.fitsutils.getdata(cubedir='./', tabledir='./', mapdata=None, verbose=True)[source]

Get the spectral and source-finding data.

Parameters:
  • cubedir – Directory containing data cubes in FITS format.

  • tabledir – Directory containing Selavy results.

  • mapdata – 2D FITS image which corresponds to Selavy table.

Kwargs:

verbose (bool): Whether to print messages.

Returns:

Dictionary of necessary astropy tables and

Spectral cubes.

Return type:

datadict (dict)

arrakis.utils.fitsutils.getfreq(cube: str | pathlib.Path, outdir: pathlib.Path | None = None, filename: str | pathlib.Path | None = None) astropy.units.Quantity | Tuple[astropy.units.Quantity, pathlib.Path][source]

Get list of frequencies from FITS data.

Gets the frequency list from a given cube. Can optionally save frequency list to disk.

Parameters:

cube (str) – File to get spectral axis from.

Kwargs:
outdir (str): Where to save the output file. If not given, data

will not be saved to disk.

filename (str): Name of frequency list file. Requires ‘outdir’

to also be specified.

verbose (bool): Whether to print messages.

Returns:

Frequencies of each channel in the input cube.

Return type:

freq (list)

arrakis.utils.fitsutils.head2dict(h: astropy.io.fits.Header) Dict[str, Any][source]

Convert FITS header to a dict.

Writes a cutout, as stored in source_dict, to disk. The file location should already be specified in source_dict. This format is intended for parallel use with pool.map syntax.

Parameters:

h – An astropy FITS header.

Returns:

The FITS head converted to a dict.

Return type:

data (dict)