ESBO-ETC/tests/target/test_BlackBodyTarget.py

21 lines
945 B
Python
Raw Normal View History

2020-04-08 17:31:55 +02:00
from unittest import TestCase
from esbo_etc.classes.target.BlackBodyTarget import BlackBodyTarget
from esbo_etc.classes.SpectralQty import SpectralQty
import numpy as np
import astropy.units as u
class TestBlackBodyTarget(TestCase):
def setUp(self):
self.target = BlackBodyTarget(wl_bins=np.arange(400, 800, 100) * u.nm,
temp=5778 * u.K, mag=10 * u.mag, band="U")
def test_signal(self):
2020-04-17 09:57:52 +02:00
signal = SpectralQty(np.arange(400, 800, 100) << u.nm, np.array([4.77851291e-15, 5.46505832e-15, 5.08243077e-15,
4.31009246e-15]) << u.W / (u.m ** 2 * u.nm))
2020-04-08 17:31:55 +02:00
self.assertTrue(self.target.calcSignal().__eq__(signal))
def test_noise(self):
2020-04-17 09:57:52 +02:00
noise = SpectralQty(np.arange(400, 800, 100) << u.nm, np.repeat(0, 4) << u.W / (u.m ** 2 * u.nm * u.sr))
2020-04-08 17:31:55 +02:00
self.assertEqual(self.target.calcNoise(), noise)