orca.utils.fitsutils
FITS file I/O and image manipulation utilities.
Provides functions for reading and writing FITS images, creating masks, co-adding images, and extracting cutouts and statistics around source positions.
Functions
|
Read a 2D image from a FITS file. |
|
Write a 2D image to a FITS file. |
Writes a fits mask with a list of boxes to file. |
|
|
|
|
|
|
|
|
|
|
|
|
Module Contents
- orca.utils.fitsutils.read_image_fits(fn: str) Tuple[numpy.ndarray, astropy.io.fits.Header][source]
Read a 2D image from a FITS file.
Extracts the first plane from a 4D FITS cube (typical WSClean output).
- Parameters:
fn – Path to the FITS file.
- Returns:
Tuple of (image_data, header).
- orca.utils.fitsutils.write_image_fits(fn: str, header: astropy.io.fits.Header, data: numpy.ndarray, overwrite: bool = False)[source]
Write a 2D image to a FITS file.
Reshapes 2D data into 4D format for CASA/WSClean compatibility.
- Parameters:
fn – Output file path.
header – FITS header to use.
data – 2D image data array.
overwrite – If True, overwrite existing file.
- orca.utils.fitsutils.write_fits_mask_with_box_xy_coordindates(output_fits_path: str, imsize: int, center_list: List[Tuple[int, int]], width_list: List[int]) str[source]
Writes a fits mask with a list of boxes to file. Writes a fits mask with a list of boxes to file. Both im+list and center_list are in WCS X Y coordindates (i.e. transpose of the numpy array from astropy.fits. The fits will NOT have a header that is accurate since only the pixels will be used. If you only need one box you can use one-element lists for the arguments.
- Parameters:
output_fits_path – The fits file path.
imsize – size of the image.
center_list – A list of enters of the boxes. Must be in XY index (i.e. what ds9 shows).
width_list – A list of widths of the boxes in pixels, with each element being the width of the corresponding
center_list element.
Returns: The fits mask path.
- orca.utils.fitsutils.co_add(fits_list: List[str], output_fits_path: str, header_index: int | None = None) str[source]
- orca.utils.fitsutils.get_peak_around_src(im_T: numpy.ndarray, source_coord: astropy.coordinates.SkyCoord, w: astropy.wcs.WCS, radius_px: int = 100) Tuple[int, int][source]
- orca.utils.fitsutils.std_and_max_around_src(im_T: numpy.ndarray, radius: int, source_coord: astropy.coordinates.SkyCoord, w: astropy.wcs.WCS) Tuple[float, float][source]
- orca.utils.fitsutils.get_cutout(im: numpy.ndarray, coord: astropy.coordinates.SkyCoord, w: astropy.wcs.WCS, radius_px: int) numpy.ndarray[source]
- orca.utils.fitsutils.get_sample_header() astropy.io.fits.Header[source]