Skip to content

data_sources_files

File-based data sources.

This module contains Data Source classes that deal with data stored in files.

PilatusSingleFrameFiles

Bases: OmDataSourceProtocol

See documentation of the __init__ function.

__init__(*, data_source_name, monitor_parameters)

Detector data frames from Pilatus single-frame CBF files.

This class deals with the retrieval of Pilatus detector data frames from single-frame files written by the detector in CBF 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:

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 CBF file-based Pilatus detector data source.

Please see the documentation of the base Protocol class for additional information about this method.

No initialization is needed to retrieve detector data frames from single-frame CBF files, so this function actually does nothing.

get_data(*, event)

Retrieves a Pilatus detector data frame from a file-based event.

Please see the documentation of the base Protocol class for additional information about this method.

This function retrieves the detector data frame associated with the provided file-based event, and returns the detector frame as a 2D array storing pixel information.

Parameters:

Name Type Description Default
event Dict[str, Any]

A dictionary storing the event data.

required

Returns:

Type Description
NDArray[numpy.float_]

One detector data frame.

Jungfrau1MFiles

Bases: OmDataSourceProtocol

See documentation of the __init__ function.

__init__(*, data_source_name, monitor_parameters)

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:

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 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.

get_data(*, event)

Retrieves a Jungfrau 1M detector data frame from a file-based event.

Please see the documentation of the base Protocol class for additional information about this method.

This function retrieves the detector data frame associated with the provided file-based event, and returns the detector frame as a 2D array storing pixel information. The data is retrieved in calibrated or non-calibrated form depending on the value of the {source_protocols_name}_calibration entry in OM's data_retrieval_layer configuration parameter group.

Parameters:

Name Type Description Default
event Dict[str, Any]

A dictionary storing the event data.

required

Returns:

Type Description
Union[NDArray[numpy.float_], NDArray[numpy.int_]]

One detector data frame.

Eiger16MFiles

Bases: OmDataSourceProtocol

See documentation of the __init__ function.

__init__(*, data_source_name, monitor_parameters)

Detector data frames from Eiger 16M HDF5 files.

This class deals with the retrieval of Eiger 16M detector data frames 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:

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 HDF5 file-based Eiger 16M detector data frame source.

Please see the documentation of the base Protocol class for additional information about this method.

No initialization is needed to retrieve detector data frames from files written by the Eiger 16M detector, so this function actually does nothing.

get_data(*, event)

Retrieves an Eiger 16M detector data frame from files.

Please see the documentation of the base Protocol class for additional information about this method.

This function retrieves the detector data frame associated with the provided file-based event, and returns the detector frame as a 2D array storing pixel information.

Parameters:

Name Type Description Default
event Dict[str, Any]

A dictionary storing the event data.

required

Returns:

Type Description
NDArray[numpy.int_]

A detector data frame.

RayonixMccdSingleFrameFiles

Bases: OmDataSourceProtocol

See documentation of the __init__ function.

__init__(*, data_source_name, monitor_parameters)

Detector data frames from Rayonix MX340-HS single-frame mccd files.

This class deals with the retrieval of Rayonix detector data frames from single-frame files written by the detector in MCCD 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:

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 mccd file-based Rayonix MX340-HS detector data frame source.

Please see the documentation of the base Protocol class for additional information about this method.

No initialization is needed to retrieve detector data frames from single-frame mccd files, so this function actually does nothing.

get_data(*, event)

Retrieves a Rayonix MX340-HS detector data frame from files.

Please see the documentation of the base Protocol class for additional information about this method.

This function retrieves the detector data frame associated with the provided file-based event, and returns the detector frame as a 2D array storing pixel information.

Parameters:

Name Type Description Default
event Dict[str, Any]

A dictionary storing the event data.

required

Returns:

Type Description
NDArray[numpy.int_]

A detector data frame.

Lambda1M5Files

Bases: OmDataSourceProtocol

See documentation of the __init__ function.

__init__(*, data_source_name, monitor_parameters)

Detector data frames from Lambda 1.5M HDF5 files.

This class deals with the retrieval of Lambda 1.5M detector data frames 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:

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 HDF5 file-based Lambda 1.5M detector data frame source.

Please see the documentation of the base Protocol class for additional information about this method.

No initialization is needed to retrieve detector data frames from files written by the Lambda 1.5M detector, so this function actually does nothing.

get_data(*, event)

Retrieves a Lambda 1.5M detector data frame from files.

Please see the documentation of the base Protocol class for additional information about this method.

This function retrieves the detector data frame associated with the provided file-based event, and returns the detector frame as a 2D array storing pixel information.

Parameters:

Name Type Description Default
event Dict[str, Any]

A dictionary storing the event data.

required

Returns:

Type Description
Union[NDArray[numpy.float_], NDArray[numpy.int_]]

Detector data frame.

TimestampFromFileModificationTime

Bases: OmDataSourceProtocol

See documentation of the __init__ function.

__init__(*, data_source_name, monitor_parameters)

Timestamp information from the modification date of files.

This class deals with the retrieval of timestamp information for file-based data events which do not provide any information of this kind. It assumes that the last modification date of a file is a good first approximation of the timestamp of the data stored in it.

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 file modification date 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 the modification date of files, so this function actually does nothing.

get_data(*, event)

Retrieves timestamp information from the modification date of a file.

Please see the documentation of the base Protocol class for additional information about this method.

