From c512a5776016112209a777160b570f9923646f63 Mon Sep 17 00:00:00 2001 From: Robert Jedrzejewski Date: Wed, 28 Aug 2024 11:08:35 -0400 Subject: [PATCH] Add more regtests (#247) * Added regression tests * Missed one temp_path usage so temp file was getting left behind * Fix Python version --- pyproject.toml | 2 +- tests/helpers.py | 7 ++-- tests/test_acq_image.py | 39 ++++++++++++++++++++ tests/test_acq_peakd_both.py | 31 ++++++++++++++++ tests/test_acq_peakd_fuva.py | 31 ++++++++++++++++ tests/test_acq_peakd_nuv.py | 31 ++++++++++++++++ tests/test_acq_peakxd.py | 31 ++++++++++++++++ tests/test_acq_search.py | 31 ++++++++++++++++ tests/test_cosutil.py | 2 +- tests/test_nuv_sci_g185m.py | 44 +++++++++++++++++++++++ tests/test_nuv_sci_g230l.py | 44 +++++++++++++++++++++++ tests/test_nuv_sci_g285m.py | 44 +++++++++++++++++++++++ tests/test_wavecal_fuvb_g160m.py | 41 +++++++++++++++++++++ tests/test_wavecal_fuvb_g160m_relmvreq.py | 41 +++++++++++++++++++++ tests/test_wavecal_nuv_g185m.py | 39 ++++++++++++++++++++ tests/test_wavecal_nuv_g225m.py | 39 ++++++++++++++++++++ tests/test_wavecal_nuv_g230l.py | 39 ++++++++++++++++++++ tests/test_wavecal_nuv_g285m.py | 39 ++++++++++++++++++++ tests/test_wavecal_nuv_mirrora.py | 39 ++++++++++++++++++++ tests/test_wavecal_nuv_mirrorb.py | 39 ++++++++++++++++++++ 20 files changed, 649 insertions(+), 4 deletions(-) create mode 100644 tests/test_acq_image.py create mode 100644 tests/test_acq_peakd_both.py create mode 100644 tests/test_acq_peakd_fuva.py create mode 100644 tests/test_acq_peakd_nuv.py create mode 100644 tests/test_acq_peakxd.py create mode 100644 tests/test_acq_search.py create mode 100644 tests/test_nuv_sci_g185m.py create mode 100644 tests/test_nuv_sci_g230l.py create mode 100644 tests/test_nuv_sci_g285m.py create mode 100644 tests/test_wavecal_fuvb_g160m.py create mode 100644 tests/test_wavecal_fuvb_g160m_relmvreq.py create mode 100644 tests/test_wavecal_nuv_g185m.py create mode 100644 tests/test_wavecal_nuv_g225m.py create mode 100644 tests/test_wavecal_nuv_g230l.py create mode 100644 tests/test_wavecal_nuv_g285m.py create mode 100644 tests/test_wavecal_nuv_mirrora.py create mode 100644 tests/test_wavecal_nuv_mirrorb.py diff --git a/pyproject.toml b/pyproject.toml index c03da33..467e890 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "calcos" description = "Calibration software for COS (Cosmic Origins Spectrograph)" -requires-python = ">=3.9" +requires-python = ">=3.9,<3.13" authors = [ { name = "Phil Hodge", email="help@stsci.edu" }, { name = "Robert Jedrzejewski" }, diff --git a/tests/helpers.py b/tests/helpers.py index 59a2a4f..510b529 100644 --- a/tests/helpers.py +++ b/tests/helpers.py @@ -130,8 +130,11 @@ def get_input_files(self, filenames): file) # If file is an association table, download raw files specified in the table if file.endswith('_asn.fits'): - asn_raws = raw_from_asn(file, '_rawtag_a.fits') - asn_raws += raw_from_asn(file, '_rawtag_b.fits') + if self.detector == 'nuv': + asn_raws = raw_from_asn(file, '_rawtag.fits') + else: + asn_raws = raw_from_asn(file, '_rawtag_a.fits') + asn_raws += raw_from_asn(file, '_rawtag_b.fits') for raw in asn_raws: # Download RAWs in ASN. get_bigdata('scsb-calcos', self.env, self.detector, 'input', raw) diff --git a/tests/test_acq_image.py b/tests/test_acq_image.py new file mode 100644 index 0000000..9a70006 --- /dev/null +++ b/tests/test_acq_image.py @@ -0,0 +1,39 @@ +"""Tests for COS/NUV ACQ/IMAGE.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestNUVCQIMAGE(BaseCOS): + detector = 'nuv' + + def test_fuv_acq_image(self): + """ + FUV COS regression test + """ + files_to_download = ['ldji01ggq_rawacq.fits', + 'ldji01ggq_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'ldji01ggq_rawacq.fits' + # Run CALCOS + calcos.calcos(input_file) + + # Compare results. + # The first outroot is the output from whole ASN, + # the rest are individual members. + outroots = ['ldji01ggq'] + outputs = [] + for outroot in outroots: + for sfx in ('counts', 'flt'): + fname = '{}_{}.fits'.format(outroot, sfx) + outputs.append((fname, 'ref_' + fname)) + self.compare_outputs(outputs, rtol=1e-7) + diff --git a/tests/test_acq_peakd_both.py b/tests/test_acq_peakd_both.py new file mode 100644 index 0000000..8fdf55e --- /dev/null +++ b/tests/test_acq_peakd_both.py @@ -0,0 +1,31 @@ +"""Tests for COS/BOTH ACQ/PEAKD.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestBOTHACQPEAKD(BaseCOS): + detector = 'fuv' + + def test_both_acq_peakd(self): + """ + FUV COS regression test + """ + files_to_download = ['ld7y02rrq_rawacq.fits', + 'ld7y02rrq_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'ld7y02rrq_rawacq.fits' + # Run CALCOS + calcos.calcos(input_file) + + # No need to compare results as this test doesn't + # produce any products. We are just testing that the + # code runs to completion diff --git a/tests/test_acq_peakd_fuva.py b/tests/test_acq_peakd_fuva.py new file mode 100644 index 0000000..f73030f --- /dev/null +++ b/tests/test_acq_peakd_fuva.py @@ -0,0 +1,31 @@ +"""Tests for COS/FUVA ACQ/PEAKD.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestFUVAACQPEAKD(BaseCOS): + detector = 'fuv' + + def test_fuva_acq_peakd(self): + """ + FUV COS regression test + """ + files_to_download = ['lbx503kfq_rawacq.fits', + 'lbx503kfq_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'lbx503kfq_rawacq.fits' + # Run CALCOS + calcos.calcos(input_file) + + # No need to compare results as this test doesn't + # product any products. We are just testing that the + # code runs to completion diff --git a/tests/test_acq_peakd_nuv.py b/tests/test_acq_peakd_nuv.py new file mode 100644 index 0000000..8bc5c70 --- /dev/null +++ b/tests/test_acq_peakd_nuv.py @@ -0,0 +1,31 @@ +"""Tests for COS/NUV ACQ/PEAKD.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestNUVACQPEAKD(BaseCOS): + detector = 'nuv' + + def test_nuv_acq_peakd(self): + """ + FUV COS regression test + """ + files_to_download = ['la8q99l7q_rawacq.fits', + 'la8q99l7q_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'la8q99l7q_rawacq.fits' + # Run CALCOS + calcos.calcos(input_file) + + # No need to compare results as this test doesn't + # product any products. We are just testing that the + # code runs to completion diff --git a/tests/test_acq_peakxd.py b/tests/test_acq_peakxd.py new file mode 100644 index 0000000..1fcf78f --- /dev/null +++ b/tests/test_acq_peakxd.py @@ -0,0 +1,31 @@ +"""Tests for COS/FUV ACQ/PEAKXD.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestFUVACQPEAKXD(BaseCOS): + detector = 'fuv' + + def test_fuv_acq_peakxd(self): + """ + FUV COS regression test + """ + files_to_download = ['la9t01naq_rawacq.fits', + 'la9t01naq_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'la9t01naq_rawacq.fits' + # Run CALCOS + calcos.calcos(input_file) + + # No need to compare results as this test doesn't + # product any products. We are just testing that the + # code runs to completion diff --git a/tests/test_acq_search.py b/tests/test_acq_search.py new file mode 100644 index 0000000..c37e587 --- /dev/null +++ b/tests/test_acq_search.py @@ -0,0 +1,31 @@ +"""Tests for COS/FUV ACQ/SEARCH.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestFUVACQSEARCH(BaseCOS): + detector = 'fuv' + + def test_fuv_acq_search(self): + """ + FUV COS regression test + """ + files_to_download = ['la9t01n9q_rawacq.fits', + 'la9t01n9q_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'la9t01n9q_rawacq.fits' + # Run CALCOS + calcos.calcos(input_file) + + # No need to compare results as this test doesn't + # product any products. We are just testing that the + # code runs to completion diff --git a/tests/test_cosutil.py b/tests/test_cosutil.py index 445aab0..d07fa89 100644 --- a/tests/test_cosutil.py +++ b/tests/test_cosutil.py @@ -935,7 +935,7 @@ def test_get_switch(tmp_path): def test_temp_pulse_height_range(tmp_path): - filename = "pulseHeightRef.fits" + filename = str(tmp_path / "pulseHeightRef.fits") generate_fits_file(filename) true_pha_value = 4 fits.setval(filename, "pharange", value=true_pha_value, ext=0) diff --git a/tests/test_nuv_sci_g185m.py b/tests/test_nuv_sci_g185m.py new file mode 100644 index 0000000..2e16064 --- /dev/null +++ b/tests/test_nuv_sci_g185m.py @@ -0,0 +1,44 @@ +"""Tests for COS/NUV G185M sci data.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestNUVSciG185M(BaseCOS): + detector = 'nuv' + + def test_nuv_sci_g185m(self): + """ + COS regression test + """ + files_to_download = ['la8q99050_asn.fits', + 'la8q99jbq_rawtag.fits', + 'la8q99jbq_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'la8q99050_asn.fits' + # Run CALCOS + calcos.calcos(input_file) + + # Compare results. + # The first outroot is the output from whole ASN, + # the rest are individual members. + outroots = ['la8q99050', 'la8q99jbq'] + outputs = [] + for sfx in ['x1dsum', 'x1dsum3']: + fname = f'{outroots[0]}_{sfx}.fits' + comparison_name = 'ref_' + fname + outputs.append((fname, comparison_name)) + for outroot in outroots[1:]: + for sfx in ('corrtag', 'counts', + 'flt', 'lampflash', 'x1d'): + fname = '{}_{}.fits'.format(outroot, sfx) + outputs.append((fname, 'ref_' + fname)) + self.compare_outputs(outputs, rtol=1e-7) diff --git a/tests/test_nuv_sci_g230l.py b/tests/test_nuv_sci_g230l.py new file mode 100644 index 0000000..d4b2199 --- /dev/null +++ b/tests/test_nuv_sci_g230l.py @@ -0,0 +1,44 @@ +"""Tests for COS/NUV G230L sci data.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestNUVSciG230L(BaseCOS): + detector = 'nuv' + + def test_nuv_sci_g230l(self): + """ + COS regression test + """ + files_to_download = ['la8p93030_asn.fits', + 'la8p93a7q_rawtag.fits', + 'la8p93a7q_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'la8p93030_asn.fits' + # Run CALCOS + calcos.calcos(input_file) + + # Compare results. + # The first outroot is the output from whole ASN, + # the rest are individual members. + outroots = ['la8p93030', 'la8p93a7q'] + outputs = [] + for sfx in ['x1dsum', 'x1dsum3']: + fname = f'{outroots[0]}_{sfx}.fits' + comparison_name = 'ref_' + fname + outputs.append((fname, comparison_name)) + for outroot in outroots[1:]: + for sfx in ('corrtag', 'counts', + 'flt', 'lampflash', 'x1d'): + fname = '{}_{}.fits'.format(outroot, sfx) + outputs.append((fname, 'ref_' + fname)) + self.compare_outputs(outputs, rtol=1e-7) diff --git a/tests/test_nuv_sci_g285m.py b/tests/test_nuv_sci_g285m.py new file mode 100644 index 0000000..fb7037d --- /dev/null +++ b/tests/test_nuv_sci_g285m.py @@ -0,0 +1,44 @@ +"""Tests for COS/NUV G285M sci data.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestNUVSciG285M(BaseCOS): + detector = 'nuv' + + def test_nuv_sci_g285m(self): + """ + COS regression test + """ + files_to_download = ['la8q99030_asn.fits', + 'la8q99ixq_rawtag.fits', + 'la8q99ixq_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'la8q99030_asn.fits' + # Run CALCOS + calcos.calcos(input_file) + + # Compare results. + # The first outroot is the output from whole ASN, + # the rest are individual members. + outroots = ['la8q99030', 'la8q99ixq'] + outputs = [] + for sfx in ['x1dsum', 'x1dsum3']: + fname = f'{outroots[0]}_{sfx}.fits' + comparison_name = 'ref_' + fname + outputs.append((fname, comparison_name)) + for outroot in outroots[1:]: + for sfx in ('corrtag', 'counts', + 'flt', 'lampflash', 'x1d'): + fname = '{}_{}.fits'.format(outroot, sfx) + outputs.append((fname, 'ref_' + fname)) + self.compare_outputs(outputs, rtol=1e-7) diff --git a/tests/test_wavecal_fuvb_g160m.py b/tests/test_wavecal_fuvb_g160m.py new file mode 100644 index 0000000..fc7f82e --- /dev/null +++ b/tests/test_wavecal_fuvb_g160m.py @@ -0,0 +1,41 @@ +"""Tests for COS/FUVB wavecal, G160M.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestFUVBWavecalG160M(BaseCOS): + detector = 'fuv' + + def test_fuvb_wavecal_g160m(self): + """ + FUV COS regression test + """ + files_to_download = ['la7803fkq_rawtag_a.fits', + 'la7803fkq_rawtag_b.fits', + 'la7803fkq_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'la7803fkq_rawtag_a.fits' + # Run CALCOS + calcos.calcos(input_file) + + # Compare results. + # The first outroot is the output from whole ASN, + # the rest are individual members. + outroots = ['la7803fkq'] + outputs = [] + for outroot in outroots: + for sfx in ('corrtag_a', 'counts_a', + 'corrtag_b', 'counts_b', + 'flt_a', 'flt_b', 'x1d'): + fname = '{}_{}.fits'.format(outroot, sfx) + outputs.append((fname, 'ref_' + fname)) + self.compare_outputs(outputs, rtol=1e-7) diff --git a/tests/test_wavecal_fuvb_g160m_relmvreq.py b/tests/test_wavecal_fuvb_g160m_relmvreq.py new file mode 100644 index 0000000..18fee41 --- /dev/null +++ b/tests/test_wavecal_fuvb_g160m_relmvreq.py @@ -0,0 +1,41 @@ +"""Tests for COS/FUVB wavecal, G160M, relmvreq""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestFUVBWavecalG160MRelMvReq(BaseCOS): + detector = 'fuv' + + def test_fuvb_wavecal_g160m_relmvreq(self): + """ + FUV COS regression test + """ + files_to_download = ['ldd9a3h6q_rawtag_a.fits', + 'ldd9a3h6q_rawtag_b.fits', + 'ldd9a3h6q_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'ldd9a3h6q_rawtag_a.fits' + # Run CALCOS + calcos.calcos(input_file) + + # Compare results. + # The first outroot is the output from whole ASN, + # the rest are individual members. + outroots = ['ldd9a3h6q'] + outputs = [] + for outroot in outroots: + for sfx in ('corrtag_a', 'counts_a', + 'corrtag_b', 'counts_b', + 'flt_a', 'flt_b', 'x1d'): + fname = '{}_{}.fits'.format(outroot, sfx) + outputs.append((fname, 'ref_' + fname)) + self.compare_outputs(outputs, rtol=1e-7) diff --git a/tests/test_wavecal_nuv_g185m.py b/tests/test_wavecal_nuv_g185m.py new file mode 100644 index 0000000..8fd08d7 --- /dev/null +++ b/tests/test_wavecal_nuv_g185m.py @@ -0,0 +1,39 @@ +"""Tests for COS/NUV G185M wavecal.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestWavecalNUVG185M(BaseCOS): + detector = 'nuv' + + def test_wavecal_nuv_g185m(self): + """ + COS regression test + """ + files_to_download = ['la7v01dmq_rawtag.fits', + 'la7v01dmq_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'la7v01dmq_rawtag.fits' + # Run CALCOS + calcos.calcos(input_file) + + # Compare results. + # The first outroot is the output from whole ASN, + # the rest are individual members. + outroots = ['la7v01dmq'] + outputs = [] + for outroot in outroots: + for sfx in ('corrtag', 'counts', + 'flt', 'x1d'): + fname = '{}_{}.fits'.format(outroot, sfx) + outputs.append((fname, 'ref_' + fname)) + self.compare_outputs(outputs, rtol=1e-7) diff --git a/tests/test_wavecal_nuv_g225m.py b/tests/test_wavecal_nuv_g225m.py new file mode 100644 index 0000000..07e3624 --- /dev/null +++ b/tests/test_wavecal_nuv_g225m.py @@ -0,0 +1,39 @@ +"""Tests for COS/NUV G225M wavecal.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestWavecalNUVG225M(BaseCOS): + detector = 'nuv' + + def test_wavecal_nuv_g122m(self): + """ + COS regression test + """ + files_to_download = ['la7v01doq_rawtag.fits', + 'la7v01doq_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'la7v01doq_rawtag.fits' + # Run CALCOS + calcos.calcos(input_file) + + # Compare results. + # The first outroot is the output from whole ASN, + # the rest are individual members. + outroots = ['la7v01doq'] + outputs = [] + for outroot in outroots: + for sfx in ('corrtag', 'counts', + 'flt', 'x1d'): + fname = '{}_{}.fits'.format(outroot, sfx) + outputs.append((fname, 'ref_' + fname)) + self.compare_outputs(outputs, rtol=1e-7) diff --git a/tests/test_wavecal_nuv_g230l.py b/tests/test_wavecal_nuv_g230l.py new file mode 100644 index 0000000..c399a8f --- /dev/null +++ b/tests/test_wavecal_nuv_g230l.py @@ -0,0 +1,39 @@ +"""Tests for COS/NUV G230L wavecal.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestWavecalNUVG230L(BaseCOS): + detector = 'nuv' + + def test_wavecal_nuv_g230l(self): + """ + COS regression test + """ + files_to_download = ['la7v01e4q_rawtag.fits', + 'la7v01e4q_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'la7v01e4q_rawtag.fits' + # Run CALCOS + calcos.calcos(input_file) + + # Compare results. + # The first outroot is the output from whole ASN, + # the rest are individual members. + outroots = ['la7v01e4q'] + outputs = [] + for outroot in outroots: + for sfx in ('corrtag', 'counts', + 'flt', 'x1d'): + fname = '{}_{}.fits'.format(outroot, sfx) + outputs.append((fname, 'ref_' + fname)) + self.compare_outputs(outputs, rtol=1e-7) diff --git a/tests/test_wavecal_nuv_g285m.py b/tests/test_wavecal_nuv_g285m.py new file mode 100644 index 0000000..9e6e5b9 --- /dev/null +++ b/tests/test_wavecal_nuv_g285m.py @@ -0,0 +1,39 @@ +"""Tests for COS/NUV G285M wavecal.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestWavecalNUVG285M(BaseCOS): + detector = 'nuv' + + def test_wavecal_nuv_g285m(self): + """ + COS regression test + """ + files_to_download = ['la7v01dqq_rawtag.fits', + 'la7v01dqq_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'la7v01dqq_rawtag.fits' + # Run CALCOS + calcos.calcos(input_file) + + # Compare results. + # The first outroot is the output from whole ASN, + # the rest are individual members. + outroots = ['la7v01dqq'] + outputs = [] + for outroot in outroots: + for sfx in ('corrtag', 'counts', + 'flt', 'x1d'): + fname = '{}_{}.fits'.format(outroot, sfx) + outputs.append((fname, 'ref_' + fname)) + self.compare_outputs(outputs, rtol=1e-7) diff --git a/tests/test_wavecal_nuv_mirrora.py b/tests/test_wavecal_nuv_mirrora.py new file mode 100644 index 0000000..0e5fbb6 --- /dev/null +++ b/tests/test_wavecal_nuv_mirrora.py @@ -0,0 +1,39 @@ +"""Tests for COS/NUV MIRRORA wavecal.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestWavecalNUVMirrorA(BaseCOS): + detector = 'nuv' + + def test_wavecal_nuv_mirrora(self): + """ + COS regression test + """ + files_to_download = ['la7u04w0q_rawtag.fits', + 'la7u04w0q_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'la7u04w0q_rawtag.fits' + # Run CALCOS + calcos.calcos(input_file) + + # Compare results. + # The first outroot is the output from whole ASN, + # the rest are individual members. + outroots = ['la7u04w0q'] + outputs = [] + for outroot in outroots: + for sfx in ('corrtag', 'counts', + 'flt'): + fname = '{}_{}.fits'.format(outroot, sfx) + outputs.append((fname, 'ref_' + fname)) + self.compare_outputs(outputs, rtol=1e-7) diff --git a/tests/test_wavecal_nuv_mirrorb.py b/tests/test_wavecal_nuv_mirrorb.py new file mode 100644 index 0000000..de45dfb --- /dev/null +++ b/tests/test_wavecal_nuv_mirrorb.py @@ -0,0 +1,39 @@ +"""Tests for COS/NUV MIRRORB wavecal.""" + +import pytest + +import calcos +from helpers import BaseCOS + + +# TODO: Mark this as slow when there are faster tests added for CI tests +# so that this only runs in nightly tests. +@pytest.mark.slow +class TestWavecalNUVMirrorB(BaseCOS): + detector = 'nuv' + + def test_wavecal_nuv_mirrorb(self): + """ + COS regression test + """ + files_to_download = ['labq02osq_rawtag.fits', + 'labq02osq_spt.fits'] + + # Prepare input files. + self.get_input_files(files_to_download) + + input_file = 'labq02osq_rawtag.fits' + # Run CALCOS + calcos.calcos(input_file) + + # Compare results. + # The first outroot is the output from whole ASN, + # the rest are individual members. + outroots = ['labq02osq'] + outputs = [] + for outroot in outroots: + for sfx in ('corrtag', 'counts', + 'flt'): + fname = '{}_{}.fits'.format(outroot, sfx) + outputs.append((fname, 'ref_' + fname)) + self.compare_outputs(outputs, rtol=1e-7)