opihiexarata.library.fits module
Fits file based operations. These are kind of like convince functions.
- opihiexarata.library.fits.get_observing_time(filename: str) float [source]
This reads the header of a FITS file and extracts from it the time of observation from the FITS file and returns it. This assumes the header key of the observing time to be pulled is: MJD_OBS.
- Parameters:
filename (string) – The FITS filename to pull the observing time from.
- Returns:
observing_time_jd – The time of the observation, in Julian days.
- Return type:
float
- opihiexarata.library.fits.read_fits_header(filename: str, extension: int | str = 0) Header [source]
This reads the header of fits files only. This should be used only if there is no data.
Really, this is just a wrapper around Astropy, but it is made for consistency and to avoid the usage of the convince functions.
- Parameters:
filename (string) – The filename that the fits image file is at.
extension (int or string, default = 0) – The fits extension that is desired to be opened.
- Returns:
header – The header of the fits file.
- Return type:
Astropy Header
- opihiexarata.library.fits.read_fits_image_file(filename: str, extension: int | str = 0) tuple[Header, ndarray] [source]
This reads fits files, assuming that the fits file is an image. It is a wrapper function around the astropy functions.
- Parameters:
filename (string) – The filename that the fits image file is at.
extension (int or string, default = 0) – The fits extension that is desired to be opened.
- Returns:
header (Astropy Header) – The header of the fits file.
data (array) – The data image of the fits file.
- opihiexarata.library.fits.read_fits_table_file(filename: str, extension: int | str = 0) tuple[Header, Table] [source]
This reads fits files, assuming that the fits file is a binary table. It is a wrapper function around the astropy functions.
- Parameters:
filename (string) – The filename that the fits image file is at.
extension (int or string, default = 0) – The fits extension that is desired to be opened.
- Returns:
header (Astropy Header) – The header of the fits file.
table (Astropy Table) – The data table of the fits file.
- opihiexarata.library.fits.update_opihiexarata_fits_header(header: Header, entries: dict) Header [source]
This appends entries from a dictionary to an Astropy header.
This function is specifically for OpihiExarata data entries. All other entries or header keyword value pairs are ignored. The OpihiExarata results (or header information per say) are appended or updated.
Comments are provided by the standard OpihiExarata form.
- Parameters:
header (Astropy Header) – The header which the entries will be added to.
entries (dictionary) – The new entries to the header.
- Returns:
opihiexarata_header – The header which OpihiExarata entries have been be added to.
- Return type:
Astropy Header
- opihiexarata.library.fits.write_fits_image_file(filename: str, header: Header, data: ndarray, overwrite: bool = False) None [source]
This writes fits image files to disk. Acting as a wrapper around the fits functionality of astropy.
- Parameters:
filename (string) – The filename that the fits image file will be written to.
header (Astropy Header) – The header of the fits file.
data (array-like) – The data image of the fits file.
overwrite (boolean, default = False) – Decides if to overwrite the file if it already exists.
- Return type:
None
- opihiexarata.library.fits.write_fits_table_file(filename: str, header: Header, data: Table, overwrite: bool = False) None [source]
This writes fits table files to disk. Acting as a wrapper around the fits functionality of astropy.
- Parameters:
filename (string) – The filename that the fits image file will be written to.
header (Astropy Header) – The header of the fits file.
data (Astropy Table) – The data table of the table file.
overwrite (boolean, default = False) – Decides if to overwrite the file if it already exists.
- Return type:
None