The SardanaAlarmMonitor is an application for popping up alarm windows when certain conditions are not full filled. The conditions have to be defined in a file called AlarmFunctions.py placed in a directory belonging to the PYTHONPATH or where the SardanaAlarmMonitor.py script is placed.
Example of AlarmFunctions.py:
#!/bin/env python import PyTango # Function_name: ("Label", "Alarm message") func_dict = {"mytest1": ("Motor1 position", "Motor 1 above allowed position (10)") ,"mytest2": ("Motor2 position", "Motor 2 above allowed position (12)")} def mytest1(): motor_proxy = PyTango.DeviceProxy("p09/motor/exp.01") pos = motor_proxy.Position if pos > 10: return True else: return False def mytest2(): motor_proxy = PyTango.DeviceProxy("p09/motor/exp.02") pos = motor_proxy.Position if pos > 12: return True else: return False def mytest3(): motor_proxy = PyTango.DeviceProxy("p09/motor/exp.01") pos = motor_proxy.Position if pos > 10: return True else: return False
func_dict is a dictionary where the keys are the names of the functions, defined below, that wants to be checked by the SardanaAlarmMonitor. The file can contain more functions, these will be activated/deactivated for the test by including/excluding them from the dictionary. To each key belongs an array containing as first field the label for the test, like it will be seen in the main window of the monitor, and as second field the alarm message that will be shown in the popup window. The defined functions have to return False in case of Alarm, the SardanaAlarmMonitor will popup in this case a window with the corresponding alarm message.