From 854e10f8aba1863389997d88669db2c870fd1b9a Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Tue, 26 Sep 2023 15:12:13 -0700 Subject: [PATCH 1/2] From October 2023, use unified CCS/OCS sequence numbers No longer add 3000 to the year for CCS data when calculating exposure IDs. --- python/lsst/obs/lsst/translators/lsst.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/python/lsst/obs/lsst/translators/lsst.py b/python/lsst/obs/lsst/translators/lsst.py index e542a5993..7cd2bd5d0 100644 --- a/python/lsst/obs/lsst/translators/lsst.py +++ b/python/lsst/obs/lsst/translators/lsst.py @@ -412,13 +412,20 @@ def compute_exposure_id(dayobs, seqnum, controller=None): if seqnum >= 10**_SEQNUM_MAXDIGITS: raise ValueError(f"Sequence number ({seqnum}) exceeds limit") + dayobs = int(dayobs) + if dayobs > 20231004 and controller == "C": + # As of this date the CCS controller has a unified counter + # with the OCS, so there is no need to adjust the dayobs + # to make unique exposure IDs. + controller = None + # Camera control changes the exposure ID if controller is not None: index = CONTROLLERS.find(controller) if index == -1: raise ValueError(f"Supplied controller, '{controller}' is not " f"in supported list: {CONTROLLERS}") - dayobs = int(dayobs) + # Increment a thousand years per controller dayobs += _CONTROLLER_INCREMENT * index From 73afbdba5d28c73039ce6036f48104554c433888 Mon Sep 17 00:00:00 2001 From: Tim Jenness Date: Wed, 27 Sep 2023 14:22:00 -0700 Subject: [PATCH 2/2] Test unified CCS/OCS exposure ID calculation Uses a faked header file of a CCS observation from before the switch over made to look like one from the future. It's based off lsstCam-MC_C_20190319_000001_R10_S02.yaml. --- tests/headers/lsstCam-faked-future-ccs.yaml | 142 ++++++++++++++++++++ tests/test_translator.py | 29 ++++ 2 files changed, 171 insertions(+) create mode 100644 tests/headers/lsstCam-faked-future-ccs.yaml diff --git a/tests/headers/lsstCam-faked-future-ccs.yaml b/tests/headers/lsstCam-faked-future-ccs.yaml new file mode 100644 index 000000000..49222bd51 --- /dev/null +++ b/tests/headers/lsstCam-faked-future-ccs.yaml @@ -0,0 +1,142 @@ +SIMPLE: true +BITPIX: 32 +NAXIS: 2 +EXTEND: true +DATE: '2019-03-19T15:50:34.622' +DATE-OBS: '2019-03-19T15:50:28.145' +MJD: 58561.66012293985 +MJD-OBS: 58561.66004797444 +IMAGETAG: '1553010628145' +TSTAND: BOT +INSTRUME: lsstCam +CONTNUM: 0000189126e1 +CCD_MANU: ITL +CCD_TYPE: 3800C +CCDSLOT: S02 +RAFTBAY: R10 +LSST_NUM: ITL-3800C-041 +RAFTNAME: LCA-11021_RTM-003_ETU2 +TESTTYPE: BIAS +IMGTYPE: BIAS +SEQNUM: 1 +DETSIZE: '[1:4072,1:4000]' +CCDTEMP: -110.09798421488179 +EXPTIME: 0.0 +FILENAME: MC_C_20190319_000001_R10_S02.fits +BINX: 1 +BINY: 1 +HEADVER: 1 +CCDGAIN: 1.0 +CCDNOISE: 10.0 +TELESCOP: LSST +OBSID: MC_C_20190319_000001 +TELCODE: MC +CONTRLLR: C +DAYOBS: '20290319' +TSEQNUM: 0 +TEMPLED1: 20.600147112211552 +TEMPLED2: 20.18183822135534 +TEMPSPH: 24.385273966899142 +TEMPBRD: 29.7677403380139 +CHECKSUM: Y9fAb7c8Z7cAa7c7 +DATASUM: '139019781' +XTENSION: IMAGE +NAXIS1: 576 +NAXIS2: 2048 +PCOUNT: 0 +GCOUNT: 1 +CHANNEL: 1 +EXTNAME: Segment10 +CCDSUM: 1 1 +AVERAGE: 25604.065213846083 +AVGBIAS: 25604.041137695312 +STDVBIAS: 2.0006144295067294 +STDEV: 2.007842126768741 +DATASEC: '[4:512,1:2000]' +DETSEC: '[509:1,1:2000]' +DTV1: 513 +DTV2: 0 +DTM1_1: -1.0 +DTM2_2: 1.0 +DTM1_2: 0.0 +DTM2_1: 0.0 +WCSNAMEA: AMPLIFIER +CTYPE1A: Seg_X +CTYPE2A: Seg_Y +PC1_1A: 0.0 +PC1_2A: -1.0 +PC2_1A: -1.0 +PC2_2A: 0.0 +CDELT1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git a/tests/test_translator.py b/tests/test_translator.py index e3ef456a3..ac785ca75 100644 --- a/tests/test_translator.py +++ b/tests/test_translator.py @@ -156,6 +156,35 @@ def test_lsstCam_translator(self): science_program="6549D", temperature=None, visit_id=3019040600643)), + ("lsstCam-faked-future-ccs.yaml", # Old CCS observation with date in future for exp_id + dict(telescope="Simonyi Survey Telescope", + instrument="LSSTCam", + boresight_rotation_coord="unknown", + dark_time=0.0*u.s, + detector_exposure_id=0xdb480011d, + detector_group="R10", + detector_name="S02", + detector_num=29, + detector_serial="ITL-3800C-041", + exposure_id=2029031900001, + exposure_group="2029031900001", + exposure_time=0.0*u.s, + focus_z=0.0*u.mm, + group_counter_end=1, + group_counter_start=1, + has_simulated_content=False, + object="UNKNOWN", + observation_counter=1, + observation_id="MC_C_20190319_000001", + observation_type="bias", + observation_reason="bias", + observing_day=20290319, + physical_filter="unknown", + pressure=None, + relative_humidity=None, + science_program="unknown", + temperature=None, + visit_id=2029031900001)), ) for filename, expected in test_data: with self.subTest(f"Testing {filename}"):