Coverage for python/astro_metadata_translator/translators/suprimecam.py : 31%

Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
# This file is part of astro_metadata_translator. # # Developed for the LSST Data Management System. # This product includes software developed by the LSST Project # (http://www.lsst.org). # See the LICENSE file at the top-level directory of this distribution # for details of code ownership. # # Use of this source code is governed by a 3-clause BSD-style # license that can be found in the LICENSE file.
"""Metadata translator for HSC standard headers. """
"""Name of this translation class"""
"""Supports the SuprimeCam instrument."""
"detector_group": None} """Constant mappings"""
"object": "OBJECT", "science_program": "PROP-ID", "detector_num": "DET-ID", "detector_name": "DETECTOR", "detector_serial": "DETECTOR", # DETNAME seems to be identical to DETECTOR "boresight_airmass": "AIRMASS", "relative_humidity": "OUT-HUM", "temperature": ("OUT-TMP", dict(unit=u.K)), "pressure": ("OUT-PRS", dict(unit=u.hPa)), "exposure_time": ("EXPTIME", dict(unit=u.s)), "dark_time": ("EXPTIME", dict(unit=u.s)), # Assume same as exposure time } """One-to-one mappings"""
# Zero point for SuprimeCam dates: 2004-01-01
"""Indicate whether this translation class can translate the supplied header.
Parameters ---------- header : `dict`-like Header to convert to standardized form. filename : `str`, optional Name of file being translated.
Returns ------- can : `bool` `True` if the header is recognized by this class. `False` otherwise. """ if "INSTRUME" in header: return header["INSTRUME"] == "SuprimeCam"
for k in ("EXP-ID", "FRAMEID"): if cls.is_keyword_defined(header, k): if header[k].startswith("SUP"): return True return False
"""Calculate the modified julian date offset from reference day
Returns ------- offset : `int` Offset day count from reference day. """ mjd = self._header["MJD"] self._used_these_cards("MJD") return int(mjd) - self._DAY0
def to_physical_filter(self): # Docstring will be inherited. Property defined in properties.py value = self._header["FILTER01"].strip().upper() self._used_these_cards("FILTER01") return value
def to_datetime_begin(self): # Docstring will be inherited. Property defined in properties.py # We know it is UTC value = self._from_fits_date_string(self._header["DATE-OBS"], time_str=self._header["UT"], scale="utc") self._used_these_cards("DATE-OBS", "UT") return value
def to_datetime_end(self): # Docstring will be inherited. Property defined in properties.py # We know it is UTC value = self._from_fits_date_string(self._header["DATE-OBS"], time_str=self._header["UT-END"], scale="utc") self._used_these_cards("DATE-OBS", "UT-END") return value
def to_exposure_id(self): """Calculate unique exposure integer for this observation
Returns ------- visit : `int` Integer uniquely identifying this exposure. """ exp_id = self._header["EXP-ID"].strip() m = re.search(r"^SUP[A-Z](\d{7})0$", exp_id) if not m: raise RuntimeError("Unable to interpret EXP-ID: %s" % exp_id) exposure = int(m.group(1)) if int(exposure) == 0: # Don't believe it frame_id = self._header["FRAMEID"].strip() m = re.search(r"^SUP[A-Z](\d{7})\d{1}$", frame_id) if not m: raise RuntimeError("Unable to interpret FRAMEID: %s" % frame_id) exposure = int(m.group(1)) self._used_these_cards("EXP-ID", "FRAMEID") return exposure
def to_visit_id(self): """Calculate the unique integer ID for this visit.
Assumed to be identical to the exposure ID in this implementation.
Returns ------- exp : `int` Unique visit identifier. """ if self.to_observation_type() == "science": return self.to_exposure_id() return None
def to_observation_type(self): """Calculate the observation type.
Returns ------- typ : `str` Observation type. Normalized to standard set. """ obstype = self._header["DATA-TYP"].strip().lower() self._used_these_cards("DATA-TYP") if obstype == "object": return "science" return obstype
def to_tracking_radec(self): # Docstring will be inherited. Property defined in properties.py radec = SkyCoord(self._header["RA2000"], self._header["DEC2000"], frame="icrs", unit=(u.hourangle, u.deg), obstime=self.to_datetime_begin(), location=self.to_location()) self._used_these_cards("RA2000", "DEC2000") return radec
def to_altaz_begin(self): # Docstring will be inherited. Property defined in properties.py return altaz_from_degree_headers(self, (("ALTITUDE", "AZIMUTH"),), self.to_datetime_begin())
def to_boresight_rotation_angle(self): # Docstring will be inherited. Property defined in properties.py angle = Angle(self.quantity_from_card("INR-STR", u.deg)) angle = angle.wrap_at("360d") return angle
def to_detector_exposure_id(self): # Docstring will be inherited. Property defined in properties.py return self.to_exposure_id() * 10 + self.to_detector_num() |