Return obstruction
This commit is contained in:
parent
81c6a854b3
commit
a12b767aed
@ -9,7 +9,7 @@ class IRadiant(ABC):
|
|||||||
in the beam.
|
in the beam.
|
||||||
"""
|
"""
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def calcSignal(self) -> Tuple[SpectralQty, str]:
|
def calcSignal(self) -> Tuple[SpectralQty, str, float]:
|
||||||
"""
|
"""
|
||||||
Calculate the signal coming from the component
|
Calculate the signal coming from the component
|
||||||
|
|
||||||
@ -19,6 +19,8 @@ class IRadiant(ABC):
|
|||||||
The emitted, reflected or transmitted signal
|
The emitted, reflected or transmitted signal
|
||||||
size : str
|
size : str
|
||||||
The size of the target.
|
The size of the target.
|
||||||
|
obstruction : float
|
||||||
|
The obstruction factor.
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
@ -52,7 +52,7 @@ class AOpticalComponent(IRadiant):
|
|||||||
self.__obstructor_temp = obstructor_temp
|
self.__obstructor_temp = obstructor_temp
|
||||||
self.__obstructor_emissivity = obstructor_emissivity
|
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
|
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
|
The spectral flux density of the target's signal
|
||||||
size : str
|
size : str
|
||||||
The size of the target.
|
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__ + "'.")
|
info("Calculating signal for class '" + self.__class__.__name__ + "'.")
|
||||||
signal = self._propagate(signal) * (1 - self.__obstruction)
|
signal = self._propagate(signal) * (1 - self.__obstruction)
|
||||||
|
obstruction = obstruction + self.__obstruction
|
||||||
debug(signal)
|
debug(signal)
|
||||||
return signal, size
|
return signal, size, obstruction
|
||||||
|
|
||||||
def calcBackground(self) -> SpectralQty:
|
def calcBackground(self) -> SpectralQty:
|
||||||
"""
|
"""
|
||||||
|
@ -46,7 +46,7 @@ class ATarget(IRadiant):
|
|||||||
debug(background)
|
debug(background)
|
||||||
return 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
|
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
|
The spectral flux density of the target's signal
|
||||||
size : str
|
size : str
|
||||||
The size of the target.
|
The size of the target.
|
||||||
|
obstruction : float
|
||||||
|
The obstruction factor.
|
||||||
"""
|
"""
|
||||||
info("Calculating Signal for class '" + self.__class__.__name__ + "'.")
|
info("Calculating Signal for class '" + self.__class__.__name__ + "'.")
|
||||||
debug(self.__sfd)
|
debug(self.__sfd)
|
||||||
return self.__sfd, self.__size
|
return self.__sfd, self.__size, 0.0
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
|
@ -13,7 +13,7 @@ class TestBlackBodyTarget(TestCase):
|
|||||||
def test_calcSignal(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))
|
||||||
self.assertEqual(self.target.calcSignal(), (signal, "Point"))
|
self.assertEqual(self.target.calcSignal(), (signal, "Point", 0.0))
|
||||||
|
|
||||||
def test_calcBackground(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))
|
||||||
|
@ -11,8 +11,8 @@ class TestFileTarget(TestCase):
|
|||||||
|
|
||||||
def test_calcSignal(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.assertEqual(self.target.calcSignal(), (signal, "Point"))
|
self.assertEqual(self.target.calcSignal(), (signal, "Point", 0.0))
|
||||||
|
|
||||||
def test_calcBackground(self):
|
def test_calcBackground(self):
|
||||||
noise = SpectralQty(np.arange(200, 210, 1) << u.nm,
|
noise = SpectralQty(np.arange(200, 210, 1) << u.nm,
|
||||||
|
Loading…
Reference in New Issue
Block a user