def get_monitor_value(image, monitor_key): """Return the monitor value from an image using an header key. :param fabio.fabioimage.FabioImage image: Image containing the header :param str monitor_key: Key containing the monitor :return: returns the monitor else returns 1.0 :rtype: float """ if monitor_key is None or monitor_key == "": return 1.0 try: monitor = average.get_monitor_value(image, monitor_key) return monitor except average.MonitorNotFound: logger.warning("Monitor %s not found. No normalization applied." % monitor_key) return 1.0 except Exception as e: logger.warning("Fail to load monitor. No normalization applied. %s" % str(e)) return 1.0
def get_monitor_value(image, monitor_key): """Return the monitor value from an image using an header key. :param fabio.fabioimage.FabioImage image: Image containing the header :param str monitor_key: Key containing the monitor :return: returns the monitor else returns 1.0 :rtype: float """ if monitor_key is None or monitor_key == "": return 1.0 try: monitor = average.get_monitor_value(image, monitor_key) return monitor except average.MonitorNotFound: logger.warning("Monitor %s not found. No normalization applied.", monitor_key) return 1.0 except Exception as e: logger.warning("Fail to load monitor. No normalization applied. %s", str(e)) return 1.0