Skip to content

Commit

Permalink
use OBSID keyword for observation_id, when available
Browse files Browse the repository at this point in the history
  • Loading branch information
jchiang87 committed Jul 15, 2022
1 parent 9e2bd2a commit d9ffb5b
Show file tree
Hide file tree
Showing 3 changed files with 83 additions and 0 deletions.
4 changes: 4 additions & 0 deletions python/lsst/obs/lsst/translators/ts8.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,6 +242,10 @@ def to_exposure_id(self):
@cache_translation
def to_observation_id(self):
# Docstring will be inherited. Property defined in properties.py
if self.is_key_ok('OBSID'):
observation_id = self._header["OBSID"]
self._used_these_cards("OBSID")
return observation_id
filename = self._header["FILENAME"]
self._used_these_cards("FILENAME")
return filename[:filename.rfind(".")]
55 changes: 55 additions & 0 deletions tests/headers/ts8-TS_C_20220711_000174_R22_S00.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
SIMPLE: true
BITPIX: 8
NAXIS: 0
EXTEND: true
DATE: '2022-07-11T17:15:23.036'
MJD: 59771.719016620424
RUNNUM: '7074D'
CCD_MANU: ITL
CCD_TYPE: 3800C
TESTTYPE: SPOT_FLAT
IMGTYPE: SPOT
DETSIZE: '[1:4072,1:4000]'
EXPTIME: 210.0
FILENAME: TS_C_20220711_000174_R22_S00.fits
BINX: 1
BINY: 1
CCDGAIN: 1.0
CCDNOISE: 10.0
DATE-OBS: '2022-07-11T17:14:45.995'
MJD-OBS: 59771.71858790517
DATE-TRG: '2022-07-11T17:14:45.995'
MJD-TRG: 59771.71858790517
IMAGETAG: 'b3a9b3f2b7bf19c5'
CCDSLOT: S00
RAFTBAY: R22
FIRMWARE: 31395007
PLATFORM: ir2-teststand
CONTNUM: 18edf1f0
DAQVERS: R5-V3.0 2022-05-27T17:47:18Z (d7e1bea7)
DAQPART: ts8
DAQFOLD: raw
OBSANNOT: 365nm
OBSID: TS_C_20220711_000174
CAMCODE: TS
CONTRLLR: C
DAYOBS: 20220711
SEQNUM: 174
HEADVER: 2
INSTRUME: LSST-TS8
TELESCOP: LSST
TSTAND: TS8
SEQFILE: FP_ITL_2s_ir2_v26.seq
SEQCKSUM: 980618532
LSST_NUM: ITL-3800C-372
CCD_SERN: 24809
REBNAME: LCA-13574-061
RAFTNAME: LCA-11021_RTM-004
DARKTIME: 210.315
TSEQNUM: 162
FPVERS: 1.1.1
IHVERS: 1.0.28
FILTER: unspecified
FILTER2: unspecified
CHECKSUM: 0fCL3ZBL0dBL0ZBL
DATASUM: 0
24 changes: 24 additions & 0 deletions tests/test_translator.py
Original file line number Diff line number Diff line change
Expand Up @@ -1002,6 +1002,30 @@ def test_ts8_translator(self):
physical_filter="i",
science_program="6288",
visit_id=201712151140062)),
("ts8-TS_C_20220711_000174_R22_S00.yaml",
dict(telescope=None,
instrument="LSST-TS8",
dark_time=210.315*u.s,
detector_exposure_id=202207111714459018,
detector_group="RTM-004",
detector_name="S00",
detector_num=18,
detector_serial="ITL-3800C-372",
exposure_id=202207111714459,
exposure_group="202207111714459",
exposure_time=210.0*u.s,
focus_z=0.0*u.mm,
group_counter_end=174,
group_counter_start=174,
has_simulated_content=False,
observation_counter=174,
observation_id="TS_C_20220711_000174",
observation_type="spot",
observation_reason="spot_flat",
observing_day=20220711,
physical_filter="unknown",
science_program="7074D",
visit_id=202207111714459))
)
for filename, expected in test_data:
with self.subTest(f"Testing {filename}"):
Expand Down

0 comments on commit d9ffb5b

Please sign in to comment.