-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added regression tests * Missed one temp_path usage so temp file was getting left behind * Fix Python version
- Loading branch information
Showing
20 changed files
with
649 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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="[email protected]" }, | ||
{ name = "Robert Jedrzejewski" }, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
Oops, something went wrong.