data_sources_common#
Generic data sources.
This module contains Data Source classes that deal with data whose origin is not tied to a specific facility or experiment.
- class Jungfrau1MFrameInfo(h5file: Any, index: int, file_timestamp: float)#
- Parameters:
h5file (Any)
index (int)
file_timestamp (float)
- h5file: Any#
- index: int#
- file_timestamp: float#
- class OmJungfrau1MDataSourceMixin(*, data_source_name, parameters, additional_info)#
Detector data frames from Jungfrau 1M HDF5 files.
This class deals with the retrieval of Jungfrau 1M detector data frame from files written by the detector in HDF5 format.
This class implements the interface described by its base Protocol class. Please see the documentation of that class for additional information about the interface.
- Parameters:
data_source_name (str) – A name that identifies the current data source. It is used, for example, in communications with the user or for the retrieval of a sensor’s initialization parameters.
parameters (DataSourceParameters) – An object storing OM’s configuration parameters.
additional_info (dict[str, Any])
- initialize_data_source()#
Initializes the HDF5 file-based Jungfrau 1M detector data frame source.
Please see the documentation of the base Protocol class for additional information about this method.
This function retrieves from OM’s configuration parameters all the information needed to initialize the data source. It looks at the {data_source_name}_calibration entry in OM’s data retrieval layer configuration parameter group to determine if calibrated data needs to be retrieved. In the affirmative case, it reads the names of the files containing the required calibration constants from the entries dark_filenames and gain_filenames in the calibration parameter group.
- Return type:
None
- class TimestampFromEvent(*, data_source_name, parameters, additional_info)#
Timestamp information from data events.
This class deals with the retrieval of the timestamp information stored in data events. Several software frameworks provide direct timestamp information about the events they generate. OM retrieves this information and stores it in the data event structure. This class retrieves it from there.
This class implements the interface described by its base Protocol class. Please see the documentation of that class for additional information about the interface.
- Parameters:
data_source_name (str) – A name that identifies the current data source. It is used, for example, in communications with the user or for the retrieval of a sensor’s initialization parameters.
parameters (DataSourceParameters) – An object storing OM’s configuration parameters.
additional_info (dict[str, Any])
- initialize_data_source()#
Initializes the event timestamp data source.
Please see the documentation of the base Protocol class for additional information about this method.
No initialization is needed to retrieve timestamp information from data events, so this function actually does nothing.
- Return type:
None
- get_data(*, event)#
Retrieves the timestamp information from a data event.
Please see the documentation of the base Protocol class for additional information about this method.
This function retrieves the timestamp information stored in the provided data event.
- Parameters:
event (dict[str, Any]) – A dictionary storing the event data.
- Returns:
The timestamp from the data event.
- Return type:
float64
- class FloatValueFromConfiguration(*, data_source_name, parameters, additional_info)#
Numerical values from configuration parameters.
This class deals with the retrieval of numerical values from OM’s configuration parameters.
This class implements the interface described by its base Protocol class. Please see the documentation of that class for additional information about the interface.
- Parameters:
data_source_name (str) – A name that identifies the current data source. It is used, for example, in communications with the user or for the retrieval of a sensor’s initialization parameters.
monitor_parameters – An object storing OM’s configuration parameters.
parameters (DataSourceParameters)
additional_info (dict[str, Any])
- initialize_data_source()#
Initializes the numerical configuration parameter data source.
Please see the documentation of the base Protocol class for additional information about this method.
This function retrieves the value of the {data_source_name} entry from OM’s data_retrieval_layer configuration parameter group, and stores it for subsequent recall. The function treats the entry as a required parameter (i.e.: it raises an exception if the parameter is not available), and requires its value to be a float number.
- Return type:
None
- get_data(*, event)#
Retrieves the numerical value of an OM’s configuration parameter
Please see the documentation of the base Protocol class for additional information about this method.
This function returns the value of the configuration parameter retrieved by the the Data Source.
- Parameters:
event (dict[str, Any]) – A dictionary storing the event data.
- Returns:
The value of the configuration parameter.
- Return type:
float
- class IntValueFromConfiguration(*, data_source_name, parameters, additional_info)#
Numerical values from configuration parameters.
This class deals with the retrieval of numerical values from OM’s configuration parameters.
This class implements the interface described by its base Protocol class. Please see the documentation of that class for additional information about the interface.
- Parameters:
data_source_name (str) – A name that identifies the current data source. It is used, for example, in communications with the user or for the retrieval of a sensor’s initialization parameters.
monitor_parameters – An object storing OM’s configuration parameters.
parameters (DataSourceParameters)
additional_info (dict[str, Any])
- initialize_data_source()#
Initializes the numerical configuration parameter data source.
Please see the documentation of the base Protocol class for additional information about this method.
This function retrieves the value of the {data_source_name} entry from OM’s data_retrieval_layer configuration parameter group, and stores it for subsequent recall. The function treats the entry as a required parameter (i.e.: it raises an exception if the parameter is not available), and requires its value to be a float number.
- Return type:
None
- get_data(*, event)#
Retrieves the numerical value of an OM’s configuration parameter
Please see the documentation of the base Protocol class for additional information about this method.
This function returns the value of the configuration parameter retrieved by the the Data Source.
- Parameters:
event (dict[str, Any]) – A dictionary storing the event data.
- Returns:
The value of the configuration parameter.
- Return type:
float
- class ArrayFromHdf5File(*, data_source_name, parameters, additional_info)#
Numerical values from configuration parameters.
This class deals with the retrieval of numerical values from OM’s configuration parameters.
This class implements the interface described by its base Protocol class. Please see the documentation of that class for additional information about the interface.
- Parameters:
data_source_name (str) – A name that identifies the current data source. It is used, for example, in communications with the user or for the retrieval of a sensor’s initialization parameters.
monitor_parameters – An object storing OM’s configuration parameters.
parameters (DataSourceParameters)
additional_info (dict[str, Any])
- initialize_data_source()#
Initializes the numerical configuration parameter data source.
Please see the documentation of the base Protocol class for additional information about this method.
This function retrieves the value of the {data_source_name} entry from OM’s data_retrieval_layer configuration parameter group, and stores it for subsequent recall. The function treats the entry as a required parameter (i.e.: it raises an exception if the parameter is not available), and requires its value to be a float number.
- Return type:
None
- get_data(*, event)#
Retrieves the numerical value of an OM’s configuration parameter
Please see the documentation of the base Protocol class for additional information about this method.
This function returns the value of the configuration parameter retrieved by the the Data Source.
- Parameters:
event (dict[str, Any]) – A dictionary storing the event data.
- Returns:
The value of the configuration parameter.
- Return type:
ndarray[Any, dtype[float64 | int64]]