25 lines
1.3 KiB
Python
25 lines
1.3 KiB
Python
|
from unittest import TestCase
|
||
|
from esbo_etc import CosmicBackground, BlackBodyTarget, SpectralQty
|
||
|
import numpy as np
|
||
|
import astropy.units as u
|
||
|
|
||
|
|
||
|
class TestBlackBodyTarget(TestCase):
|
||
|
def setUp(self):
|
||
|
self.target = BlackBodyTarget(np.arange(100, 105) * u.um)
|
||
|
self.cosmic = CosmicBackground(self.target)
|
||
|
|
||
|
def test_calcSignal(self):
|
||
|
print(self.cosmic.calcSignal()[0])
|
||
|
self.assertTrue(self.cosmic.calcSignal()[0] == SpectralQty(np.arange(100, 105) * u.um,
|
||
|
np.array([6.65e-19, 6.391e-19, 6.145e-19, 5.91e-19,
|
||
|
5.687e-19]) << u.W / (u.m ** 2 * u.nm)))
|
||
|
|
||
|
def test_calcBackground(self):
|
||
|
print(self.cosmic.calcBackground())
|
||
|
self.assertTrue(self.cosmic.calcBackground() == SpectralQty(np.arange(100, 105) * u.um,
|
||
|
np.array(
|
||
|
[1.398e-28, 2.244e-28, 3.566e-28, 5.614e-28,
|
||
|
8.756e-28]) << u.W / (
|
||
|
u.m ** 2 * u.nm * u.sr)))
|