SNR / exposure_time parameter added.
This commit is contained in:
parent
09e338cc59
commit
6703a8615f
@ -139,6 +139,14 @@ class Configuration(object):
|
|||||||
mes is not None and error("Configuration check: common -> jitter_sigma: " + mes)
|
mes is not None and error("Configuration check: common -> jitter_sigma: " + mes)
|
||||||
if not hasattr(self.conf.common, "output_path"):
|
if not hasattr(self.conf.common, "output_path"):
|
||||||
setattr(self.conf.common, "output_path", Entry(val="."))
|
setattr(self.conf.common, "output_path", Entry(val="."))
|
||||||
|
if hasattr(self.conf.common, "exposure_time"):
|
||||||
|
mes = self.conf.common.exposure_time.check_quantity("val", u.s)
|
||||||
|
mes is not None and error("Configuration check: common -> exposure_time: " + mes)
|
||||||
|
elif hasattr(self.conf.common, "snr"):
|
||||||
|
mes = self.conf.common.snr.check_quantity("val", u.dimensionless_unscaled)
|
||||||
|
mes is not None and error("Configuration check: common -> snr: " + mes)
|
||||||
|
else:
|
||||||
|
error("Configuration check: common: Expected one of the containers 'exposure_time' or 'snr' but got none.")
|
||||||
|
|
||||||
# Check astroscene
|
# Check astroscene
|
||||||
if not hasattr(self.conf, "astroscene"):
|
if not hasattr(self.conf, "astroscene"):
|
||||||
|
@ -3,7 +3,6 @@ import argparse
|
|||||||
import logging
|
import logging
|
||||||
import sys
|
import sys
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
parser = argparse.ArgumentParser(prog="esbo_etc/esbo-etc.py", description='Exposure time calculator for ESBO-DS')
|
parser = argparse.ArgumentParser(prog="esbo_etc/esbo-etc.py", description='Exposure time calculator for ESBO-DS')
|
||||||
parser.add_argument("-c", "--config", dest='config', default="esbo-etc_defaults.xml",
|
parser.add_argument("-c", "--config", dest='config', default="esbo-etc_defaults.xml",
|
||||||
@ -15,10 +14,18 @@ if __name__ == "__main__":
|
|||||||
help="show version information")
|
help="show version information")
|
||||||
args, _ = parser.parse_known_args() # fix for PyCharm python console
|
args, _ = parser.parse_known_args() # fix for PyCharm python console
|
||||||
|
|
||||||
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.WARNING if args.logging is None else
|
logging.basicConfig(format='%(levelname)s: %(message)s', level=logging.WARNING if args.logging is None else getattr(
|
||||||
getattr(logging, args.logging.upper()), stream=sys.stdout)
|
logging, args.logging.upper()), stream=sys.stdout)
|
||||||
|
|
||||||
conf = etc.Configuration(args.config).conf
|
conf = etc.Configuration(args.config).conf
|
||||||
|
|
||||||
factory = etc.classes.RadiantFactory(conf.common.wl_bins())
|
oc_factory = etc.classes.RadiantFactory(conf.common.wl_bins())
|
||||||
parent = factory.fromConfig(conf)
|
parent = oc_factory.fromConfigBatch(conf)
|
||||||
|
sensor_factory = etc.SensorFactory(parent, conf.common)
|
||||||
|
imager = sensor_factory.create(conf.instrument.sensor)
|
||||||
|
if hasattr(conf.common, "exposure_time"):
|
||||||
|
snr = imager.getSNR(conf.common.exposure_time())
|
||||||
|
print("The SNR is: %.2f" % snr)
|
||||||
|
elif hasattr(conf.common, "snr"):
|
||||||
|
exp_time = imager.getExpTime(conf.common.snr())
|
||||||
|
print("The necessary exposure time is: %.2f s" % exp_time.value)
|
||||||
|
Loading…
Reference in New Issue
Block a user