Test configuration reader
This commit is contained in:
parent
73f09eabe9
commit
f2145b6a93
55
tests/data/esbo-etc_defaults.xml
Normal file
55
tests/data/esbo-etc_defaults.xml
Normal file
@ -0,0 +1,55 @@
|
||||
<root>
|
||||
<common>
|
||||
<wl_min val="400" units="nanometer" comment="Shortest wavelength used for binning input spectra"/>
|
||||
<wl_max val="5" units="micron" comment="Shortest wavelength used for binning input spectra"/>
|
||||
<wl_delta val="10" units="nanometer" comment="Wavelength increment used for binning input spectra"/>
|
||||
<!-- <res val="1000" units=""-->
|
||||
<!-- comment="Resolving power for common spectral binning. A linear binning wavelength integral is estimated as wl_min/R"/>-->
|
||||
<d_aperture val="5" units="m" comment="Diameter of the telescope aperture"/>
|
||||
<jitter_rms val="0.1" units="arcsec" comment="Sigma RMS of the telescope jitter"/>
|
||||
<output_path val="output" comment="Output directory to store output files"/>
|
||||
</common>
|
||||
|
||||
<noise>
|
||||
<EnableJitter val="False"/>
|
||||
<EnableShotNoise val="True"/>
|
||||
<EnableReadoutNoise val="True"/>
|
||||
</noise>
|
||||
|
||||
<astroscene>
|
||||
<target type="BlackBodyTarget" val="5778" units="K" mag="10" band="G"
|
||||
comment="Modeling the sun as mag 10 star"/>
|
||||
<optical_component type="Atmosphere" transmissivity="data/atmosphere/transmittance.csv"
|
||||
emission="data/atmosphere/emission.csv" comment="Including the atmosphere"/>
|
||||
<optical_component type="StrayLight" emission="data/strayLight/emission.csv"
|
||||
comment="Including arbitrary noise sources"/>
|
||||
</astroscene>
|
||||
|
||||
<common_optics>
|
||||
<optical_component type="Mirror" reflectivity="data/mirror/reflectivity.csv"
|
||||
emissivity="data/mirror/emissivity.csv" val="70" units="K" comment="M1"/>
|
||||
<optical_component type="Mirror" reflectivity="data/mirror/reflectivity.csv"
|
||||
emissivity="data/mirror/emissivity.csv" val="70" units="K" comment="M2"/>
|
||||
<optical_component type="Mirror" reflectivity="data/mirror/reflectivity.csv"
|
||||
emissivity="data/mirror/emissivity.csv" val="70" units="K" comment="M3"/>
|
||||
<optical_component type="Filter" band="G"
|
||||
emissivity="data/filter/emissivity.csv" val="70" units="K" comment="Filter wheel"/>
|
||||
</common_optics>
|
||||
|
||||
<instrument>
|
||||
<optical_component type="Mirror" reflectivity="data/mirror/reflectivity.csv"
|
||||
emissivity="data/mirror/emissivity.csv" val="70" units="K" comment="M4"/>
|
||||
<optical_component type="Filter" band="G"
|
||||
emissivity="data/filter/emissivity.csv" val="70" units="K" comment="Filter wheel"/>
|
||||
<sensor type="CCD">
|
||||
<f_number val="18.5" units="" comment="The working f/#"/>
|
||||
<pixel_geometry val="1024, 1024" units="" comment="Pixel geometry"/>
|
||||
<pixel>
|
||||
<quantum_efficiency val="data/ccd/qe.csv" comment="Quantum efficiency of the detector pixel"/>
|
||||
<pixel_size val="15" units="micron"/>
|
||||
<dark_current val="20" units="1/s" comment="Detector dark current"/>
|
||||
<sigma_read_out val="10.0" units="" comment="Detector readout noise in e-rms"/>
|
||||
</pixel>
|
||||
</sensor>
|
||||
</instrument>
|
||||
</root>
|
16
tests/test_config.py
Normal file
16
tests/test_config.py
Normal file
@ -0,0 +1,16 @@
|
||||
from unittest import TestCase
|
||||
from esbo_etc.classes.config import Configuration, Entry
|
||||
import astropy.units as u
|
||||
|
||||
|
||||
class TestConfiguration(TestCase):
|
||||
def setUp(self):
|
||||
self.config = Configuration("data/esbo-etc_defaults.xml")
|
||||
|
||||
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",
|
||||
"wl_bins"}.issubset(self.config.conf.common.__dir__()))
|
||||
self.assertTrue(self.config.conf.common.wl_min().unit.is_equivalent(u.meter))
|
Loading…
x
Reference in New Issue
Block a user