This function retrieves the timestamp information associated with the provided file-based event. It uses as timestamp the last modification time of the file attached to the event.

Parameters:

Name Type Description Default
event Dict[str, Any]

A dictionary storing the event data.

required

Returns:

Type Description
numpy.float64

The timestamp of the data event.

TimestampJungfrau1MFiles

Bases: OmDataSourceProtocol

See documentation of the __init__ function.

__init__(*, data_source_name, monitor_parameters)

Timestamp information for Jungfrau 1M detector data events.

This class deals with the retrieval of timestamp information for Jungfrau 1M data events. The files written by this detector do not record any absolute timestamp information. However, they store the readout of the internal detector clock for every frame they contain. As a first approximation, this class takes the modification time of a data file as the timestamp of the first frame stored in it, and computes the timestamp of all other frames according to the recorded internal clock time difference.

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 Jungfrau 1M 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 for Jungfrau 1M data events, so this function actually does nothing.

get_data(*, event)

Retrieves the timestamp information for a Jungfrau 1M data event from files.

Please see the documentation of the base Protocol class for additional information about this method.

This function retrieves the timestamp information associated with the provided file-based event. It computes the timestamp using the last modification time of the file attached to the event, modified by the internal clock reading of the frame associated to the event.

Parameters:

Name Type Description Default
event Dict[str, Any]

A dictionary storing the event data.

required

Returns:

Type Description
numpy.float64

The timestamp for the Jungfrau 1M data event.

EventIdFromFilePath

Bases: OmDataSourceProtocol

See documentation of the __init__ function.

__init__(*, data_source_name, monitor_parameters)

Event identifiers from full path of files.

This class deals with the retrieval of unique event identifiers for file-based data events that do not provide this information in any other way. It takes the full path to the data file as event identifier.

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 full file path event identifier data source.

Please see the documentation of the base Protocol class for additional information about this method.

No initialization is needed to retrieve an event identifier from a full file path, so this function actually does nothing.

get_data(*, event)

Retrieves the event identifier from the full path of a file.

Please see the documentation of the base Protocol class for additional information about this method.

This function retrieves a unique event identifier for the provided file-based event, using as identifier the full path of the file attached to the event.

Parameters:

Name Type Description Default
event Dict[str, Any]

A dictionary storing the event data.

required

Returns:

Type Description
str

A unique event identifier.

EventIdJungfrau1MFiles

Bases: OmDataSourceProtocol

See documentation of the __init__ function.

__init__(*, data_source_name, monitor_parameters)

Event identifiers for Jungfrau 1M data events.

This class deals with the retrieval of unique event identifiers for Jungfrau 1M file-based data events.

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 Jungfrau 1M event identifier data source.

Please see the documentation of the base Protocol class for additional information about this method.

No initialization is needed to retrieve event identifiers for Jungfrau 1M data events, so this function actually does nothing.

get_data(*, event)

Retrieves the event identifier for a Jungfrau 1M data event.

Please see the documentation of the base Protocol class for additional information about this method.

This function constructs the event identifier for the provided file-based event by joining the following elements in a single string, with the "//" symbol placed between them.

  • The full path to the HDF5 file attached to the event.

  • The index, within the file, of the frame being processed.

Parameters:

Name Type Description Default
event Dict[str, Any]

A dictionary storing the event data.

required

Returns:

Type Description
str

A unique event identifier.

EventIdEiger16MFiles

Bases: OmDataSourceProtocol

See documentation of the __init__ function.

__init__(*, data_source_name, monitor_parameters)

Event identifiers for Eiger 16M data events.

This class deals with the retrieval of unique event identifiers for an Eiger 16M file-based data events.

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 Eiger 16M event identifier data source.

Please see the documentation of the base Protocol class for additional information about this method.

No initialization is needed retrieve event identifiers for Eiger 16M data events, so this function actually does nothing.

get_data(*, event)

Retrieves the event identifier for an Eiger 16M data event.

Please see the documentation of the base Protocol class for additional information about this method.

This function constructs the event identifier for the provided file-based event by joining the following elements in a single string, with the "//" symbol placed between them.

  • The full path to the HDF5 file attached to the provided event.

  • The index, within the file, of the frame being processed.

Parameters:

Name Type Description Default
event Dict[str, Any]

A dictionary storing the event data.

required

Returns:

Type Description
str

A unique event identifier.

EventIdLambda1M5Files

Bases: OmDataSourceProtocol

See documentation of the __init__ function.

__init__(*, data_source_name, monitor_parameters)

Event identifiers for Lambda 1.5M data events.

This class deals with the retrieval of unique event identifiers for a Lambda 1.5M data events.

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 Lambda 1.5M event identifier data source.

Please see the documentation of the base Protocol class for additional information about this method.

No initialization is needed to retrieve event identifiers for Lambda 1.5M data events, so this function actually does nothing.

get_data(*, event)

Retrieves the event identifier for an Lambda 1.5M data event.

Please see the documentation of the base Protocol class for additional information about this method.

This function constructs the event identifier for the provided file-based event by joining the following elements in a single string, with the "//" symbol placed between them.

  • The full path to the HDF5 file attached to the event and written by the first detector module,

  • The index, within the file, of the frame being processed.

Parameters:

Name Type Description Default
event Dict[str, Any]

A dictionary storing the event data.

required

Returns:

Type Description
str

A unique event identifier.