data_sources_generic
Generic data sources.
This module contains Data Source classes that deal with data whose origin is not tied to a specific facility or experiment.
TimestampFromEvent
Bases: OmDataSourceProtocol
See documentation of the __init__
function.
__init__(*, data_source_name, monitor_parameters)
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:
Name | Type | Description | Default |
---|---|---|---|
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. |
required |
monitor_parameters |
MonitorParameters
|
An object storing OM's configuration parameters. |
required |
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.
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:
Name | Type | Description | Default |
---|---|---|---|
event |
Dict[str, Any]
|
A dictionary storing the event data. |
required |
Returns:
Type | Description |
---|---|
numpy.float64
|
The timestamp from the data event. |
FloatEntryFromConfiguration
Bases: OmDataSourceProtocol
See documentation of the __init__
function.
__init__(*, data_source_name, monitor_parameters)
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:
Name | Type | Description | Default |
---|---|---|---|
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. |
required |
monitor_parameters |
MonitorParameters
|
An object storing OM's configuration parameters. |
required |
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.
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:
Name | Type | Description | Default |
---|---|---|---|
event |
Dict[str, Any]
|
A dictionary storing the event data. |
required |
Returns:
Type | Description |
---|---|
float
|
The value of the configuration parameter. |