Test file paths updated
Some checks failed
esbo_ds/ESBO-ETC/pipeline/head There was a failure building this commit
Some checks failed
esbo_ds/ESBO-ETC/pipeline/head There was a failure building this commit
This commit is contained in:
parent
5843a202c4
commit
5169225b9e
7
Jenkinsfile
vendored
7
Jenkinsfile
vendored
@ -20,12 +20,7 @@ pipeline {
|
||||
. pyenv/bin/activate
|
||||
pip3 install -r requirements.txt
|
||||
'''
|
||||
sh '''
|
||||
export PYTHONPATH=`pwd`
|
||||
echo $PYTHONPATH
|
||||
cd tests
|
||||
../pyenv/bin/python3 -m unittest discover .
|
||||
'''
|
||||
sh 'pyenv/bin/python3 -m unittest discover tests'
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -27,7 +27,7 @@ class TestAHotOpticalComponent(TestCase):
|
||||
wl = np.arange(201, 205, 1) << u.nm
|
||||
|
||||
def setUp(self):
|
||||
self.target = FileTarget("data/target/target_demo_1.csv", self.wl)
|
||||
self.target = FileTarget("tests/data/target/target_demo_1.csv", self.wl)
|
||||
|
||||
def test___init__(self):
|
||||
comp = HotOpticalComponent(self.target, SpectralQty(self.wl, np.repeat(0.5, 4) << u.dimensionless_unscaled),
|
||||
@ -36,7 +36,7 @@ class TestAHotOpticalComponent(TestCase):
|
||||
SpectralQty(self.wl, np.array([4.31413931e-96, 1.37122214e-95, 4.30844544e-95,
|
||||
1.33846280e-94]) << u.W / (u.m ** 2 * u.nm * u.sr)))
|
||||
|
||||
comp = HotOpticalComponent(self.target, "data/mirror/mirror_emissivity.csv", temp=300 * u.K)
|
||||
comp = HotOpticalComponent(self.target, "tests/data/mirror/mirror_emissivity.csv", temp=300 * u.K)
|
||||
self.assertEqual(comp.calcBackground(),
|
||||
SpectralQty(self.wl, np.array([4.31413931e-96, 1.37122214e-95, 4.30844544e-95,
|
||||
1.33846280e-94]) << u.W / (u.m ** 2 * u.nm * u.sr)))
|
||||
|
@ -6,9 +6,9 @@ import astropy.units as u
|
||||
|
||||
class TestAtmosphere(TestCase):
|
||||
def setUp(self):
|
||||
self.target = FileTarget("data/target/target_demo_1.csv", np.arange(200, 208) << u.nm)
|
||||
self.atmosphere = Atmosphere(self.target, "data/atmosphere/atmosphere_transmittance_1.csv",
|
||||
"data/atmosphere/atmosphere_emission_1.csv")
|
||||
self.target = FileTarget("tests/data/target/target_demo_1.csv", np.arange(200, 208) << u.nm)
|
||||
self.atmosphere = Atmosphere(self.target, "tests/data/atmosphere/atmosphere_transmittance_1.csv",
|
||||
"tests/data/atmosphere/atmosphere_emission_1.csv")
|
||||
|
||||
def test_calcSignal(self):
|
||||
self.assertEqual(self.atmosphere.calcSignal()[0],
|
||||
|
@ -10,8 +10,8 @@ class TestBeamSplitter(TestCase):
|
||||
wl = np.arange(201, 205, 1) << u.nm
|
||||
|
||||
def setUp(self):
|
||||
self.target = FileTarget("data/target/target_demo_1.csv", self.wl)
|
||||
self.splitter = BeamSplitter(self.target, "data/beamsplitter/beamsplitter_transmittance.csv", 0.5,
|
||||
self.target = FileTarget("tests/data/target/target_demo_1.csv", self.wl)
|
||||
self.splitter = BeamSplitter(self.target, "tests/data/beamsplitter/beamsplitter_transmittance.csv", 0.5,
|
||||
temp=300 * u.K)
|
||||
|
||||
def test___init__(self):
|
||||
|
@ -14,8 +14,8 @@ class TestFilter(TestCase):
|
||||
(u.m ** 2 * u.nm)))
|
||||
|
||||
def test_fromFile(self):
|
||||
target = FileTarget("data/target/target_demo_1.csv", np.arange(200, 210, 1) << u.nm)
|
||||
filt = Filter.fromFile(target, "data/filter/filter_transmittance.csv")
|
||||
target = FileTarget("tests/data/target/target_demo_1.csv", np.arange(200, 210, 1) << u.nm)
|
||||
filt = Filter.fromFile(target, "tests/data/filter/filter_transmittance.csv")
|
||||
self.assertEqual(filt.calcSignal()[0],
|
||||
SpectralQty(np.arange(200, 210, 1) << u.nm, np.array([1.10e-15, 1.20e-15, 1.30e-15, 1.40e-15,
|
||||
1.35e-15, 1.44e-15, 1.53e-15, 1.44e-15,
|
||||
|
@ -10,8 +10,8 @@ class TestLens(TestCase):
|
||||
wl = np.arange(201, 205, 1) << u.nm
|
||||
|
||||
def setUp(self):
|
||||
self.target = FileTarget("data/target/target_demo_1.csv", self.wl)
|
||||
self.lens = Lens(self.target, "data/lens/lens_transmittance.csv", 0.5, temp=300 * u.K)
|
||||
self.target = FileTarget("tests/data/target/target_demo_1.csv", self.wl)
|
||||
self.lens = Lens(self.target, "tests/data/lens/lens_transmittance.csv", 0.5, temp=300 * u.K)
|
||||
|
||||
def test___init__(self):
|
||||
self.assertEqual(self.lens.calcBackground(),
|
||||
|
@ -10,8 +10,8 @@ class TestMirror(TestCase):
|
||||
wl = np.arange(201, 205, 1) << u.nm
|
||||
|
||||
def setUp(self):
|
||||
self.target = FileTarget("data/target/target_demo_1.csv", self.wl)
|
||||
self.mirror = Mirror(self.target, "data/mirror/mirror_reflectance.csv", 0.5, temp=300 * u.K)
|
||||
self.target = FileTarget("tests/data/target/target_demo_1.csv", self.wl)
|
||||
self.mirror = Mirror(self.target, "tests/data/mirror/mirror_reflectance.csv", 0.5, temp=300 * u.K)
|
||||
|
||||
def test___init__(self):
|
||||
self.assertEqual(self.mirror.calcBackground(),
|
||||
|
@ -6,8 +6,8 @@ import astropy.units as u
|
||||
|
||||
class TestStrayLight(TestCase):
|
||||
def setUp(self):
|
||||
self.target = FileTarget("data/target/target_demo_1.csv", np.arange(200, 210) << u.nm)
|
||||
self.zodiac = StrayLight(self.target, "data/straylight/zodiacal_emission_1.csv")
|
||||
self.target = FileTarget("tests/data/target/target_demo_1.csv", np.arange(200, 210) << u.nm)
|
||||
self.zodiac = StrayLight(self.target, "tests/data/straylight/zodiacal_emission_1.csv")
|
||||
|
||||
def test_calcSignal(self):
|
||||
self.assertEqual(self.zodiac.calcSignal()[0],
|
||||
|
@ -7,7 +7,7 @@ import numpy as np
|
||||
|
||||
class TestZemax(TestCase):
|
||||
def setUp(self):
|
||||
self.zemax = Zemax("data/psf_2um.txt", 13, 4 * u.um, 0.5 * u.m, 13, 6.5 * u.um)
|
||||
self.zemax = Zemax("tests/data/psf_2um.txt", 13, 4 * u.um, 0.5 * u.m, 13, 6.5 * u.um)
|
||||
|
||||
def test_calcReducedObservationAngle(self):
|
||||
# No jitter
|
||||
|
@ -12,14 +12,14 @@ from esbo_etc.classes.sensor.Heterodyne import Heterodyne
|
||||
|
||||
class TestHeterodyne(TestCase):
|
||||
def setUp(self):
|
||||
self.config = Configuration("data/esbo-etc_defaults_heterodyne.xml").conf
|
||||
self.config = Configuration("tests/data/esbo-etc_defaults_heterodyne.xml").conf
|
||||
self.heterodyne_args = dict(aperture_efficiency=0.55, main_beam_efficiency=0.67,
|
||||
receiver_temp=1050 * u.K, eta_fss=0.97, lambda_line=157.774 * u.um, kappa=1.0,
|
||||
common_conf=self.config.common)
|
||||
self.target = FileTarget("data/target/line.csv", self.config.common.wl_bins())
|
||||
self.atmosphere = Atmosphere(self.target, "data/atmosphere/transmittance_great.csv")
|
||||
self.target = FileTarget("tests/data/target/line.csv", self.config.common.wl_bins())
|
||||
self.atmosphere = Atmosphere(self.target, "tests/data/atmosphere/transmittance_great.csv")
|
||||
self.cosmic = CosmicBackground(self.atmosphere, temp=220 * u.K, emissivity=0.14)
|
||||
self.mirror = Mirror(self.cosmic, reflectance="data/mirror/reflectance_great.csv", emissivity=0.08,
|
||||
self.mirror = Mirror(self.cosmic, reflectance="tests/data/mirror/reflectance_great.csv", emissivity=0.08,
|
||||
temp=230 * u.K)
|
||||
self.heterodyne = Heterodyne(self.mirror, **self.heterodyne_args)
|
||||
|
||||
@ -36,15 +36,15 @@ class TestHeterodyne(TestCase):
|
||||
def test_getSensitivity(self):
|
||||
exp_time = 1900 * u.s
|
||||
target = BlackBodyTarget(self.config.common.wl_bins(), mag=20 * u.mag)
|
||||
atmosphere = Atmosphere(target, "data/atmosphere/transmittance_great.csv")
|
||||
atmosphere = Atmosphere(target, "tests/data/atmosphere/transmittance_great.csv")
|
||||
cosmic = CosmicBackground(atmosphere, temp=220 * u.K, emissivity=0.14)
|
||||
mirror = Mirror(cosmic, reflectance="data/mirror/reflectance_great.csv", emissivity=0.08, temp=230 * u.K)
|
||||
mirror = Mirror(cosmic, reflectance="tests/data/mirror/reflectance_great.csv", emissivity=0.08, temp=230 * u.K)
|
||||
heterodyne = Heterodyne(mirror, **self.heterodyne_args)
|
||||
snr = heterodyne.getSNR(exp_time)
|
||||
target = BlackBodyTarget(self.config.common.wl_bins(), mag=10 * u.mag)
|
||||
atmosphere = Atmosphere(target, "data/atmosphere/transmittance_great.csv")
|
||||
atmosphere = Atmosphere(target, "tests/data/atmosphere/transmittance_great.csv")
|
||||
cosmic = CosmicBackground(atmosphere, temp=220 * u.K, emissivity=0.14)
|
||||
mirror = Mirror(cosmic, reflectance="data/mirror/reflectance_great.csv", emissivity=0.08, temp=230 * u.K)
|
||||
mirror = Mirror(cosmic, reflectance="tests/data/mirror/reflectance_great.csv", emissivity=0.08, temp=230 * u.K)
|
||||
heterodyne = Heterodyne(mirror, **self.heterodyne_args)
|
||||
sensitivity = heterodyne.getSensitivity(exp_time, snr, 10 * u.mag)
|
||||
self.assertAlmostEqual(sensitivity.value, 20)
|
||||
|
@ -10,15 +10,15 @@ from esbo_etc.classes.sensor.Imager import Imager
|
||||
|
||||
class TestImager(TestCase):
|
||||
def setUp(self):
|
||||
self.config = Configuration("data/esbo-etc_defaults.xml").conf
|
||||
self.config = Configuration("tests/data/esbo-etc_defaults.xml").conf
|
||||
self.imager_args = dict(quantum_efficiency=0.9 * u.electron / u.photon,
|
||||
pixel_geometry=np.array([1024, 1024]) << u.pix,
|
||||
pixel_size=6.5 * u.um, read_noise=1.4 * u.electron ** 0.5 / u.pix,
|
||||
dark_current=0.6 * u.electron / u.pix / u.second, well_capacity=30000 * u.electron,
|
||||
f_number=13, common_conf=self.config.common, center_offset=np.array([0, 0]) << u.pix,
|
||||
shape="circle", contained_energy="FWHM", contained_pixels=None)
|
||||
self.target = FileTarget("data/target/target_demo_1.csv", np.arange(200, 210) << u.nm)
|
||||
self.zodiac = StrayLight(self.target, "data/straylight/zodiacal_emission_1.csv")
|
||||
self.target = FileTarget("tests/data/target/target_demo_1.csv", np.arange(200, 210) << u.nm)
|
||||
self.zodiac = StrayLight(self.target, "tests/data/straylight/zodiacal_emission_1.csv")
|
||||
self.imager = Imager(self.zodiac, **self.imager_args)
|
||||
|
||||
def test_getSNR(self):
|
||||
@ -34,11 +34,11 @@ class TestImager(TestCase):
|
||||
def test_getSensitivity(self):
|
||||
exp_time = 100 * u.s
|
||||
target = BlackBodyTarget(np.arange(200, 210) << u.nm, mag=20 * u.mag)
|
||||
zodiac = StrayLight(target, "data/straylight/zodiacal_emission_1.csv")
|
||||
zodiac = StrayLight(target, "tests/data/straylight/zodiacal_emission_1.csv")
|
||||
imager = Imager(zodiac, **self.imager_args)
|
||||
snr = imager.getSNR(exp_time)
|
||||
target = BlackBodyTarget(np.arange(200, 210) << u.nm, mag=10 * u.mag)
|
||||
zodiac = StrayLight(target, "data/straylight/zodiacal_emission_1.csv")
|
||||
zodiac = StrayLight(target, "tests/data/straylight/zodiacal_emission_1.csv")
|
||||
imager = Imager(zodiac, **self.imager_args)
|
||||
sensitivity = imager.getSensitivity(exp_time, snr, 10 * u.mag)
|
||||
self.assertAlmostEqual(sensitivity.value, 20)
|
||||
|
@ -7,7 +7,7 @@ import numpy as np
|
||||
|
||||
class TestFileTarget(TestCase):
|
||||
def setUp(self):
|
||||
self.target = FileTarget("../data/target/target_demo_1.csv", np.arange(200, 210, 1) << u.nm)
|
||||
self.target = FileTarget("tests/data/target/target_demo_1.csv", np.arange(200, 210, 1) << u.nm)
|
||||
|
||||
def test_calcSignal(self):
|
||||
signal = SpectralQty(np.arange(200, 210, 1) << u.nm,
|
||||
|
@ -8,19 +8,22 @@ import astropy.units as u
|
||||
|
||||
class TestRadiantFactory(TestCase):
|
||||
def test_fromConfigBatch(self):
|
||||
conf = Configuration("data/esbo-etc_defaults.xml").conf
|
||||
conf = Configuration("tests/data/esbo-etc_defaults.xml").conf
|
||||
factory = RadiantFactory(conf.common.wl_bins())
|
||||
parent = factory.fromConfigBatch(conf)
|
||||
|
||||
parent_2 = BlackBodyTarget(conf.common.wl_bins(), 5778 * u.K, 10 * u.mag, "V")
|
||||
parent_2 = oc.Atmosphere(parent_2, "data/atmosphere/transmittance.csv", "data/atmosphere/emission.csv")
|
||||
parent_2 = oc.StrayLight(parent_2, "data/straylight/emission.csv")
|
||||
parent_2 = oc.Mirror(parent_2, "data/mirror/reflectance.csv", "data/mirror/emissivity.csv", 70 * u.K,
|
||||
obstruction=0.1, obstructor_temp=70 * u.K)
|
||||
parent_2 = oc.Mirror(parent_2, "data/mirror/reflectance.csv", "data/mirror/emissivity.csv", 70 * u.K)
|
||||
parent_2 = oc.Mirror(parent_2, "data/mirror/reflectance.csv", "data/mirror/emissivity.csv", 70 * u.K)
|
||||
parent_2 = oc.Filter.fromRange(parent_2, 400 * u.nm, 480 * u.nm, "data/filter/emissivity.csv", 70 * u.K)
|
||||
parent_2 = oc.Lens(parent_2, "data/lens/transmittance.csv", "data/lens/emissivity.csv", 70 * u.K)
|
||||
parent_2 = oc.Atmosphere(parent_2, "tests/data/atmosphere/transmittance.csv",
|
||||
"tests/data/atmosphere/emission.csv")
|
||||
parent_2 = oc.StrayLight(parent_2, "tests/data/straylight/emission.csv")
|
||||
parent_2 = oc.Mirror(parent_2, "tests/data/mirror/reflectance.csv",
|
||||
"tests/data/mirror/emissivity.csv", 70 * u.K, obstruction=0.1, obstructor_temp=70 * u.K)
|
||||
parent_2 = oc.Mirror(parent_2, "tests/data/mirror/reflectance.csv",
|
||||
"tests/data/mirror/emissivity.csv", 70 * u.K)
|
||||
parent_2 = oc.Mirror(parent_2, "tests/data/mirror/reflectance.csv",
|
||||
"tests/data/mirror/emissivity.csv", 70 * u.K)
|
||||
parent_2 = oc.Filter.fromRange(parent_2, 400 * u.nm, 480 * u.nm, "tests/data/filter/emissivity.csv", 70 * u.K)
|
||||
parent_2 = oc.Lens(parent_2, "tests/data/lens/transmittance.csv", "tests/data/lens/emissivity.csv", 70 * u.K)
|
||||
|
||||
self.assertEqual(parent.calcSignal()[0], parent_2.calcSignal()[0])
|
||||
self.assertEqual(parent.calcBackground(), parent_2.calcBackground())
|
||||
|
@ -144,12 +144,12 @@ class TestSpectralQty(TestCase):
|
||||
self.assertEqual(sqty_rebin, sqty_res)
|
||||
|
||||
def test_fromFile(self):
|
||||
sqty = SpectralQty.fromFile("data/target/target_demo_1.csv", u.nm, u.W / (u.m ** 2 * u.nm))
|
||||
sqty = SpectralQty.fromFile("tests/data/target/target_demo_1.csv", u.nm, u.W / (u.m ** 2 * u.nm))
|
||||
res = SpectralQty(np.arange(200, 210, 1) << u.nm,
|
||||
np.arange(1.1, 2.1, 0.1) * 1e-15 << u.W / (u.m ** 2 * u.nm))
|
||||
self.assertEqual(sqty, res)
|
||||
|
||||
sqty = SpectralQty.fromFile("data/target/target_demo_2.csv", u.nm, u.W / (u.m ** 2 * u.nm))
|
||||
sqty = SpectralQty.fromFile("tests/data/target/target_demo_2.csv", u.nm, u.W / (u.m ** 2 * u.nm))
|
||||
self.assertEqual(sqty, res)
|
||||
|
||||
def test_integrate(self):
|
||||
|
@ -5,7 +5,7 @@ import astropy.units as u
|
||||
|
||||
class TestConfiguration(TestCase):
|
||||
def setUp(self):
|
||||
self.config = Configuration("data/esbo-etc_defaults.xml")
|
||||
self.config = Configuration("tests/data/esbo-etc_defaults.xml")
|
||||
|
||||
def test_signal(self):
|
||||
self.assertTrue(isinstance(self.config.conf, Entry))
|
||||
|
Loading…
Reference in New Issue
Block a user