diff --git a/esbo_etc/classes/IRadiant.py b/esbo_etc/classes/IRadiant.py index a913f9c..756ad4d 100644 --- a/esbo_etc/classes/IRadiant.py +++ b/esbo_etc/classes/IRadiant.py @@ -9,7 +9,7 @@ class IRadiant(ABC): in the beam. """ @abstractmethod - def calcSignal(self) -> Tuple[SpectralQty, str]: + def calcSignal(self) -> Tuple[SpectralQty, str, float]: """ Calculate the signal coming from the component @@ -19,6 +19,8 @@ class IRadiant(ABC): The emitted, reflected or transmitted signal size : str The size of the target. + obstruction : float + The obstruction factor. """ pass diff --git a/esbo_etc/classes/optical_component/AOpticalComponent.py b/esbo_etc/classes/optical_component/AOpticalComponent.py index 09fbc1c..222a90f 100644 --- a/esbo_etc/classes/optical_component/AOpticalComponent.py +++ b/esbo_etc/classes/optical_component/AOpticalComponent.py @@ -52,7 +52,7 @@ class AOpticalComponent(IRadiant): self.__obstructor_temp = obstructor_temp self.__obstructor_emissivity = obstructor_emissivity - def calcSignal(self) -> Tuple[SpectralQty, str]: + def calcSignal(self) -> Tuple[SpectralQty, str, float]: """ Calculate the spectral flux density of the target's signal @@ -62,12 +62,15 @@ class AOpticalComponent(IRadiant): The spectral flux density of the target's signal size : str The size of the target. + obstruction : float + The obstruction factor. """ - signal, size = self.__parent.calcSignal() + signal, size, obstruction = self.__parent.calcSignal() info("Calculating signal for class '" + self.__class__.__name__ + "'.") signal = self._propagate(signal) * (1 - self.__obstruction) + obstruction = obstruction + self.__obstruction debug(signal) - return signal, size + return signal, size, obstruction def calcBackground(self) -> SpectralQty: """ diff --git a/esbo_etc/classes/target/ATarget.py b/esbo_etc/classes/target/ATarget.py index c614343..fd1c3cf 100644 --- a/esbo_etc/classes/target/ATarget.py +++ b/esbo_etc/classes/target/ATarget.py @@ -46,7 +46,7 @@ class ATarget(IRadiant): debug(background) return background - def calcSignal(self) -> Tuple[SpectralQty, str]: + def calcSignal(self) -> Tuple[SpectralQty, str, float]: """ Calculate the spectral flux density of the target's signal @@ -56,10 +56,12 @@ class ATarget(IRadiant): The spectral flux density of the target's signal size : str The size of the target. + obstruction : float + The obstruction factor. """ info("Calculating Signal for class '" + self.__class__.__name__ + "'.") debug(self.__sfd) - return self.__sfd, self.__size + return self.__sfd, self.__size, 0.0 @staticmethod @abstractmethod diff --git a/tests/target/test_BlackBodyTarget.py b/tests/target/test_BlackBodyTarget.py index f4b5744..5106d7b 100644 --- a/tests/target/test_BlackBodyTarget.py +++ b/tests/target/test_BlackBodyTarget.py @@ -13,7 +13,7 @@ class TestBlackBodyTarget(TestCase): 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)) - self.assertEqual(self.target.calcSignal(), (signal, "Point")) + self.assertEqual(self.target.calcSignal(), (signal, "Point", 0.0)) 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)) diff --git a/tests/target/test_FileTarget.py b/tests/target/test_FileTarget.py index 783b29c..9952928 100644 --- a/tests/target/test_FileTarget.py +++ b/tests/target/test_FileTarget.py @@ -11,8 +11,8 @@ class TestFileTarget(TestCase): 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.assertEqual(self.target.calcSignal(), (signal, "Point")) + 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)) def test_calcBackground(self): noise = SpectralQty(np.arange(200, 210, 1) << u.nm,