Coverage for tests/test_translator.py : 24%

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
1# This file is part of obs_lsst.
2#
3# Developed for the LSST Data Management System.
4# This product includes software developed by the LSST Project
5# (http://www.lsst.org).
6# See the COPYRIGHT file at the top-level directory of this distribution
7# for details of code ownership.
8#
9# This program is free software: you can redistribute it and/or modify
10# it under the terms of the GNU General Public License as published by
11# the Free Software Foundation, either version 3 of the License, or
12# (at your option) any later version.
13#
14# This program is distributed in the hope that it will be useful,
15# but WITHOUT ANY WARRANTY; without even the implied warranty of
16# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17# GNU General Public License for more details.
18#
19# You should have received a copy of the GNU General Public License
20# along with this program. If not, see <http://www.gnu.org/licenses/>.
22import os.path
23import unittest
24import astropy
25import astropy.units as u
26import astropy.units.cds as cds
27import lsst.obs.lsst.translators # noqa: F401 -- register the translators
29from astro_metadata_translator.tests import MetadataAssertHelper
31TESTDIR = os.path.abspath(os.path.dirname(__file__))
34class LsstMetadataTranslatorTestCase(unittest.TestCase, MetadataAssertHelper):
35 """Each test reads in raw headers from YAML files, constructs an
36 `ObservationInfo`, and compares the properties with the expected values
37 defined in the corresponding `dict`."""
39 datadir = os.path.join(TESTDIR, "headers")
41 def test_lsstCam_translator(self):
42 test_data = (("lsstCam-MC_C_20190319_000001_R10_S02.yaml",
43 dict(telescope="LSST",
44 instrument="lsstCam",
45 boresight_rotation_coord="unknown",
46 dark_time=0.0*u.s,
47 detector_exposure_id=3019031900001029,
48 detector_group="R10",
49 detector_name="S02",
50 detector_num=29,
51 detector_serial="ITL-3800C-041",
52 exposure_id=3019031900001,
53 exposure_group="3019031900001",
54 exposure_time=0.0*u.s,
55 object="UNKNOWN",
56 observation_id="MC_C_20190319_000001",
57 observation_type="bias",
58 physical_filter="NONE",
59 pressure=None,
60 relative_humidity=None,
61 science_program="unknown",
62 temperature=None,
63 visit_id=3019031900001)),
64 ("lsstCam-MC_C_20190319_000001_R22_S21.yaml",
65 dict(telescope="LSST",
66 instrument="lsstCam",
67 boresight_rotation_coord="unknown",
68 dark_time=0.0*u.s,
69 detector_exposure_id=3019031900001097,
70 detector_group="R22",
71 detector_name="S21",
72 detector_num=97,
73 detector_serial="ITL-3800C-139",
74 exposure_id=3019031900001,
75 exposure_group="3019031900001",
76 exposure_time=0.0*u.s,
77 object="UNKNOWN",
78 observation_id="MC_C_20190319_000001",
79 observation_type="bias",
80 physical_filter="NONE",
81 pressure=None,
82 relative_humidity=None,
83 science_program="unknown",
84 temperature=None,
85 visit_id=3019031900001)),
86 ("lsstCam-MC_C_20190322_000002_R10_S22.yaml",
87 dict(telescope="LSST",
88 instrument="lsstCam",
89 boresight_rotation_coord="unknown",
90 dark_time=1.0*u.s,
91 detector_exposure_id=3019032200002035,
92 detector_group="R10",
93 detector_name="S22",
94 detector_num=35,
95 detector_serial="ITL-3800C-103",
96 exposure_id=3019032200002,
97 exposure_group="3019032200002",
98 exposure_time=1.0*u.s,
99 object="UNKNOWN",
100 observation_id="MC_C_20190322_000002",
101 observation_type="flat",
102 physical_filter="SDSSi~ND_OD0.5",
103 pressure=None,
104 relative_humidity=None,
105 science_program="6489D",
106 temperature=None,
107 visit_id=3019032200002)),
108 ("lsstCam-MC_C_20190406_000643_R10_S00.yaml",
109 dict(telescope="LSST",
110 instrument="lsstCam",
111 boresight_rotation_coord="unknown",
112 dark_time=1007.422*u.s,
113 detector_exposure_id=3019040600643027,
114 detector_group="R10",
115 detector_name="S00",
116 detector_num=27,
117 detector_serial="ITL-3800C-145",
118 exposure_id=3019040600643,
119 exposure_group="3019040600643",
120 exposure_time=999.99*u.s,
121 object="UNKNOWN",
122 observation_id="MC_C_20190406_000643",
123 observation_type="flat",
124 physical_filter="950nm~empty",
125 pressure=None,
126 relative_humidity=None,
127 science_program="6549D",
128 temperature=None,
129 visit_id=3019040600643)),
130 )
131 for filename, expected in test_data:
132 with self.subTest(f"Testing {filename}"):
133 self.assertObservationInfoFromYaml(filename, dir=self.datadir, **expected)
135 def test_comCam_translator(self):
136 test_data = (("comCam-CC_C_20190530_000001_R22_S00.yaml",
137 dict(telescope="LSST",
138 instrument="LSST-ComCam",
139 boresight_rotation_coord="unknown",
140 dark_time=0.398*u.s,
141 detector_exposure_id=3019053000001000,
142 detector_group="R22",
143 detector_name="S00",
144 detector_num=0,
145 detector_serial="ITL-3800C-229",
146 exposure_id=3019053000001,
147 exposure_group="3019053000001",
148 exposure_time=0.0*u.s,
149 object="UNKNOWN",
150 observation_id="CC_C_20190530_000001",
151 observation_type="bias",
152 physical_filter="NONE",
153 pressure=None,
154 relative_humidity=None,
155 science_program="unknown",
156 temperature=None,
157 visit_id=3019053000001)),
158 ("comCam-CC_C_20190526_000223_R22_S01.yaml",
159 dict(telescope="LSST",
160 instrument="LSST-ComCam",
161 boresight_rotation_coord="unknown",
162 dark_time=0.034*u.s,
163 detector_exposure_id=3019052600223001,
164 detector_group="R22",
165 detector_name="S01",
166 detector_num=1,
167 detector_serial="ITL-3800C-251",
168 exposure_id=3019052600223,
169 exposure_group="3019052600223",
170 exposure_time=0.0*u.s,
171 object="UNKNOWN",
172 observation_id="CC_C_20190526_000223",
173 observation_type="bias",
174 physical_filter="NONE",
175 pressure=None,
176 relative_humidity=None,
177 science_program="unknown",
178 temperature=None,
179 visit_id=3019052600223)),
180 )
181 for filename, expected in test_data:
182 with self.subTest(f"Testing {filename}"):
183 self.assertObservationInfoFromYaml(filename, dir=self.datadir, **expected)
185 def test_phosim_translator(self):
186 test_data = (("phosim-lsst_a_204595_f3_R11_S02_E000.yaml",
187 dict(telescope="LSST",
188 instrument="LSST-PhoSim",
189 boresight_rotation_coord="sky",
190 dark_time=30.0*u.s,
191 detector_exposure_id=204595038,
192 detector_group="R11",
193 detector_name="S02",
194 detector_num=38,
195 detector_serial="R11_S02",
196 exposure_id=204595,
197 exposure_group="204595",
198 exposure_time=30.0*u.s,
199 object="UNKNOWN",
200 observation_id="204595",
201 observation_type="science",
202 physical_filter="i",
203 pressure=520.0*cds.mmHg,
204 relative_humidity=40.0,
205 science_program="204595",
206 temperature=20.0*u.deg_C,
207 visit_id=204595,
208 wcs_params=dict(max_sep=3000.))), # 2022
209 )
210 for filename, expected in test_data:
211 with self.subTest(f"Testing {filename}"):
212 # PhoSim data are in the future and Astropy complains
213 # about astrometry errors.
214 with self.assertWarns(astropy.utils.exceptions.AstropyWarning):
215 self.assertObservationInfoFromYaml(filename, dir=self.datadir, **expected)
217 def test_latiss_translator(self):
218 test_data = (("latiss-2018-09-20-05700065-det000.yaml",
219 dict(telescope="LSSTAuxTel",
220 instrument="LATISS",
221 boresight_rotation_coord="unknown",
222 dark_time=27.0*u.s,
223 detector_exposure_id=3018092000065,
224 detector_group="RXX",
225 detector_name="S00",
226 detector_num=0,
227 detector_serial="ITL-3800C-098",
228 exposure_id=3018092000065,
229 exposure_group="3018092000065",
230 exposure_time=27.0*u.s,
231 object="UNKNOWN",
232 observation_id="AT_C_20180920_000065",
233 observation_type="unknown",
234 physical_filter="????~????",
235 pressure=None,
236 relative_humidity=None,
237 science_program="unknown",
238 temperature=None,
239 visit_id=3018092000065,
240 )),
241 ("latiss-AT_O_20190306_000014.yaml",
242 dict(telescope="LSSTAuxTel",
243 instrument="LATISS",
244 boresight_rotation_coord="unknown",
245 dark_time=1.06*u.s,
246 detector_exposure_id=2019030600014,
247 detector_group="RXX",
248 detector_name="S00",
249 detector_num=0,
250 detector_serial="ITL-3800C-098",
251 exposure_id=2019030600014,
252 exposure_group="2019030600014",
253 exposure_time=1.06*u.s,
254 object="UNKNOWN",
255 observation_id="AT_O_20190306_000014",
256 observation_type="unknown",
257 physical_filter="????~????",
258 pressure=None,
259 relative_humidity=None,
260 science_program="unknown",
261 temperature=None,
262 visit_id=2019030600014,
263 )),
264 ("latiss-AT_O_20190329_000022-ats-wfs_ccd.yaml",
265 dict(telescope="LSSTAuxTel",
266 instrument="LATISS",
267 boresight_rotation_coord="unknown",
268 dark_time=0.0*u.s,
269 detector_exposure_id=2019032900022,
270 detector_group="RXX",
271 detector_name="S00",
272 detector_num=0,
273 detector_serial="ITL-3800C-098",
274 exposure_id=2019032900022,
275 exposure_group="2019032900022",
276 exposure_time=0.0*u.s,
277 object="UNKNOWN",
278 observation_id="AT_O_20190329_000022",
279 observation_type="bias",
280 physical_filter="NONE~NONE",
281 pressure=None,
282 relative_humidity=None,
283 science_program="unknown",
284 temperature=None,
285 visit_id=2019032900022,
286 )),
287 ("latiss-future.yaml",
288 dict(telescope="LSSTAuxTel",
289 instrument="LATISS",
290 boresight_rotation_coord="unknown",
291 dark_time=0.0*u.s,
292 detector_exposure_id=2020032900022,
293 detector_group="RXX",
294 detector_name="S00",
295 detector_num=0,
296 detector_serial="ITL-3800C-068",
297 exposure_id=2020032900022,
298 exposure_group="2020-03-29T16:55:00.012#24",
299 exposure_time=0.0*u.s,
300 object="UNKNOWN",
301 observation_id="AT_X_20200329_000022",
302 observation_type="bias",
303 physical_filter="NONE~NONE",
304 pressure=None,
305 relative_humidity=None,
306 science_program="unknown",
307 temperature=None,
308 visit_id=1654305000120024,
309 )),
310 ("latiss-AT_O_20190915_000037.yaml",
311 dict(telescope="LSSTAuxTel",
312 instrument="LATISS",
313 boresight_rotation_coord="unknown",
314 dark_time=0.0*u.s,
315 detector_exposure_id=2019091500037,
316 detector_group="RXX",
317 detector_name="S00",
318 detector_num=0,
319 detector_serial="ITL-3800C-068",
320 exposure_id=2019091500037,
321 exposure_group="bias_0027_0100",
322 exposure_time=0.0*u.s,
323 object="UNKNOWN",
324 observation_id="AT_O_20190915_000037",
325 observation_type="bias",
326 physical_filter="NONE~NONE",
327 pressure=None,
328 relative_humidity=None,
329 science_program="unknown",
330 temperature=None,
331 visit_id=3575576933793566714,
332 )),
333 ("latiss-AT_O_20191031_000004.yaml",
334 dict(telescope="LSSTAuxTel",
335 instrument="LATISS",
336 boresight_rotation_coord="unknown",
337 dark_time=3.0*u.s,
338 detector_exposure_id=2019103100004,
339 detector_group="RXX",
340 detector_name="S00",
341 detector_num=0,
342 detector_serial="ITL-3800C-068",
343 exposure_id=2019103100004,
344 exposure_group="TEST01",
345 exposure_time=3.0*u.s,
346 object="UNKNOWN",
347 observation_id="AT_O_20191031_000004",
348 observation_type="engtest",
349 physical_filter="????~????",
350 pressure=None,
351 relative_humidity=None,
352 science_program="unknown",
353 temperature=None,
354 visit_id=1123819875881954006,
355 )),
356 ("latiss-AT_O_20191104_000003.yaml",
357 dict(telescope="LSSTAuxTel",
358 instrument="LATISS",
359 boresight_rotation_coord="unknown",
360 dark_time=3.0*u.s,
361 detector_exposure_id=2019110400003,
362 detector_group="RXX",
363 detector_name="S00",
364 detector_num=0,
365 detector_serial="ITL-3800C-068",
366 exposure_id=2019110400003,
367 exposure_group="TEST01",
368 exposure_time=3.0*u.s,
369 object="UNKNOWN",
370 observation_id="AT_O_20191104_000003",
371 observation_type="engtest",
372 physical_filter="????~????",
373 pressure=None,
374 relative_humidity=None,
375 science_program="unknown",
376 temperature=None,
377 visit_id=1123819875881954006,
378 )),
379 ("latiss-AT_O_20191113_000061.yaml",
380 dict(telescope="LSSTAuxTel",
381 instrument="LATISS",
382 boresight_rotation_coord="unknown",
383 dark_time=0.5*u.s,
384 detector_exposure_id=2019111300061,
385 detector_group="RXX",
386 detector_name="S00",
387 detector_num=0,
388 detector_serial="ITL-3800C-068",
389 exposure_id=2019111300061,
390 exposure_group="wave,Focus,455,32.0PH=5um",
391 exposure_time=0.5*u.s,
392 object="UNKNOWN",
393 observation_id="AT_O_20191113_000061",
394 observation_type="engtest",
395 physical_filter="EMPTY~ronchi90lpmm",
396 pressure=None,
397 relative_humidity=None,
398 science_program="unknown",
399 temperature=None,
400 visit_id=1892608703001301325,
401 )),
402 ("latiss-AT_O_20191118_000011.yaml",
403 dict(telescope="LSSTAuxTel",
404 instrument="LATISS",
405 boresight_rotation_coord="unknown",
406 dark_time=15.0*u.s,
407 detector_exposure_id=2019111800011,
408 detector_group="RXX",
409 detector_name="S00",
410 detector_num=0,
411 detector_serial="ITL-3800C-068",
412 exposure_id=2019111800011,
413 exposure_group="dark_0002_0005",
414 exposure_time=15.0*u.s,
415 object="UNKNOWN",
416 observation_id="AT_O_20191118_000011",
417 observation_type="dark",
418 physical_filter="diffuser~ronchi170lpmm",
419 pressure=None,
420 relative_humidity=None,
421 science_program="unknown",
422 temperature=None,
423 visit_id=6861884254113212214,
424 )),
425 ("latiss-AT_O_20200121_000045.yaml",
426 dict(telescope="LSSTAuxTel",
427 instrument="LATISS",
428 boresight_rotation_coord="sky",
429 dark_time=100.0*u.s,
430 detector_exposure_id=2020012100045,
431 detector_group="RXX",
432 detector_name="S00",
433 detector_num=0,
434 detector_serial="ITL-3800C-068",
435 exposure_id=2020012100045,
436 exposure_group="test",
437 exposure_time=100.0*u.s,
438 object="UNKNOWN",
439 observation_id="AT_O_20200121_000045",
440 observation_type="engtest",
441 physical_filter="blank_bk7_wg05~EMPTY",
442 pressure=None,
443 relative_humidity=None,
444 science_program="unknown",
445 temperature=None,
446 visit_id=4702443654717948604,
447 )),
448 ("latiss-AT_O_20200128_000379.yaml",
449 dict(telescope="LSSTAuxTel",
450 instrument="LATISS",
451 boresight_rotation_coord="sky",
452 dark_time=5.0*u.s,
453 detector_exposure_id=2020012800379,
454 detector_group="RXX",
455 detector_name="S00",
456 detector_num=0,
457 detector_serial="ITL-3800C-068",
458 exposure_id=2020012800379,
459 exposure_group="2020-01-29T07:25:52.166",
460 exposure_time=5.0*u.s,
461 object="HD107696",
462 observation_id="AT_O_20200128_000379",
463 observation_type="science",
464 physical_filter="KPNO_406_828nm~EMPTY",
465 pressure=None,
466 relative_humidity=None,
467 science_program="unknown",
468 temperature=None,
469 visit_id=1602123521660000,
470 # We have some timing discrepancies in the headers
471 # that make it hard to match the demand RA/DEC to
472 # the recorded AZ/EL/TIME.
473 wcs_params=dict(max_sep=7.),
474 )),
475 )
476 self.assertObservationInfoFromYaml("latiss-future.yaml", dir=self.datadir)
477 for filename, expected in test_data:
478 with self.subTest(f"Testing {filename}"):
479 self.assertObservationInfoFromYaml(filename, dir=self.datadir, **expected)
481 # This translation should fail
482 with self.assertRaises(KeyError):
483 self.assertObservationInfoFromYaml("latiss-future-bad.yaml", dir=self.datadir)
485 def test_imsim_translator(self):
486 test_data = (("imsim-bias-lsst_a_3010002_R11_S00.yaml",
487 dict(telescope="LSST",
488 instrument="LSST-ImSim",
489 boresight_rotation_coord="sky",
490 dark_time=0.0*u.s,
491 detector_exposure_id=3010002036,
492 detector_group="R11",
493 detector_name="S00",
494 detector_num=36,
495 detector_serial="LCA-11021_RTM-000",
496 exposure_id=3010002,
497 exposure_group="3010002",
498 exposure_time=0.0*u.s,
499 object="UNKNOWN",
500 observation_id="3010002",
501 observation_type="science", # The header is wrong
502 physical_filter="i",
503 pressure=None,
504 relative_humidity=40.0,
505 science_program="42",
506 temperature=None,
507 visit_id=3010002,
508 wcs_params=dict(max_sep=3000.), # 2022
509 )),
510 ("imsim-lsst_a_204595_R11_S02_i.yaml",
511 dict(telescope="LSST",
512 instrument="LSST-ImSim",
513 boresight_rotation_coord="sky",
514 dark_time=30.0*u.s,
515 detector_exposure_id=204595038,
516 detector_group="R11",
517 detector_name="S02",
518 detector_num=38,
519 detector_serial="LCA-11021_RTM-000",
520 exposure_id=204595,
521 exposure_group="204595",
522 exposure_time=30.0*u.s,
523 object="UNKNOWN",
524 observation_id="204595",
525 observation_type="science", # The header is wrong
526 physical_filter="i",
527 pressure=None,
528 relative_humidity=40.0,
529 science_program="204595",
530 temperature=None,
531 visit_id=204595,
532 wcs_params=dict(max_sep=3000.), # 2022
533 )),
534 ("imsim-flats-lsst_a_5000007_R11_S20_i.yaml",
535 dict(telescope="LSST",
536 instrument="LSST-ImSim",
537 boresight_rotation_coord="sky",
538 dark_time=30.0*u.s,
539 detector_exposure_id=5000007042,
540 detector_group="R11",
541 detector_name="S20",
542 detector_num=42,
543 detector_serial="LCA-11021_RTM-000",
544 exposure_id=5000007,
545 exposure_group="5000007",
546 exposure_time=30.0*u.s,
547 object="UNKNOWN",
548 observation_id="5000007",
549 observation_type="flat",
550 physical_filter="i",
551 pressure=None,
552 relative_humidity=40.0,
553 science_program="5000007",
554 temperature=None,
555 visit_id=5000007,
556 wcs_params=dict(max_sep=3000.), # 2022
557 )),
558 ("imsim-dark-lsst_a_4010003_R11_S11.yaml",
559 dict(telescope="LSST",
560 instrument="LSST-ImSim",
561 boresight_rotation_coord="sky",
562 dark_time=500.0*u.s,
563 detector_exposure_id=4010003040,
564 detector_group="R11",
565 detector_name="S11",
566 detector_num=40,
567 detector_serial="LCA-11021_RTM-000",
568 exposure_id=4010003,
569 exposure_group="4010003",
570 exposure_time=500.0*u.s,
571 object="UNKNOWN",
572 observation_id="4010003",
573 observation_type="science", # The header is wrong
574 physical_filter="i",
575 pressure=None,
576 relative_humidity=40.0,
577 science_program="42",
578 temperature=None,
579 visit_id=4010003,
580 wcs_params=dict(max_sep=3000.), # 2022
581 )),
582 )
583 for filename, expected in test_data:
584 with self.subTest(f"Testing {filename}"):
585 # ImSim data are in the future and Astropy complains
586 # about astrometry errors.
587 if expected["observation_type"] == "science":
588 with self.assertWarns(astropy.utils.exceptions.AstropyWarning):
589 self.assertObservationInfoFromYaml(filename, dir=self.datadir, **expected)
590 else:
591 self.assertObservationInfoFromYaml(filename, dir=self.datadir, **expected)
593 def test_ts3_translator(self):
594 test_data = (("ts3-E2V-CCD250-411_lambda_flat_1000_025_20181115075559.yaml",
595 dict(telescope="LSST",
596 instrument="LSST-TS3",
597 dark_time=44.631*u.s,
598 detector_exposure_id=201811151255111433,
599 detector_group="R433",
600 detector_name="S00",
601 detector_num=433,
602 detector_serial="E2V-CCD250-411",
603 exposure_id=201811151255111,
604 exposure_group="201811151255111",
605 exposure_time=44.631*u.s,
606 observation_id="E2V-CCD250-411_lambda_flat_1000_025_20181115075559",
607 observation_type="flat",
608 physical_filter="550CutOn",
609 science_program="2018-11-15",
610 visit_id=201811151255111)),
611 ("ts3-ITL-3800C-098_lambda_flat_1000_067_20160722020740.yaml",
612 dict(telescope="LSST",
613 instrument="LSST-TS3",
614 dark_time=30.611*u.s,
615 detector_exposure_id=201607220607067071,
616 detector_group="R071",
617 detector_name="S00",
618 detector_num=71,
619 detector_serial="ITL-3800C-098",
620 exposure_id=201607220607067,
621 exposure_group="201607220607067",
622 exposure_time=30.611*u.s,
623 observation_id="ITL-3800C-098_lambda_flat_1000_067_20160722020740",
624 observation_type="flat",
625 physical_filter="550CutOn",
626 science_program="2016-07-22",
627 visit_id=201607220607067)),
628 )
629 for filename, expected in test_data:
630 with self.subTest(f"Testing {filename}"):
631 self.assertObservationInfoFromYaml(filename, dir=self.datadir, **expected)
633 def test_ts8_translator(self):
634 test_data = (("ts8-E2V-CCD250-179_lambda_bias_024_6006D_20180724104156.yaml",
635 dict(telescope="LSST",
636 instrument="LSST-TS8",
637 dark_time=0.0*u.s,
638 detector_exposure_id=201807241041568067,
639 detector_group="RTM-010",
640 detector_name="S11",
641 detector_num=67,
642 detector_serial="E2V-CCD250-179",
643 exposure_id=201807241041568,
644 exposure_group="201807241041568",
645 exposure_time=0.0*u.s,
646 observation_id="E2V-CCD250-179_lambda_bias_024_6006D_20180724104156",
647 observation_type="bias",
648 physical_filter="y",
649 science_program="6006D",
650 visit_id=201807241041568)),
651 ("ts8-E2V-CCD250-200-Dev_lambda_flat_0700_6006D_20180724102845.yaml",
652 dict(telescope="LSST",
653 instrument="LSST-TS8",
654 dark_time=21.913*u.s,
655 detector_exposure_id=201807241028453065,
656 detector_group="RTM-010",
657 detector_name="S02",
658 detector_num=65,
659 detector_serial="E2V-CCD250-200",
660 exposure_id=201807241028453,
661 exposure_group="201807241028453",
662 exposure_time=21.913*u.s,
663 observation_id="E2V-CCD250-200-Dev_lambda_flat_0700_6006D_20180724102845",
664 observation_type="flat",
665 physical_filter="z",
666 science_program="6006D",
667 visit_id=201807241028453)),
668 ("ts8-E2V-CCD250-220_fe55_fe55_094_6288_20171215114006.yaml",
669 dict(telescope="LSST",
670 instrument="LSST-TS8",
671 dark_time=300.0*u.s,
672 detector_exposure_id=201712151140062027,
673 detector_group="RTM-005",
674 detector_name="S00",
675 detector_num=27,
676 detector_serial="E2V-CCD250-220",
677 exposure_id=201712151140062,
678 exposure_group="201712151140062",
679 exposure_time=300.0*u.s,
680 observation_id="E2V-CCD250-220_fe55_fe55_094_6288_20171215114006",
681 observation_type="fe55",
682 physical_filter="i",
683 science_program="6288",
684 visit_id=201712151140062)),
685 )
686 for filename, expected in test_data:
687 with self.subTest(f"Testing {filename}"):
688 self.assertObservationInfoFromYaml(filename, dir=self.datadir, **expected)
690 def test_ucdcam_translator(self):
691 test_data = (("UCD-E2V-CCD250-112-04_flat_flat_100_20181205153143.yaml",
692 dict(telescope="LSST",
693 instrument="LSST-UCDCam",
694 dark_time=0.5*u.s,
695 detector_exposure_id=201812052331480,
696 detector_group="R00",
697 detector_name="S00",
698 detector_num=0,
699 detector_serial="E2V-CCD250-112-04",
700 exposure_id=20181205233148,
701 exposure_group="20181205233148",
702 exposure_time=0.5*u.s,
703 observation_id="E2V-CCD250-112-04_flat_flat_100_20181205153143",
704 observation_type="flat",
705 physical_filter="r",
706 science_program="2018-12-05",
707 visit_id=20181205233148)),
708 ("UCD-ITL-3800C-002_flat_flat_100_20180530080354.yaml",
709 dict(telescope="LSST",
710 instrument="LSST-UCDCam",
711 dark_time=0.5*u.s,
712 detector_exposure_id=201805301503552,
713 detector_group="R02",
714 detector_name="S00",
715 detector_num=2,
716 detector_serial="ITL-3800C-002",
717 exposure_id=20180530150355,
718 exposure_group="20180530150355",
719 exposure_time=0.5*u.s,
720 observation_id="ITL-3800C-002_flat_flat_100_20180530080354",
721 observation_type="flat",
722 physical_filter="r",
723 science_program="2018-05-30",
724 visit_id=20180530150355)),
725 )
726 for filename, expected in test_data:
727 with self.subTest(f"Testing {filename}"):
728 self.assertObservationInfoFromYaml(filename, dir=self.datadir, **expected)
730 def test_checker(self):
731 filename = "latiss-future.yaml"
732 from astro_metadata_translator.tests import read_test_file
733 from astro_metadata_translator import ObservationInfo
734 header = read_test_file(filename, self.datadir)
735 obsInfo = ObservationInfo(header, pedantic=True)
736 self.assertTrue(obsInfo)
739if __name__ == "__main__": 739 ↛ 740line 739 didn't jump to line 740, because the condition on line 739 was never true
740 unittest.main()