Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DM-36597: Add LATISS filter transmission data #427

Merged
merged 1 commit into from
Nov 29, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
4 changes: 3 additions & 1 deletion python/lsst/obs/lsst/script/rewrite_ts8_qe_files.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,8 +126,10 @@ def rewrite_ts8_files(picklefile, out_root='.', valid_start='1970-01-01T00:00:00
os.makedirs(outpath, exist_ok=True)
full_detector_name = '_'.join([raft_name, detector_name])
detector_id = cam[full_detector_name].getId()
curve_table.meta.update({'CALIBDATE': valid_start, 'INSTRUME': 'TS8', 'OBSTYPE': 'qe_curve',
curve_table.meta.update({'CALIBDATE': valid_start, 'INSTRUME': 'TS8',
'OBSTYPE': 'transmission_sensor', 'TYPE': 'transmission_sensor',
'DETECTOR': detector_id, 'PICKLEFILE': os.path.split(picklefile)[1]})

curve_table.meta['CALIB_ID'] = (f'raftName={raft_name} detectorName={detector_name} '
f'detector={detector_id} calibDate={valid_start} '
f'ccd={detector_id} ccdnum={detector_id} filter=None')
Expand Down
19 changes: 15 additions & 4 deletions tests/test_rewrite_qe.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@
import glob

import lsst.utils
from lsst.meas.algorithms import Curve
from lsst.obs.lsst.script.rewrite_ts8_qe_files import rewrite_ts8_files
from lsst.ip.isr import IntermediateSensorTransmissionCurve

TESTDIR = os.path.abspath(os.path.dirname(__file__))
DATADIR = lsst.utils.getPackageDir('obs_lsst_data')
Expand All @@ -47,9 +47,20 @@ def testRewriteQe(self):
files = glob.glob(os.path.join(root, '*', '19700101T000000.ecsv'))
self.assertEqual(len(files), 9)
for f in files:
curve1 = Curve.readText(f)
expect_file = os.path.join(DATADIR, 'ts8', 'qe_curve', os.path.relpath(f, root))
curve2 = Curve.readText(expect_file)
curve1 = IntermediateSensorTransmissionCurve.readText(f)
expect_file = os.path.join(DATADIR, 'ts8', 'transmission_sensor', os.path.relpath(f, root))
curve2 = IntermediateSensorTransmissionCurve.readText(expect_file)

# These fields are created every time, and therefore
# differ between the test data and the references.
curve1.getMetadata().pop('DATE')
curve1.getMetadata().pop('CALIB_CREATION_DATE')
curve1.getMetadata().pop('CALIB_CREATION_TIME')

curve2.getMetadata().pop('DATE')
curve2.getMetadata().pop('CALIB_CREATION_DATE')
curve2.getMetadata().pop('CALIB_CREATION_TIME')

self.assertEqual(curve1, curve2)
except Exception:
failed = True
Expand Down