Print debug and info

This commit is contained in:
Lukas Klass 2020-04-24 11:05:01 +02:00
parent d6601a890f
commit b093ec96d3
2 changed files with 19 additions and 4 deletions

View File

@ -5,6 +5,7 @@ from abc import abstractmethod
import astropy.units as u import astropy.units as u
from astropy.modeling.models import BlackBody from astropy.modeling.models import BlackBody
from typing import Union, Callable from typing import Union, Callable
from logging import info, debug
class AOpticalComponent(IRadiant): class AOpticalComponent(IRadiant):
@ -59,7 +60,11 @@ class AOpticalComponent(IRadiant):
signal : SpectralQty signal : SpectralQty
The spectral flux density of the target's signal The spectral flux density of the target's signal
""" """
return self._propagate(self.__parent.calcSignal()) * (1 - self.__obstruction) signal = self.__parent.calcSignal()
info("Calculating Signal for class '" + self.__class__.__name__ + "'.")
signal = self._propagate(signal) * (1 - self.__obstruction)
debug(signal)
return signal
def calcNoise(self) -> SpectralQty: def calcNoise(self) -> SpectralQty:
""" """
@ -70,14 +75,18 @@ class AOpticalComponent(IRadiant):
noise : SpectralQty noise : SpectralQty
The spectral radiance of the target's noise The spectral radiance of the target's noise
""" """
parent = self._propagate(self.__parent.calcNoise()) parent = self.__parent.calcNoise()
info("Calculating Noise for class '" + self.__class__.__name__ + "'.")
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 noise = parent * (1. - self.__obstruction) + obstructor * self.__obstruction
else: else:
noise = parent * (1. - self.__obstruction) noise = parent * (1. - self.__obstruction)
return noise + self._ownNoise() noise = noise + self._ownNoise()
debug(noise)
return noise
def _propagate(self, rad: SpectralQty) -> SpectralQty: def _propagate(self, rad: SpectralQty) -> SpectralQty:
""" """

View File

@ -3,6 +3,7 @@ from ..IRadiant import IRadiant
from ..SpectralQty import SpectralQty from ..SpectralQty import SpectralQty
import astropy.units as u import astropy.units as u
import numpy as np import numpy as np
from logging import info, debug
class ATarget(IRadiant): class ATarget(IRadiant):
@ -33,7 +34,10 @@ class ATarget(IRadiant):
noise : SpectralQty noise : SpectralQty
The spectral radiance of the target's noise The spectral radiance of the target's noise
""" """
return SpectralQty(self.__wl_bins, np.repeat(0, len(self.__wl_bins)) << u.W / (u.m**2 * u.nm * u.sr)) 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
def calcSignal(self) -> SpectralQty: def calcSignal(self) -> SpectralQty:
""" """
@ -44,4 +48,6 @@ class ATarget(IRadiant):
signal : SpectralQty signal : SpectralQty
The spectral flux density of the target's signal The spectral flux density of the target's signal
""" """
info("Calculating Signal for class '" + self.__class__.__name__ + "'.")
debug(self.__sfd)
return self.__sfd return self.__sfd