diff --git a/esbo_etc/classes/optical_component/AOpticalComponent.py b/esbo_etc/classes/optical_component/AOpticalComponent.py index d8ecf15..9b380e1 100644 --- a/esbo_etc/classes/optical_component/AOpticalComponent.py +++ b/esbo_etc/classes/optical_component/AOpticalComponent.py @@ -66,27 +66,27 @@ class AOpticalComponent(IRadiant): debug(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 ------- - noise : SpectralQty - The spectral radiance of the target's noise + background : SpectralQty + The spectral radiance of the background """ - parent = self.__parent.calcNoise() + parent = self.__parent.calcBackground() info("Calculating Noise for class '" + self.__class__.__name__ + "'.") parent = self._propagate(parent) if self.__obstructor_temp > 0 * u.K: bb = BlackBody(temperature=self.__obstructor_temp, scale=1. * u.W / (u.m ** 2 * u.nm * u.sr)) obstructor = bb(parent.wl) * self.__obstructor_emissivity - noise = parent * (1. - self.__obstruction) + obstructor * self.__obstruction + background = parent * (1. - self.__obstruction) + obstructor * self.__obstruction else: - noise = parent * (1. - self.__obstruction) - noise = noise + self._ownNoise() - debug(noise) - return noise + background = parent * (1. - self.__obstruction) + background = background + self._ownNoise() + debug(background) + return background def _propagate(self, rad: SpectralQty) -> SpectralQty: """ diff --git a/esbo_etc/classes/target/ATarget.py b/esbo_etc/classes/target/ATarget.py index c33fbad..ed80637 100644 --- a/esbo_etc/classes/target/ATarget.py +++ b/esbo_etc/classes/target/ATarget.py @@ -25,19 +25,19 @@ class ATarget(IRadiant): self.__sfd = sfd 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 ------- - noise : SpectralQty - The spectral radiance of the target's noise + background : SpectralQty + The spectral radiance of the target's background """ 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)) - debug(noise) - return noise + background = SpectralQty(self.__wl_bins, np.repeat(0, len(self.__wl_bins)) << u.W / (u.m**2 * u.nm * u.sr)) + debug(background) + return background def calcSignal(self) -> SpectralQty: """ diff --git a/tests/optical_component/test_AHotOpticalComponent.py b/tests/optical_component/test_AHotOpticalComponent.py index 65a7857..f3f2e77 100644 --- a/tests/optical_component/test_AHotOpticalComponent.py +++ b/tests/optical_component/test_AHotOpticalComponent.py @@ -26,11 +26,11 @@ class TestAHotOpticalComponent(TestCase): def test___init__(self): comp = HotOpticalComponent(self.target, SpectralQty(self.wl, np.repeat(0.5, 4) << u.dimensionless_unscaled), 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, 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) - self.assertEqual(comp.calcNoise(), + self.assertEqual(comp.calcBackground(), 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))) diff --git a/tests/optical_component/test_AOpticalComponent.py b/tests/optical_component/test_AOpticalComponent.py index 23b909a..9410c72 100644 --- a/tests/optical_component/test_AOpticalComponent.py +++ b/tests/optical_component/test_AOpticalComponent.py @@ -25,13 +25,13 @@ class TestAOpticalComponent(TestCase): SpectralQty(self.wl, np.array([1.29074440e-17, 5.65909989e-18, 2.85372997e-18, 1.58973516e-18]) << u.W / (u.m ** 2 * u.nm))) - def test_calcNoise(self): - self.assertEqual(self.comp.calcNoise(), + def test_calcBackground(self): + self.assertEqual(self.comp.calcBackground(), 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))) 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)), 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, 10.92866544e-04]) << u.W / (u.m ** 2 * u.nm * u.sr))) diff --git a/tests/optical_component/test_Atmosphere.py b/tests/optical_component/test_Atmosphere.py index 59ceec3..d11aa6f 100644 --- a/tests/optical_component/test_Atmosphere.py +++ b/tests/optical_component/test_Atmosphere.py @@ -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, 0.9e-15, 0, 0]) << u.W / (u.m ** 2 * u.nm))) - def test_calcNoise(self): - self.assertEqual(self.atmosphere.calcNoise(), + def test_calcBackgrounde(self): + self.assertEqual(self.atmosphere.calcBackground(), 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, 1.8e-16]) << u.W / (u.m ** 2 * u.nm * u.sr))) diff --git a/tests/optical_component/test_BeamSplitter.py b/tests/optical_component/test_BeamSplitter.py index f6777a2..9baada8 100644 --- a/tests/optical_component/test_BeamSplitter.py +++ b/tests/optical_component/test_BeamSplitter.py @@ -15,7 +15,7 @@ class TestBeamSplitter(TestCase): temp=300 * u.K) 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, 1.33846280e-94]) << u.W / (u.m ** 2 * u.nm * u.sr))) self.assertEqual(self.splitter.calcSignal(), diff --git a/tests/optical_component/test_Lens.py b/tests/optical_component/test_Lens.py index 11e8553..b59794f 100644 --- a/tests/optical_component/test_Lens.py +++ b/tests/optical_component/test_Lens.py @@ -14,7 +14,7 @@ class TestLens(TestCase): self.lens = Lens(self.target, "data/lens/lens_transmittance.csv", 0.5, temp=300 * u.K) 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, 1.33846280e-94]) << u.W / (u.m ** 2 * u.nm * u.sr))) self.assertEqual(self.lens.calcSignal(), diff --git a/tests/optical_component/test_Mirror.py b/tests/optical_component/test_Mirror.py index ce12a93..28bc53f 100644 --- a/tests/optical_component/test_Mirror.py +++ b/tests/optical_component/test_Mirror.py @@ -14,7 +14,7 @@ class TestMirror(TestCase): self.mirror = Mirror(self.target, "data/mirror/mirror_reflectance.csv", 0.5, temp=300 * u.K) 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, 1.33846280e-94]) << u.W / (u.m ** 2 * u.nm * u.sr))) self.assertEqual(self.mirror.calcSignal(), diff --git a/tests/optical_component/test_StrayLight.py b/tests/optical_component/test_StrayLight.py index 1f5025d..ebde35a 100644 --- a/tests/optical_component/test_StrayLight.py +++ b/tests/optical_component/test_StrayLight.py @@ -15,8 +15,8 @@ class TestStrayLight(TestCase): 1.6e-15, 1.7e-15, 1.8e-15, 1.9e-15, 2.0e-15]) << u.W / (u.m ** 2 * u.nm))) - def test_calcNoise(self): - self.assertEqual(self.zodiac.calcNoise(), + def test_calcBackground(self): + 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, 1.6e-16, 1.7e-16, 1.8e-16, 1.9e-16, 2.0e-16]) << u.W / diff --git a/tests/target/test_BlackBodyTarget.py b/tests/target/test_BlackBodyTarget.py index 4688ead..077c527 100644 --- a/tests/target/test_BlackBodyTarget.py +++ b/tests/target/test_BlackBodyTarget.py @@ -10,12 +10,11 @@ class TestBlackBodyTarget(TestCase): 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): + def test_calcSignal(self): 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)) - print(self.target.calcSignal().qty) 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)) - self.assertEqual(self.target.calcNoise(), noise) + self.assertEqual(self.target.calcBackground(), noise) diff --git a/tests/target/test_FileTarget.py b/tests/target/test_FileTarget.py index 27776d9..14326c7 100644 --- a/tests/target/test_FileTarget.py +++ b/tests/target/test_FileTarget.py @@ -9,12 +9,12 @@ class TestFileTarget(TestCase): def setUp(self): 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, np.arange(1.1e-15, 2.0e-15, 1e-16) << u.W / (u.m ** 2 * u.nm)) self.assertTrue(self.target.calcSignal().__eq__(signal)) - def test_noise(self): + def test_calcBackground(self): noise = SpectralQty(np.arange(200, 210, 1) << u.nm, 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) diff --git a/tests/test_RadiantFactory.py b/tests/test_RadiantFactory.py index 872cb21..a2e2048 100644 --- a/tests/test_RadiantFactory.py +++ b/tests/test_RadiantFactory.py @@ -23,4 +23,4 @@ class TestRadiantFactory(TestCase): 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.calcNoise(), parent_2.calcNoise()) + self.assertEqual(parent.calcBackground(), parent_2.calcBackground())