Skip to content

Commit

Permalink
Turn on weather calculations
Browse files Browse the repository at this point in the history
The translators were written before any data was taken on sky
and so weather was never enabled.
  • Loading branch information
timj committed Oct 23, 2023
1 parent dbc29eb commit d8c6980
Show file tree
Hide file tree
Showing 5 changed files with 206 additions and 13 deletions.
3 changes: 0 additions & 3 deletions python/lsst/obs/lsst/translators/latiss.py
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,6 @@ class LatissTranslator(LsstBaseTranslator):
"detector_group": _DETECTOR_GROUP_NAME,
"detector_num": 0,
"detector_name": _DETECTOR_NAME, # Single sensor
"relative_humidity": None,
"pressure": None,
"temperature": None,
}

_trivial_map = {
Expand Down
31 changes: 31 additions & 0 deletions python/lsst/obs/lsst/translators/lsst.py
Original file line number Diff line number Diff line change
Expand Up @@ -934,3 +934,34 @@ def to_has_simulated_content(self):

# No simulation flags set.
return False

@cache_translation
def to_relative_humidity(self) -> float | None:
key = "HUMIDITY"
if self.is_key_ok(key):
self._used_these_cards(key)
return self._header[key]

return None

@cache_translation
def to_pressure(self):
key = "PRESSURE"
if self.is_key_ok(key):
value = self._header[key]
# There has been an inconsistency in units for the pressure reading
# so we need to adjust for this.
if value > 10_000:
unit = u.Pa
else:
unit = u.hPa
return value * unit

return None

@cache_translation
def to_temperature(self):
key = "AIRTEMP"
if self.is_key_ok(key):
return self._header[key] * u.deg_C
return None
3 changes: 0 additions & 3 deletions python/lsst/obs/lsst/translators/lsstCam.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,6 @@ class LsstCamTranslator(LsstBaseTranslator):
# includes them
"altaz_begin": None,
"object": "UNKNOWN",
"relative_humidity": None,
"temperature": None,
"pressure": None,
}

