2020-04-15 17:14:47 +02:00
|
|
|
from unittest import TestCase
|
|
|
|
from esbo_etc.classes.optical_component.BeamSplitter import BeamSplitter
|
|
|
|
from esbo_etc.classes.SpectralQty import SpectralQty
|
|
|
|
from esbo_etc.classes.target.FileTarget import FileTarget
|
|
|
|
import astropy.units as u
|
|
|
|
import numpy as np
|
|
|
|
|
|
|
|
|
|
|
|
class TestBeamSplitter(TestCase):
|
|
|
|
wl = np.arange(201, 205, 1) << u.nm
|
|
|
|
|
|
|
|
def setUp(self):
|
2020-04-16 15:12:44 +02:00
|
|
|
self.target = FileTarget("data/target/target_demo_1.csv", self.wl)
|
2020-04-15 17:20:50 +02:00
|
|
|
self.splitter = BeamSplitter(self.target, "data/beamsplitter/beamsplitter_transmittance.csv", 0.5,
|
|
|
|
temp=300 * u.K)
|
2020-04-15 17:14:47 +02:00
|
|
|
|
|
|
|
def test___init__(self):
|
2020-04-24 17:10:08 +02:00
|
|
|
self.assertEqual(self.splitter.calcBackground(),
|
2020-04-17 09:57:13 +02:00
|
|
|
SpectralQty(self.wl, np.array([4.31413931e-96, 1.37122214e-95, 4.30844544e-95,
|
|
|
|
1.33846280e-94]) << u.W / (u.m ** 2 * u.nm * u.sr)))
|
2020-04-28 17:21:26 +02:00
|
|
|
self.assertEqual(self.splitter.calcSignal()[0],
|
2020-04-17 09:57:13 +02:00
|
|
|
SpectralQty(np.arange(200, 210, 1) << u.nm,
|
|
|
|
np.array([0, 1.20e-15, 1.30e-15, 1.40e-15, 1.35e-15, 0, 0, 0, 0, 0]) << u.W /
|
|
|
|
(u.m ** 2 * u.nm)))
|