Tests updated
This commit is contained in:
parent
35488b4fb5
commit
da21b14d43
@ -1,4 +1,6 @@
|
|||||||
from unittest import TestCase
|
from unittest import TestCase
|
||||||
|
|
||||||
|
from esbo_etc import Entry
|
||||||
from esbo_etc.classes.optical_component.AHotOpticalComponent import AHotOpticalComponent
|
from esbo_etc.classes.optical_component.AHotOpticalComponent import AHotOpticalComponent
|
||||||
from esbo_etc.classes.IRadiant import IRadiant
|
from esbo_etc.classes.IRadiant import IRadiant
|
||||||
from esbo_etc.classes.SpectralQty import SpectralQty
|
from esbo_etc.classes.SpectralQty import SpectralQty
|
||||||
@ -16,6 +18,10 @@ class HotOpticalComponent(AHotOpticalComponent):
|
|||||||
def _propagate(self, sqty: SpectralQty) -> SpectralQty:
|
def _propagate(self, sqty: SpectralQty) -> SpectralQty:
|
||||||
return sqty
|
return sqty
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def check_config(conf: Entry) -> Union[None, str]:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TestAHotOpticalComponent(TestCase):
|
class TestAHotOpticalComponent(TestCase):
|
||||||
wl = np.arange(201, 205, 1) << u.nm
|
wl = np.arange(201, 205, 1) << u.nm
|
||||||
|
@ -10,6 +10,10 @@ class OpticalComponent(AOpticalComponent):
|
|||||||
obstructor_emissivity: float = 0):
|
obstructor_emissivity: float = 0):
|
||||||
super().__init__(parent, transreflectivity, noise, obstruction, obstructor_temp, obstructor_emissivity)
|
super().__init__(parent, transreflectivity, noise, obstruction, obstructor_temp, obstructor_emissivity)
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def check_config(conf: Entry) -> Union[None, str]:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
class TestAOpticalComponent(TestCase):
|
class TestAOpticalComponent(TestCase):
|
||||||
wl = np.arange(4, 8, 1) << u.um
|
wl = np.arange(4, 8, 1) << u.um
|
||||||
|
@ -5,7 +5,7 @@ import astropy.units as u
|
|||||||
|
|
||||||
class TestAiry(TestCase):
|
class TestAiry(TestCase):
|
||||||
def setUp(self):
|
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):
|
def test_calc_reduced_observation_angle(self):
|
||||||
self.assertAlmostEqual(self.airy.calcReducedObservationAngle("peak").value, 0.0)
|
self.assertAlmostEqual(self.airy.calcReducedObservationAngle("peak").value, 0.0)
|
||||||
|
@ -5,7 +5,7 @@ import astropy.units as u
|
|||||||
|
|
||||||
class TestZemax(TestCase):
|
class TestZemax(TestCase):
|
||||||
def setUp(self):
|
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):
|
def test_calcReducedObservationAngle(self):
|
||||||
self.assertAlmostEqual(self.zemax.calcReducedObservationAngle(0.6595336151196701).value, 0.08284705528846155)
|
self.assertAlmostEqual(self.zemax.calcReducedObservationAngle(0.6595336151196701).value, 0.08106259728314079)
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from unittest import TestCase
|
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
|
from esbo_etc.classes.RadiantFactory import RadiantFactory
|
||||||
import esbo_etc.classes.optical_component as oc
|
import esbo_etc.classes.optical_component as oc
|
||||||
from esbo_etc.classes.target import BlackBodyTarget
|
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.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.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())
|
self.assertEqual(parent.calcBackground(), parent_2.calcBackground())
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
from unittest import TestCase
|
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
|
import astropy.units as u
|
||||||
|
|
||||||
|
|
||||||
@ -10,7 +10,7 @@ class TestConfiguration(TestCase):
|
|||||||
def test_signal(self):
|
def test_signal(self):
|
||||||
self.assertTrue(isinstance(self.config.conf, Entry))
|
self.assertTrue(isinstance(self.config.conf, Entry))
|
||||||
self.assertTrue(
|
self.assertTrue(
|
||||||
{"common", "noise", "astroscene", "common_optics", "instrument"}.issubset(self.config.conf.__dir__()))
|
{"common", "astroscene", "common_optics", "instrument"}.issubset(self.config.conf.__dir__()))
|
||||||
self.assertTrue({"wl_min", "wl_max", "wl_delta", "d_aperture", "jitter_rms", "output_path",
|
self.assertTrue({"wl_min", "wl_max", "wl_delta", "d_aperture", "jitter_sigma", "output_path",
|
||||||
"wl_bins"}.issubset(self.config.conf.common.__dir__()))
|
"wl_bins"}.issubset(self.config.conf.common.__dir__()))
|
||||||
self.assertTrue(self.config.conf.common.wl_min().unit.is_equivalent(u.meter))
|
self.assertTrue(self.config.conf.common.wl_min().unit.is_equivalent(u.meter))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user