_trivial_map = {
Expand Down
137 changes: 137 additions & 0 deletions tests/headers/latiss-AT_O_20230705_000379_R00_S00.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
{
"__CONTENT__" : "metadata",
"SIMPLE" : true,
"BITPIX" : 8,
"NAXIS" : 0,
"EXTEND" : true,
"CCD_MANU" : "ITL",
"CCD_TYPE" : "3800C",
"DETSIZE" : "[1:4072,1:4000]",
"BINX" : 1,
"BINY" : 1,
"CCDGAIN" : 1.0,
"CCDNOISE" : 10.0,
"CCDSLOT" : "S00",
"RAFTBAY" : "R00",
"FIRMWARE" : "11384004",
"PLATFORM" : "auxtel",
"CONTNUM" : "189216ee",
"DAQVERS" : "R5-V6.1 2023-04-19T04:26:24Z (1fa91971)",
"DAQPART" : "lat",
"DAQFOLD" : "raw",
"SEQFILE" : "FP_ITL_2s_ir2_v26_no_RG.seq",
"SEQNAME" : "FP_ITL_2s_ir2_v26_no_RG.seq",
"SEQCKSUM" : "1477162166",
"LSST_NUM" : "ITL-3800C-068",
"CCD_SERN" : "20862",
"REBNAME" : "Unknown",
"RAFTNAME" : "AuxTel-Raft",
"FPVERS" : "1.1.8",
"IHVERS" : "1.0.38",
"HIERARCH.STUTTER.ROWS" : 0,
"HIERARCH.STUTTER.DELAY" : 0.0,
"HIERARCH.STUTTER.NSHIFTS" : 0,
"FILTPOS" : null,
"CCDTEMP" : -90.4308,
"DATE" : "2023-07-06T04:56:32.155",
"MJD" : 60131.20592771983,
"IMGTYPE" : "OBJECT",
"DATE-OBS" : "2023-07-06T04:56:01.913",
"MJD-OBS" : 60131.20557769667,
"DATE-TRG" : "2023-07-06T04:56:32.150",
"MJD-TRG" : 60131.205927662086,
"OBSID" : "AT_O_20230705_000379",
"DATE-BEG" : "2023-07-06T04:56:01.913",
"MJD-BEG" : 60131.20557769667,
"DATE-END" : "2023-07-06T04:56:32.155",
"MJD-END" : 60131.20592771983,
"GROUPID" : "2023-07-06T04:53:15.609",
"BUNIT" : "adu",
"TIMESYS" : "TAI",
"INSTRUME" : "LATISS",
"TELESCOP" : "LSST AuxTelescope",
"OBS-LONG" : -70.7476862,
"OBS-LAT" : -30.2447889,
"OBS-ELEV" : 2663.0,
"OBSGEO-X" : 1819093.52,
"OBSGEO-Y" : -5208408.1,
"OBSGEO-Z" : 3195186.45,
"FACILITY" : "Vera C. Rubin Observatory",
"RA" : 272.1186216000001,
"DEC" : -21.25310639,
"RASTART" : 272.08100988065354,
"DECSTART" : -21.29189769138964,
"RAEND" : 272.08106447161356,
"DECEND" : -21.29192959685414,
"ROTPA" : 218.0120692722092,
"ROTCOORD" : "sky",
"HASTART" : 0.972610195793257,
"ELSTART" : 74.13288637448854,
"AZSTART" : -59.070243942086414,
"AMSTART" : 1.0391822914647533,
"AHAEND" : null,
"AELEND" : null,
"AAZEND" : null,
"AAMEND" : null,
"TRACKSYS" : null,
"RADESYS" : "ICRS",
"FOCUSZ" : -0.008921561762690544,
"OBJECT" : "HD165763",
"INSTPORT" : 2,
"ATM3PORT" : null,
"DOMEAZ" : 305.73,
"SHUTLOWR" : 0.0,
"SHUTUPPR" : 100.0,
"WCSAXES" : null,
"CTYPE1" : null,
"CTYPE2" : null,
"CUNIT1" : null,
"CUNIT2" : null,
"CRVAL1" : null,
"CRVAL2" : null,
"CRPIX1" : null,
"CRPIX2" : null,
"CD1_1" : null,
"CD1_2" : null,
"CD2_1" : null,
"CD2_2" : null,
"EQUINOX" : null,
"TESTTYPE" : "OBJECT",
"CAMCODE" : "AT",
"CONTRLLR" : "O",
"DAYOBS" : "20230705",
"SEQNUM" : 379,
"PROGRAM" : "BLOCK-59",
"REASON" : "SITCOM-857",
"CURINDEX" : 1,
"MAXINDEX" : 1,
"TSTAND" : null,
"IMAGETAG" : "c2cb16b93091b0ec",
"OBSANNOT" : "",
"TEMP_SET" : -94.15,
"GRATING" : "holo4_003",
"GRATBAND" : "H4-003",
"GRATSLOT" : 3,
"LINSPOS" : -324.40301513671875,
"FILTBAND" : "EMPTY",
"FILTER" : "empty_1",
"FILTSLOT" : 0,
"EXPTIME" : 30.0,
"DARKTIME" : 30.2418,
"SHUTTIME" : 30.0,
"AIRTEMP" : 5.775000095367432,
"PRESSURE" : 77780.0,
"HUMIDITY" : 15.149999618530273,
"WINDSPD" : 10.008000373840332,
"WINDDIR" : 37.21355438232422,
"SEEING" : 2.2614493370056152,
"FILENAME" : "AT_O_20230705_000379_R00_S00.fits",
"HEADVER" : 2,
"HIERARCH.SIMULATE.ATMCS" : null,
"HIERARCH.SIMULATE.ATHEXAPOD" : 0,
"HIERARCH.SIMULATE.ATPNEUMATICS" : null,
"HIERARCH.SIMULATE.ATDOME" : 0,
"HIERARCH.SIMULATE.ATSPECTROGRAPH" : 0,
"CHECKSUM" : "ALi2BIg2AIg2AIg2",
"DATASUM" : "0"
}
45 changes: 38 additions & 7 deletions tests/test_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -726,10 +726,10 @@ def test_latiss_translator(self):
observation_reason="object",
observing_day=20220405,
physical_filter="SDSSr~empty",
pressure=None,
relative_humidity=None,
pressure=744.3*u.hPa,
relative_humidity=19.0,
science_program="LATISS_E6A",
temperature=None,
temperature=12.3*u.deg_C,
visit_id=2291434871810000,
# We have some timing discrepancies in the headers
# that make it hard to match the demand RA/DEC to
Expand Down Expand Up @@ -760,10 +760,10 @@ def test_latiss_translator(self):
observation_reason="object",
observing_day=20220405,
physical_filter="SDSSr~empty",
pressure=None,
relative_humidity=None,
pressure=744.3*u.hPa,
relative_humidity=19.0,
science_program="LATISS_E6A",
temperature=None,
temperature=12.3*u.deg_C,
visit_id=2291434871810000,
# We have some timing discrepancies in the headers
# that make it hard to match the demand RA/DEC to
Expand Down Expand Up @@ -800,7 +800,38 @@ def test_latiss_translator(self):
temperature=None,
visit_id=2593446676330000,
check_altaz=True,
))
)),
("latiss-AT_O_20230705_000379_R00_S00.json",
dict(telescope="Rubin Auxiliary Telescope",
instrument="LATISS",
boresight_rotation_coord="sky",
dark_time=30.2418*u.s,
detector_exposure_id=0x9a2817b00,
detector_group="RXX",
detector_name="S00",
detector_num=0,
detector_serial="ITL-3800C-068",
exposure_id=2023070500379,
exposure_group="2023-07-06T04:53:15.609",
exposure_time=30.0*u.s,
focus_z=-0.008921561762690544*u.mm,
group_counter_end=379,
group_counter_start=379,
has_simulated_content=False,
object="HD165763",
observation_counter=379,
observation_id="AT_O_20230705_000379",
observation_type="science",
observation_reason="sitcom-857",
observing_day=20230705,
physical_filter="empty~holo4_003",
pressure=777.80*u.hPa,
relative_humidity=15.149999618530273,
science_program="BLOCK-59",
temperature=5.775000095367432*u.deg_C,
visit_id=2685487956090000,
check_altaz=True,
)),
)
with warnings.catch_warnings():
# Avoid warnings from too-long FITS header keys.
Expand Down

0 comments on commit d8c6980

Please sign in to comment.