Allow mag and mag / sr for sensitivity

This commit is contained in:
Lukas Klass 2020-07-14 12:01:08 +02:00
parent bc547cc214
commit 367568e0d3
2 changed files with 11 additions and 10 deletions

View File

@ -11,6 +11,7 @@ class ASensor:
""" """
Abstract super class for sensor models Abstract super class for sensor models
""" """
@abstractmethod @abstractmethod
def __init__(self, parent: IRadiant): def __init__(self, parent: IRadiant):
""" """
@ -127,8 +128,8 @@ class ASensor:
""" """
pass pass
@u.quantity_input(exp_time="time", snr=u.dimensionless_unscaled, target_brightness=u.mag) # @u.quantity_input(exp_time="time", snr=u.dimensionless_unscaled, target_brightness=[u.mag, u.mag / u.sr])
def getSensitivity(self, exp_time: u.Quantity, snr: u.Quantity, target_brightness: u.Quantity) -> u.mag: def getSensitivity(self, exp_time: u.Quantity, snr: u.Quantity, target_brightness: u.Quantity) -> [u.mag, u.mag / u.sr]:
""" """
Calculate the sensitivity of the telescope detector combination. Calculate the sensitivity of the telescope detector combination.
@ -144,15 +145,15 @@ class ASensor:
Returns Returns
------- -------
sensitivity: Quantity sensitivity: Quantity
The sensitivity as limiting apparent star magnitude in mag. The sensitivity as limiting apparent star magnitude in mag or mag / sr.
""" """
background, signal, obstruction = self.__calcIncomingRadiation() background, signal, obstruction = self.__calcIncomingRadiation()
return self.calcSensitivity(background, signal, obstruction, exp_time, snr, target_brightness) return self.calcSensitivity(background, signal, obstruction, exp_time, snr, target_brightness)
@abstractmethod @abstractmethod
@u.quantity_input(exp_time="time", snr=u.dimensionless_unscaled, target_brightness=u.mag) # @u.quantity_input(exp_time="time", snr=u.dimensionless_unscaled, target_brightness=[u.mag, u.mag / u.sr])
def calcSensitivity(self, background: SpectralQty, signal: SpectralQty, obstruction: float, exp_time: u.Quantity, def calcSensitivity(self, background: SpectralQty, signal: SpectralQty, obstruction: float, exp_time: u.Quantity,
snr: u.Quantity, target_brightness: u.Quantity) -> u.mag: snr: u.Quantity, target_brightness: u.Quantity) -> [u.mag, u.mag / u.sr]:
""" """
Calculate the sensitivity of the telescope detector combination. Calculate the sensitivity of the telescope detector combination.
@ -174,7 +175,7 @@ class ASensor:
Returns Returns
------- -------
sensitivity: Quantity sensitivity: Quantity
The sensitivity as limiting apparent star magnitude in mag. The sensitivity as limiting apparent star magnitude in mag or mag / sr.
""" """
pass pass

View File

@ -174,9 +174,9 @@ class Imager(ASensor):
dark_current * exp_time_, "snr_%.2f" % snr_.value) dark_current * exp_time_, "snr_%.2f" % snr_.value)
return exp_time return exp_time
@u.quantity_input(exp_time="time", snr=u.dimensionless_unscaled, target_brightness=u.mag) # @u.quantity_input(exp_time="time", snr=u.dimensionless_unscaled, target_brightness=[u.mag, u.mag / u.sr])
def calcSensitivity(self, background: SpectralQty, signal: SpectralQty, obstruction: float, exp_time: u.Quantity, def calcSensitivity(self, background: SpectralQty, signal: SpectralQty, obstruction: float, exp_time: u.Quantity,
snr: u.Quantity, target_brightness: u.Quantity) -> u.mag: snr: u.Quantity, target_brightness: u.Quantity) -> [u.mag, u.mag / u.sr]:
""" """
Calculate the sensitivity of the telescope detector combination. Calculate the sensitivity of the telescope detector combination.
@ -193,7 +193,7 @@ class Imager(ASensor):
snr : Quantity snr : Quantity
The SNR for which the sensitivity time shall be calculated. The SNR for which the sensitivity time shall be calculated.
target_brightness : Quantity target_brightness : Quantity
The target brightness in magnitudes. The target brightness in mag or mag / sr.
Returns Returns
------- -------
@ -217,7 +217,7 @@ class Imager(ASensor):
self.__output(signal_current * signal_current_lim_ / signal_current.sum() * exp_time_, self.__output(signal_current * signal_current_lim_ / signal_current.sum() * exp_time_,
background_current * exp_time_, read_noise, dark_current * exp_time_, background_current * exp_time_, read_noise, dark_current * exp_time_,
"snr_%.2f_texp_%.2f" % (snr_.value, exp_time_.value)) "snr_%.2f_texp_%.2f" % (snr_.value, exp_time_.value))
return target_brightness - 2.5 * np.log10(signal_current_lim / signal_current.sum()) * u.mag return target_brightness - 2.5 * np.log10(signal_current_lim / signal_current.sum()) * target_brightness.unit
@u.quantity_input(signal=u.electron, background=u.electron, read_noise=u.electron ** 0.5, dark=u.electron) @u.quantity_input(signal=u.electron, background=u.electron, read_noise=u.electron ** 0.5, dark=u.electron)
def __printDetails(self, signal: u.Quantity, background: u.Quantity, read_noise: u.Quantity, def __printDetails(self, signal: u.Quantity, background: u.Quantity, read_noise: u.Quantity,