diff --git a/lib/get_internal_attribute_history.py b/lib/get_internal_attribute_history.py new file mode 100755 index 0000000000000000000000000000000000000000..735be01613611d73f39678f6b0ed5fb1f1c56a70 --- /dev/null +++ b/lib/get_internal_attribute_history.py @@ -0,0 +1,16 @@ +#! /usr/bin/env python3 + + +from tango import DeviceProxy +from numpy import array, transpose + + +def get_internal_attribute_history(device: DeviceProxy, attribute_name: str, depth: int = 10): + try: + history = array(device.attribute_history(attr_name = attribute_name, depth = depth)) + except Exception as e: + raise ValueError("Cannot access the internal history of the attribute '{}/{}'.".format(device.name(), attribute_name)) from e + + history_values = array([entry.value for entry in history]) + values = history_values.transpose() + return values