Source code for sofia_redux.scan.custom.sofia.info.origination

# Licensed under a 3-clause BSD style license - see LICENSE.rst

from sofia_redux.scan.info.origination import OriginationInfo
from sofia_redux.scan.utilities.utils import insert_info_in_header

__all__ = ['SofiaOriginationInfo']


[docs] class SofiaOriginationInfo(OriginationInfo): def __init__(self): """ Initialize the SOFIA origination information. Contains information on the SOFIA origin data such as the observer, operator, software, and file. """ self.checksum = None self.checksum_version = None super().__init__()
[docs] def apply_configuration(self): """ Update the origination information with FITS header information. Updates the information by taking the following keywords from the FITS header:: ORIGIN - The creator organization or node (str) OBSERVER - The name(s) of observer(s) (str) CREATOR - The creator software or task (str) OPERATOR - The name(s) of operator(s) (str) FILENAME - The original file name (str) DATASUM - The checksum of the data records (str) CHECKVER - The version of checksum algorithm (str) Returns ------- None """ options = self.options if options is None: return self.organization = options.get_string("ORIGIN") self.observer = options.get_string("OBSERVER") self.creator = options.get_string("CREATOR") self.operator = options.get_string("OPERATOR") self.filename = options.get_string("FILENAME") self.checksum = options.get_string("DATASUM") self.checksum_version = options.get_string("CHECKVER")
[docs] def edit_header(self, header): """ Edit an image header with available information. Parameters ---------- header : astropy.fits.Header The FITS header to apply. Returns ------- None """ filename = 'UNKNOWN' if self.filename is None else self.filename info = [ ('COMMENT', "<------ SOFIA Origination Data ------>"), ('ORIGIN', self.organization, 'Creator organization / node.'), ('CREATOR', self.creator, 'Creator software / task.'), ('OBSERVER', self.observer, 'Name(s) of observer(s).'), ('OPERATOR', self.operator, 'Name(s) of operator(s).'), ('FILENAME', filename, 'Original file name.') ] insert_info_in_header(header, info, delete_special=True)
[docs] def get_table_entry(self, name): """ Return a parameter value for the given name. Parameters ---------- name : str The name of the parameter to retrieve. Returns ------- value """ if name == 'creator': return self.creator elif name == 'file': return self.filename elif name == 'org': return self.organization elif name == 'observer': return self.observer elif name == 'operator': return self.operator else: return super().get_table_entry(name)