Bugfix: write output for sensitivity calculation

This commit is contained in:
Lukas Klass 2020-05-26 22:24:59 +02:00
parent cd1fe7fb11
commit 2f1176c998
2 changed files with 7 additions and 5 deletions

View File

@ -207,13 +207,15 @@ class Imager(ASensor):
for snr_, exp_time_, signal_current_lim_ in pbar(zip(snr, exp_time, signal_current_lim)):
self.__printDetails(signal_current_lim_ * exp_time_, background_current * exp_time_, read_noise,
dark_current * exp_time_, "SNR=%.2f t_exp=%.2f s: " % (snr_.value, exp_time_.value))
self.__output(signal_current_lim_ * exp_time_, background_current * exp_time_, read_noise,
dark_current * exp_time_, "snr_%.2f_texp_%.2f" % (snr_.value, exp_time_.value))
self.__output(signal_current * signal_current_lim_ / signal_current.sum() * exp_time_,
background_current * exp_time_, read_noise, dark_current * exp_time_,
"snr_%.2f_texp_%.2f" % (snr_.value, exp_time_.value))
else:
self.__printDetails(signal_current_lim * exp_time, background_current * exp_time, read_noise,
dark_current * exp_time, "SNR=%.2f t_exp=%.2f s: " % (snr.value, exp_time.value))
self.__output(signal_current_lim * exp_time, background_current * exp_time, read_noise,
dark_current * exp_time, "snr_%.2f_texp_%.2f" % (snr.value, exp_time.value))
self.__output(signal_current * signal_current_lim / signal_current.sum() * exp_time,
background_current * exp_time, read_noise, dark_current * exp_time,
"snr_%.2f_texp_%.2f" % (snr.value, exp_time.value))
return target_brightness - 2.5 * np.log10(signal_current_lim / signal_current.sum()) * u.mag
@u.quantity_input(signal=u.electron, background=u.electron, read_noise=u.electron ** 0.5, dark=u.electron)

View File

@ -32,7 +32,7 @@ class TestImager(TestCase):
self.assertAlmostEqual(exp_time.value, exp_time_.value)
def test_getSensitivity(self):
exp_time = 0.1 * u.s
exp_time = 100 * u.s
target = BlackBodyTarget(np.arange(200, 210) << u.nm, mag=20 * u.mag)
zodiac = StrayLight(target, "data/straylight/zodiacal_emission_1.csv")
imager = Imager(zodiac, **self.imager_args)