calcNoise() renamed to calcBackground()
This commit is contained in:
parent
1d6c2b20c4
commit
17d7a12434
@ -66,27 +66,27 @@ class AOpticalComponent(IRadiant):
|
|||||||
debug(signal)
|
debug(signal)
|
||||||
return signal
|
return signal
|
||||||
|
|
||||||
def calcNoise(self) -> SpectralQty:
|
def calcBackground(self) -> SpectralQty:
|
||||||
"""
|
"""
|
||||||
Calculate the spectral radiance of the target's noise
|
Calculate the spectral radiance of the background
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
noise : SpectralQty
|
background : SpectralQty
|
||||||
The spectral radiance of the target's noise
|
The spectral radiance of the background
|
||||||
"""
|
"""
|
||||||
parent = self.__parent.calcNoise()
|
parent = self.__parent.calcBackground()
|
||||||
info("Calculating Noise for class '" + self.__class__.__name__ + "'.")
|
info("Calculating Noise for class '" + self.__class__.__name__ + "'.")
|
||||||
parent = self._propagate(parent)
|
parent = self._propagate(parent)
|
||||||
if self.__obstructor_temp > 0 * u.K:
|
if self.__obstructor_temp > 0 * u.K:
|
||||||
bb = BlackBody(temperature=self.__obstructor_temp, scale=1. * u.W / (u.m ** 2 * u.nm * u.sr))
|
bb = BlackBody(temperature=self.__obstructor_temp, scale=1. * u.W / (u.m ** 2 * u.nm * u.sr))
|
||||||
obstructor = bb(parent.wl) * self.__obstructor_emissivity
|
obstructor = bb(parent.wl) * self.__obstructor_emissivity
|
||||||
noise = parent * (1. - self.__obstruction) + obstructor * self.__obstruction
|
background = parent * (1. - self.__obstruction) + obstructor * self.__obstruction
|
||||||
else:
|
else:
|
||||||
noise = parent * (1. - self.__obstruction)
|
background = parent * (1. - self.__obstruction)
|
||||||
noise = noise + self._ownNoise()
|
background = background + self._ownNoise()
|
||||||
debug(noise)
|
debug(background)
|
||||||
return noise
|
return background
|
||||||
|
|
||||||
def _propagate(self, rad: SpectralQty) -> SpectralQty:
|
def _propagate(self, rad: SpectralQty) -> SpectralQty:
|
||||||
"""
|
"""
|
||||||
|
@ -25,19 +25,19 @@ class ATarget(IRadiant):
|
|||||||
self.__sfd = sfd
|
self.__sfd = sfd
|
||||||
self.__wl_bins = wl_bins
|
self.__wl_bins = wl_bins
|
||||||
|
|
||||||
def calcNoise(self) -> SpectralQty:
|
def calcBackground(self) -> SpectralQty:
|
||||||
"""
|
"""
|
||||||
Calculate the spectral radiance of the target's noise
|
Calculate the spectral radiance of the target's background
|
||||||
|
|
||||||
Returns
|
Returns
|
||||||
-------
|
-------
|
||||||
noise : SpectralQty
|
background : SpectralQty
|
||||||
The spectral radiance of the target's noise
|
The spectral radiance of the target's background
|
||||||
"""
|
"""
|
||||||
info("Calculating Noise for class '" + self.__class__.__name__ + "'.")
|
info("Calculating Noise for class '" + self.__class__.__name__ + "'.")
|
||||||
noise = SpectralQty(self.__wl_bins, np.repeat(0, len(self.__wl_bins)) << u.W / (u.m**2 * u.nm * u.sr))
|
background = SpectralQty(self.__wl_bins, np.repeat(0, len(self.__wl_bins)) << u.W / (u.m**2 * u.nm * u.sr))
|
||||||
debug(noise)
|
debug(background)
|
||||||
return noise
|
return background
|
||||||
|
|
||||||
def calcSignal(self) -> SpectralQty:
|
def calcSignal(self) -> SpectralQty:
|
||||||
"""
|
"""
|
||||||
|
@ -26,11 +26,11 @@ class TestAHotOpticalComponent(TestCase):
|
|||||||
def test___init__(self):
|
def test___init__(self):
|
||||||
comp = HotOpticalComponent(self.target, SpectralQty(self.wl, np.repeat(0.5, 4) << u.dimensionless_unscaled),
|
comp = HotOpticalComponent(self.target, SpectralQty(self.wl, np.repeat(0.5, 4) << u.dimensionless_unscaled),
|
||||||
temp=300 * u.K)
|
temp=300 * u.K)
|
||||||
self.assertEqual(comp.calcNoise(),
|
self.assertEqual(comp.calcBackground(),
|
||||||
SpectralQty(self.wl, np.array([4.31413931e-96, 1.37122214e-95, 4.30844544e-95,
|
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)))
|
1.33846280e-94]) << u.W / (u.m ** 2 * u.nm * u.sr)))
|
||||||
|
|
||||||
comp = HotOpticalComponent(self.target, "data/mirror/mirror_emissivity.csv", temp=300 * u.K)
|
comp = HotOpticalComponent(self.target, "data/mirror/mirror_emissivity.csv", temp=300 * u.K)
|
||||||
self.assertEqual(comp.calcNoise(),
|
self.assertEqual(comp.calcBackground(),
|
||||||
SpectralQty(self.wl, np.array([4.31413931e-96, 1.37122214e-95, 4.30844544e-95,
|
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)))
|
1.33846280e-94]) << u.W / (u.m ** 2 * u.nm * u.sr)))
|
||||||
|
@ -25,13 +25,13 @@ class TestAOpticalComponent(TestCase):
|
|||||||
SpectralQty(self.wl, np.array([1.29074440e-17, 5.65909989e-18, 2.85372997e-18,
|
SpectralQty(self.wl, np.array([1.29074440e-17, 5.65909989e-18, 2.85372997e-18,
|
||||||
1.58973516e-18]) << u.W / (u.m ** 2 * u.nm)))
|
1.58973516e-18]) << u.W / (u.m ** 2 * u.nm)))
|
||||||
|
|
||||||
def test_calcNoise(self):
|
def test_calcBackground(self):
|
||||||
self.assertEqual(self.comp.calcNoise(),
|
self.assertEqual(self.comp.calcBackground(),
|
||||||
SpectralQty(self.wl, np.array([8.21976423e-05, 2.70268340e-04, 5.27503292e-04,
|
SpectralQty(self.wl, np.array([8.21976423e-05, 2.70268340e-04, 5.27503292e-04,
|
||||||
7.60597616e-04]) << u.W / (u.m ** 2 * u.nm * u.sr)))
|
7.60597616e-04]) << u.W / (u.m ** 2 * u.nm * u.sr)))
|
||||||
comp = OpticalComponent(self.comp, SpectralQty(self.wl, np.repeat(0.5, 4) << u.dimensionless_unscaled),
|
comp = OpticalComponent(self.comp, SpectralQty(self.wl, np.repeat(0.5, 4) << u.dimensionless_unscaled),
|
||||||
SpectralQty(self.wl, np.repeat(0, 4) << u.W / (u.m ** 2 * u.nm * u.sr)),
|
SpectralQty(self.wl, np.repeat(0, 4) << u.W / (u.m ** 2 * u.nm * u.sr)),
|
||||||
obstruction=0.1, obstructor_temp=300 * u.K, obstructor_emissivity=1)
|
obstruction=0.1, obstructor_temp=300 * u.K, obstructor_emissivity=1)
|
||||||
self.assertEqual(comp.calcNoise(),
|
self.assertEqual(comp.calcBackground(),
|
||||||
SpectralQty(self.wl, np.array([1.09186581e-04, 3.81889092e-04, 7.54879773e-04,
|
SpectralQty(self.wl, np.array([1.09186581e-04, 3.81889092e-04, 7.54879773e-04,
|
||||||
10.92866544e-04]) << u.W / (u.m ** 2 * u.nm * u.sr)))
|
10.92866544e-04]) << u.W / (u.m ** 2 * u.nm * u.sr)))
|
||||||
|
@ -16,8 +16,8 @@ class TestAtmosphere(TestCase):
|
|||||||
np.array([1.10e-15, 1.20e-15, 1.30e-15, 1.26e-15, 1.20e-15, 1.12e-15, 1.02e-15,
|
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)))
|
0.9e-15, 0, 0]) << u.W / (u.m ** 2 * u.nm)))
|
||||||
|
|
||||||
def test_calcNoise(self):
|
def test_calcBackgrounde(self):
|
||||||
self.assertEqual(self.atmosphere.calcNoise(),
|
self.assertEqual(self.atmosphere.calcBackground(),
|
||||||
SpectralQty(np.arange(200, 208) << u.nm,
|
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,
|
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)))
|
1.8e-16]) << u.W / (u.m ** 2 * u.nm * u.sr)))
|
||||||
|
@ -15,7 +15,7 @@ class TestBeamSplitter(TestCase):
|
|||||||
temp=300 * u.K)
|
temp=300 * u.K)
|
||||||
|
|
||||||
def test___init__(self):
|
def test___init__(self):
|
||||||
self.assertEqual(self.splitter.calcNoise(),
|
self.assertEqual(self.splitter.calcBackground(),
|
||||||
SpectralQty(self.wl, np.array([4.31413931e-96, 1.37122214e-95, 4.30844544e-95,
|
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)))
|
1.33846280e-94]) << u.W / (u.m ** 2 * u.nm * u.sr)))
|
||||||
self.assertEqual(self.splitter.calcSignal(),
|
self.assertEqual(self.splitter.calcSignal(),
|
||||||
|
@ -14,7 +14,7 @@ class TestLens(TestCase):
|
|||||||
self.lens = Lens(self.target, "data/lens/lens_transmittance.csv", 0.5, temp=300 * u.K)
|
self.lens = Lens(self.target, "data/lens/lens_transmittance.csv", 0.5, temp=300 * u.K)
|
||||||
|
|
||||||
def test___init__(self):
|
def test___init__(self):
|
||||||
self.assertEqual(self.lens.calcNoise(),
|
self.assertEqual(self.lens.calcBackground(),
|
||||||
SpectralQty(self.wl, np.array([4.31413931e-96, 1.37122214e-95, 4.30844544e-95,
|
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)))
|
1.33846280e-94]) << u.W / (u.m ** 2 * u.nm * u.sr)))
|
||||||
self.assertEqual(self.lens.calcSignal(),
|
self.assertEqual(self.lens.calcSignal(),
|
||||||
|
@ -14,7 +14,7 @@ class TestMirror(TestCase):
|
|||||||
self.mirror = Mirror(self.target, "data/mirror/mirror_reflectance.csv", 0.5, temp=300 * u.K)
|
self.mirror = Mirror(self.target, "data/mirror/mirror_reflectance.csv", 0.5, temp=300 * u.K)
|
||||||
|
|
||||||
def test___init__(self):
|
def test___init__(self):
|
||||||
self.assertEqual(self.mirror.calcNoise(),
|
self.assertEqual(self.mirror.calcBackground(),
|
||||||
SpectralQty(self.wl, np.array([4.31413931e-96, 1.37122214e-95, 4.30844544e-95,
|
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)))
|
1.33846280e-94]) << u.W / (u.m ** 2 * u.nm * u.sr)))
|
||||||
self.assertEqual(self.mirror.calcSignal(),
|
self.assertEqual(self.mirror.calcSignal(),
|
||||||
|
@ -15,8 +15,8 @@ class TestStrayLight(TestCase):
|
|||||||
1.6e-15, 1.7e-15, 1.8e-15, 1.9e-15,
|
1.6e-15, 1.7e-15, 1.8e-15, 1.9e-15,
|
||||||
2.0e-15]) << u.W / (u.m ** 2 * u.nm)))
|
2.0e-15]) << u.W / (u.m ** 2 * u.nm)))
|
||||||
|
|
||||||
def test_calcNoise(self):
|
def test_calcBackground(self):
|
||||||
self.assertEqual(self.zodiac.calcNoise(),
|
self.assertEqual(self.zodiac.calcBackground(),
|
||||||
SpectralQty(np.arange(200, 210) << u.nm, np.array([1.1e-16, 1.2e-16, 1.3e-16, 1.4e-16, 1.5e-16,
|
SpectralQty(np.arange(200, 210) << 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, 1.9e-16,
|
1.6e-16, 1.7e-16, 1.8e-16, 1.9e-16,
|
||||||
2.0e-16]) << u.W /
|
2.0e-16]) << u.W /
|
||||||
|
@ -10,12 +10,11 @@ class TestBlackBodyTarget(TestCase):
|
|||||||
self.target = BlackBodyTarget(wl_bins=np.arange(400, 800, 100) * u.nm,
|
self.target = BlackBodyTarget(wl_bins=np.arange(400, 800, 100) * u.nm,
|
||||||
temp=5778 * u.K, mag=10 * u.mag, band="U")
|
temp=5778 * u.K, mag=10 * u.mag, band="U")
|
||||||
|
|
||||||
def test_signal(self):
|
def test_calcSignal(self):
|
||||||
signal = SpectralQty(np.arange(400, 800, 100) << u.nm, np.array([4.91164694e-15, 5.61732017e-15, 5.22403225e-15,
|
signal = SpectralQty(np.arange(400, 800, 100) << u.nm, np.array([4.91164694e-15, 5.61732017e-15, 5.22403225e-15,
|
||||||
4.43017583e-15]) << u.W / (u.m ** 2 * u.nm))
|
4.43017583e-15]) << u.W / (u.m ** 2 * u.nm))
|
||||||
print(self.target.calcSignal().qty)
|
|
||||||
self.assertEqual(self.target.calcSignal(), signal)
|
self.assertEqual(self.target.calcSignal(), signal)
|
||||||
|
|
||||||
def test_noise(self):
|
def test_calcBackground(self):
|
||||||
noise = SpectralQty(np.arange(400, 800, 100) << u.nm, np.repeat(0, 4) << u.W / (u.m ** 2 * u.nm * u.sr))
|
noise = SpectralQty(np.arange(400, 800, 100) << u.nm, np.repeat(0, 4) << u.W / (u.m ** 2 * u.nm * u.sr))
|
||||||
self.assertEqual(self.target.calcNoise(), noise)
|
self.assertEqual(self.target.calcBackground(), noise)
|
||||||
|
@ -9,12 +9,12 @@ class TestFileTarget(TestCase):
|
|||||||
def setUp(self):
|
def setUp(self):
|
||||||
self.target = FileTarget("../data/target/target_demo_1.csv", np.arange(200, 210, 1) << u.nm)
|
self.target = FileTarget("../data/target/target_demo_1.csv", np.arange(200, 210, 1) << u.nm)
|
||||||
|
|
||||||
def test_signal(self):
|
def test_calcSignal(self):
|
||||||
signal = SpectralQty(np.arange(200, 210, 1) << u.nm,
|
signal = SpectralQty(np.arange(200, 210, 1) << u.nm,
|
||||||
np.arange(1.1e-15, 2.0e-15, 1e-16) << u.W / (u.m ** 2 * u.nm))
|
np.arange(1.1e-15, 2.0e-15, 1e-16) << u.W / (u.m ** 2 * u.nm))
|
||||||
self.assertTrue(self.target.calcSignal().__eq__(signal))
|
self.assertTrue(self.target.calcSignal().__eq__(signal))
|
||||||
|
|
||||||
def test_noise(self):
|
def test_calcBackground(self):
|
||||||
noise = SpectralQty(np.arange(200, 210, 1) << u.nm,
|
noise = SpectralQty(np.arange(200, 210, 1) << u.nm,
|
||||||
np.repeat(0, 10) << u.W / (u.m ** 2 * u.nm * u.sr))
|
np.repeat(0, 10) << u.W / (u.m ** 2 * u.nm * u.sr))
|
||||||
self.assertEqual(self.target.calcNoise(), noise)
|
self.assertEqual(self.target.calcBackground(), noise)
|
||||||
|
@ -23,4 +23,4 @@ class TestRadiantFactory(TestCase):
|
|||||||
parent_2 = oc.Lens(parent_2, "data/lens/transmittance.csv", "data/lens/emissivity.csv", 70 * u.K)
|
parent_2 = oc.Lens(parent_2, "data/lens/transmittance.csv", "data/lens/emissivity.csv", 70 * u.K)
|
||||||
|
|
||||||
self.assertEqual(parent.calcSignal(), parent_2.calcSignal())
|
self.assertEqual(parent.calcSignal(), parent_2.calcSignal())
|
||||||
self.assertEqual(parent.calcNoise(), parent_2.calcNoise())
|
self.assertEqual(parent.calcBackground(), parent_2.calcBackground())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user