Tests updated

This commit is contained in:
Lukas Klass 2020-05-08 15:06:44 +02:00
parent 35488b4fb5
commit da21b14d43
6 changed files with 18 additions and 8 deletions

View File

@ -1,4 +1,6 @@
from unittest import TestCase
from esbo_etc import Entry
from esbo_etc.classes.optical_component.AHotOpticalComponent import AHotOpticalComponent
from esbo_etc.classes.IRadiant import IRadiant
from esbo_etc.classes.SpectralQty import SpectralQty
@ -16,6 +18,10 @@ class HotOpticalComponent(AHotOpticalComponent):
def _propagate(self, sqty: SpectralQty) -> SpectralQty:
return sqty
@staticmethod
def check_config(conf: Entry) -> Union[None, str]:
pass
class TestAHotOpticalComponent(TestCase):
wl = np.arange(201, 205, 1) << u.nm

View File

@ -10,6 +10,10 @@ class OpticalComponent(AOpticalComponent):
obstructor_emissivity: float = 0):
super().__init__(parent, transreflectivity, noise, obstruction, obstructor_temp, obstructor_emissivity)
@staticmethod
def check_config(conf: Entry) -> Union[None, str]:
pass
class TestAOpticalComponent(TestCase):
wl = np.arange(4, 8, 1) << u.um

View File

@ -5,7 +5,7 @@ import astropy.units as u
class TestAiry(TestCase):
def setUp(self):
self.airy = Airy(4 * u.um, 0.5 * u.m)
self.airy = Airy(13, 4 * u.um, 0.5 * u.m, 10, 6.5 * u.nm)
def test_calc_reduced_observation_angle(self):
self.assertAlmostEqual(self.airy.calcReducedObservationAngle("peak").value, 0.0)

View File

@ -5,7 +5,7 @@ import astropy.units as u
class TestZemax(TestCase):
def setUp(self):
self.zemax = Zemax("data/psf.txt", 13, 4 * u.um, 0.5 * u.m)
self.zemax = Zemax("data/psf.txt", 13, 4 * u.um, 0.5 * u.m, 13, 6.5 * u.um)
def test_calcReducedObservationAngle(self):
self.assertAlmostEqual(self.zemax.calcReducedObservationAngle(0.6595336151196701).value, 0.08284705528846155)
self.assertAlmostEqual(self.zemax.calcReducedObservationAngle(0.6595336151196701).value, 0.08106259728314079)

View File

@ -1,5 +1,5 @@
from unittest import TestCase
from esbo_etc.classes.config import Configuration
from esbo_etc.classes.Config import Configuration
from esbo_etc.classes.RadiantFactory import RadiantFactory
import esbo_etc.classes.optical_component as oc
from esbo_etc.classes.target import BlackBodyTarget
@ -22,5 +22,5 @@ class TestRadiantFactory(TestCase):
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)
self.assertEqual(parent.calcSignal(), parent_2.calcSignal())
self.assertEqual(parent.calcSignal()[0], parent_2.calcSignal()[0])
self.assertEqual(parent.calcBackground(), parent_2.calcBackground())

View File

@ -1,5 +1,5 @@
from unittest import TestCase
from esbo_etc.classes.config import Configuration, Entry
from esbo_etc.classes.Config import Configuration, Entry
import astropy.units as u
@ -10,7 +10,7 @@ class TestConfiguration(TestCase):
def test_signal(self):
self.assertTrue(isinstance(self.config.conf, Entry))
self.assertTrue(
{"common", "noise", "astroscene", "common_optics", "instrument"}.issubset(self.config.conf.__dir__()))
self.assertTrue({"wl_min", "wl_max", "wl_delta", "d_aperture", "jitter_rms", "output_path",
{"common", "astroscene", "common_optics", "instrument"}.issubset(self.config.conf.__dir__()))
self.assertTrue({"wl_min", "wl_max", "wl_delta", "d_aperture", "jitter_sigma", "output_path",
"wl_bins"}.issubset(self.config.conf.common.__dir__()))
self.assertTrue(self.config.conf.common.wl_min().unit.is_equivalent(u.meter))