cutout_fits.cutout¶
Attributes¶
Classes¶
Start and end indices for spatial axes. |
|
Start and end indices for spectral axes. |
|
Start and end indices for Stokes axes. |
Functions¶
|
Cut out a beam table |
|
Produce a string representation of the shape of an cube |
|
|
|
Get the shape of a cutout |
|
|
|
Get the start and end indices for spatial axes |
|
Get the start and end indices for spectral axes |
|
Get the start and end indices for Stokes axes |
|
|
|
Make a cutout of a FITS file |
|
Create a slicer for a given WCS, centre, radius, and frequency range |
|
Update the header to reflect the cutout |
Module Contents¶
- class cutout_fits.cutout.SpatialIndex¶
Bases:
NamedTupleStart and end indices for spatial axes.
- start_ra_index¶
int | None
- end_ra_index¶
int | None
- start_dec_index¶
int | None
- end_dec_index¶
int | None
- class cutout_fits.cutout.SpectralIndex¶
Bases:
NamedTupleStart and end indices for spectral axes.
- start_freq_index¶
int | None
- end_freq_index¶
int | None
- class cutout_fits.cutout.StokesIndex¶
Bases:
NamedTupleStart and end indices for Stokes axes.
- start_stokes_index¶
int | None
- end_stokes_index¶
int | None
- cutout_fits.cutout.cutout_beamtable(hdu: astropy.io.fits.BinTableHDU, image_wcs: astropy.wcs.WCS, freq_start_hz: float | None = None, freq_end_hz: float | None = None) astropy.io.fits.BinTableHDU¶
Cut out a beam table
- Parameters:
- Returns:
Cutout beam table
- Return type:
fits.BinTableHDU
- cutout_fits.cutout.format_shape(wcs: astropy.wcs.WCS, shape: tuple[int, Ellipsis]) str¶
Produce a string representation of the shape of an cube
- cutout_fits.cutout.get_cutout_parser(parent_parser: bool = False) argparse.ArgumentParser¶
- cutout_fits.cutout.get_cutout_shape(wcs: astropy.wcs.WCS, slicer: tuple[slice, Ellipsis]) tuple[int, Ellipsis]¶
Get the shape of a cutout
- cutout_fits.cutout.get_file_parser(parent_parser: bool = False) argparse.ArgumentParser¶
- cutout_fits.cutout.get_spatial_indices(wcs: astropy.wcs.WCS, centre: astropy.coordinates.SkyCoord, radius: astropy.units.Quantity) SpatialIndex¶
Get the start and end indices for spatial axes
- Parameters:
wcs (WCS) – WCS for HDU
centre (SkyCoord) – Centre of cutout
radius (u.Quantity) – Radius of cutout
- Returns:
start_ra_index, end_ra_index, start_dec_index, end_dec_index
- Return type:
- cutout_fits.cutout.get_spectral_indices(wcs: astropy.wcs.WCS, start_freq: astropy.units.Quantity | None = None, end_freq: astropy.units.Quantity | None = None) SpectralIndex¶
Get the start and end indices for spectral axes
- Parameters:
wcs (WCS) – WCS for HDU
start_freq (u.Quantify | None, optional) – Starting frequency. Defaults to None.
end_freq (u.Quantify | None, optional) – End frequency. Defaults to None.
- Returns:
start_freq_index, end_freq_index
- Return type:
- cutout_fits.cutout.get_stokes_indices(wcs: astropy.wcs.WCS) StokesIndex¶
Get the start and end indices for Stokes axes
- Parameters:
wcs (WCS) – WCS for HDU
- Returns:
start_stokes_index, end_stokes_index
- Return type:
- cutout_fits.cutout.make_cutout(infile: str, outfile: str, ra_deg: float, dec_deg: float, radius_arcmin: float, freq_start_hz: float | None = None, freq_end_hz: float | None = None, overwrite: bool = False) astropy.io.fits.HDUList¶
Make a cutout of a FITS file
- Parameters:
infile (str) – Path to FITS file - can be a remote URL
outfile (str) – Path to output file - must be local
ra_deg (float) – Centre RA in degrees
dec_deg (float) – Centre Dec in degrees
radius_arcmin (float) – Cutout radius in arcminutes
freq_start_hz (float | None, optional) – Start frequency in Hz. Defaults to None.
freq_end_hz (float | None, optional) – End frequency in Hz. Defaults to None.
overwrite (bool) – Whether to overwrite the output file.
- Returns:
Cutout HDUList
- Return type:
fits.HDUList
- cutout_fits.cutout.make_slicer(wcs: astropy.wcs.WCS, centre: astropy.coordinates.SkyCoord, radius: astropy.units.Quantity, start_freq: astropy.units.Quantity | None = None, end_freq: astropy.units.Quantity | None = None) tuple[slice, Ellipsis]¶
Create a slicer for a given WCS, centre, radius, and frequency range
- Parameters:
wcs (WCS) – WCS for HDU
centre (SkyCoord) – Centre of cutout
radius (u.Quantity) – Radius of cutout
start_freq (u.Quantity | None, optional) – Starting frequency. Defaults to None.
end_freq (u.Quantity | None, optional) – End frequnecy. Defaults to None.
- Returns:
Tuple of slices for each axis - in numpy order
- Return type:
Tuple[slice,…]
- cutout_fits.cutout.update_header(old_header: astropy.io.fits.Header, slicer: tuple[slice, Ellipsis]) astropy.io.fits.Header¶
Update the header to reflect the cutout
- cutout_fits.cutout._ = False¶