ESBO-ETC/tests/target/test_FileTarget.py

21 lines
840 B
Python
Raw Normal View History

2020-04-08 13:38:48 +02:00
from unittest import TestCase
from esbo_etc.classes.target.FileTarget import FileTarget
from esbo_etc.classes.SpectralQty import SpectralQty
import astropy.units as u
import numpy as np
class TestFileTarget(TestCase):
def setUp(self):
self.target = FileTarget("../data/target/target_demo_1.csv", np.arange(200, 210, 1) << u.nm)
2020-04-08 13:38:48 +02:00
def test_calcSignal(self):
2020-04-08 17:30:25 +02:00
signal = SpectralQty(np.arange(200, 210, 1) << u.nm,
2020-05-08 17:21:33 +02:00
np.arange(1.1e-15, 2.0e-15, 1e-16) << u.W / (u.m ** 2 * u.nm))
self.assertEqual(self.target.calcSignal(), (signal, "Point", 0.0))
2020-04-08 13:38:48 +02:00
def test_calcBackground(self):
2020-04-08 17:30:25 +02:00
noise = SpectralQty(np.arange(200, 210, 1) << u.nm,
2020-04-17 09:57:52 +02:00
np.repeat(0, 10) << u.W / (u.m ** 2 * u.nm * u.sr))
self.assertEqual(self.target.calcBackground(), noise)