2020-04-21 14:46:02 +02:00
|
|
|
from unittest import TestCase
|
2020-05-08 15:06:44 +02:00
|
|
|
from esbo_etc.classes.Config import Configuration
|
2020-09-10 15:03:57 +02:00
|
|
|
from esbo_etc.classes.optical_component.OpticalComponentFactory import OpticalComponentFactory
|
|
|
|
from esbo_etc.classes.target.TargetFactory import TargetFactory
|
2020-04-21 14:46:02 +02:00
|
|
|
import esbo_etc.classes.optical_component as oc
|
|
|
|
from esbo_etc.classes.target import BlackBodyTarget
|
|
|
|
import astropy.units as u
|
|
|
|
|
|
|
|
|
|
|
|
class TestRadiantFactory(TestCase):
|
2020-04-24 11:42:35 +02:00
|
|
|
def test_fromConfigBatch(self):
|
2020-07-21 15:37:49 +02:00
|
|
|
conf = Configuration("tests/data/esbo-etc_defaults.xml").conf
|
2020-09-10 15:03:57 +02:00
|
|
|
target_factory = TargetFactory(conf.common)
|
|
|
|
oc_factory = OpticalComponentFactory(conf.common)
|
|
|
|
parent = target_factory.create(conf.astroscene.target)
|
|
|
|
parent = oc_factory.fromConfigBatch(conf, parent)
|
2020-04-21 14:46:02 +02:00
|
|
|
|
|
|
|
parent_2 = BlackBodyTarget(conf.common.wl_bins(), 5778 * u.K, 10 * u.mag, "V")
|
2020-09-30 21:53:09 +02:00
|
|
|
parent_2 = oc.Atmosphere(parent=parent_2, transmittance="tests/data/atmosphere/transmittance.csv",
|
|
|
|
emission="tests/data/atmosphere/emission.csv")
|
2020-07-21 15:37:49 +02:00
|
|
|
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)
|
2020-09-12 11:51:49 +02:00
|
|
|
parent_2 = oc.Filter(parent=parent_2, start=400 * u.nm, end=480 * u.nm,
|
|
|
|
emissivity="tests/data/filter/emissivity.csv", temp=70 * u.K)
|
2020-07-21 15:37:49 +02:00
|
|
|
parent_2 = oc.Lens(parent_2, "tests/data/lens/transmittance.csv", "tests/data/lens/emissivity.csv", 70 * u.K)
|
2020-04-21 14:46:02 +02:00
|
|
|
|
2020-05-08 15:06:44 +02:00
|
|
|
self.assertEqual(parent.calcSignal()[0], parent_2.calcSignal()[0])
|
2020-04-24 17:10:08 +02:00
|
|
|
self.assertEqual(parent.calcBackground(), parent_2.calcBackground())
|