2020-04-14 14:30:02 +02:00
|
|
|
from unittest import TestCase
|
|
|
|
from esbo_etc import Atmosphere, FileTarget, SpectralQty
|
|
|
|
import numpy as np
|
|
|
|
import astropy.units as u
|
|
|
|
|
|
|
|
|
|
|
|
class TestAtmosphere(TestCase):
|
|
|
|
def setUp(self):
|
2020-04-16 15:12:44 +02:00
|
|
|
self.target = FileTarget("data/target/target_demo_1.csv", np.arange(200, 208) << u.nm)
|
2020-04-14 14:30:02 +02:00
|
|
|
self.atmosphere = Atmosphere(self.target, "data/atmosphere/atmosphere_transmittance_1.csv",
|
|
|
|
"data/atmosphere/atmosphere_emission_1.csv")
|
|
|
|
|
|
|
|
def test_calcSignal(self):
|
2020-04-28 17:21:26 +02:00
|
|
|
self.assertEqual(self.atmosphere.calcSignal()[0],
|
2020-04-17 09:57:13 +02:00
|
|
|
SpectralQty(np.arange(200, 210) << u.nm,
|
|
|
|
np.array([1.10e-15, 1.20e-15, 1.30e-15, 1.26e-15, 1.20e-15, 1.12e-15, 1.02e-15,
|
|
|
|
0.9e-15, 0, 0]) << u.W / (u.m ** 2 * u.nm)))
|
2020-04-14 14:30:02 +02:00
|
|
|
|
2020-04-24 17:10:08 +02:00
|
|
|
def test_calcBackgrounde(self):
|
|
|
|
self.assertEqual(self.atmosphere.calcBackground(),
|
2020-04-17 09:57:13 +02:00
|
|
|
SpectralQty(np.arange(200, 208) << u.nm,
|
|
|
|
np.array([1.1e-16, 1.2e-16, 1.3e-16, 1.4e-16, 1.5e-16, 1.6e-16, 1.7e-16,
|
|
|
|
1.8e-16]) << u.W / (u.m ** 2 * u.nm * u.sr)))
|