8.6.1.4. pymodaq_data.h5modules.data_saving module
Created the 21/11/2022
@author: Sebastien Weber
- class pymodaq_data.h5modules.data_saving.AxisSaverLoader(h5saver)[source]
Bases:
DataManagementSpecialized Object to save and load Axis object to and from a h5file
- Parameters:
h5saver (
H5SaverLowLevel)
- data_type
The enum for this type of data, here ‘axis’
- Type:
DataType
Methods
add_axis(where, axis[, enlargeable])Write Axis info at a given position within a h5 file
get_axes(where)Return a list of Axis objects from the Axis Nodes hanging from (or among) a given Node
load_axis(where)create an Axis object from the data and metadata at a given node if of data_type: 'axis
- add_axis(where, axis, enlargeable=False)[source]
Write Axis info at a given position within a h5 file
- get_axes(where)[source]
Return a list of Axis objects from the Axis Nodes hanging from (or among) a given Node
- class pymodaq_data.h5modules.data_saving.BkgSaver(h5saver)[source]
Bases:
DataSaverLoaderSpecialized Object to save and load DataWithAxes background object to and from a h5file
- Parameters:
hsaver (
H5SaverLowLevel)
- data_type
The enum for this type of data, here ‘bkg’
- Type:
DataType
- class pymodaq_data.h5modules.data_saving.DataEnlargeableSaver(h5saver, enl_axis_names=('nav axis',), enl_axis_units=('',))[source]
Bases:
DataSaverLoaderSpecialized Object to save and load enlargeable DataWithAxes saved object to and from a h5file
Particular case of DataND with a single nav_indexes parameter will be appended as chunks of signal data
- Parameters:
h5saver (
Union[H5SaverLowLevel,Path])
- data_type
The enum for this type of data, here ‘data_enlargeable’
- Type:
DataType
Notes
To be used to save data from a timed logger (DAQViewer continuous saving or DAQLogger extension) or from an adaptive scan where the final shape is unknown or other module that need this feature
Methods
add_data(where, data[, axis_values])Append data to an enlargeable array node
- add_data(where, data, axis_values=None, **kwargs)[source]
Append data to an enlargeable array node
Data of dim (0, 1 or 2) will be just appended to the enlargeable array.
Uniform DataND with one navigation axis of length (Lnav) will be considered as a collection of Lnav signal data of dim (0, 1 or 2) and will therefore be appended as Lnav signal data
- Parameters:
where (
Union[Node,str]) – the path of a given node or the node itselfdata (
DataWithAxes)axis_values (
Iterable[float]) – the new spread axis values added to the data if None the axes are not added to the h5 file
- class pymodaq_data.h5modules.data_saving.DataExtendedSaver(h5saver, extended_shape)[source]
Bases:
DataSaverLoaderSpecialized Object to save and load DataWithAxes saved object to and from a h5file in extended arrays
- Parameters:
h5saver (
H5SaverLowLevel)extended_shape (
Tuple[int]) – the extra shape compared to the data the h5array will have
- data_type
The enum for this type of data, here ‘data’
- Type:
DataType
Methods
add_data(where, data, indexes[, distribution])Adds given DataWithAxes at a location within the initialized h5 array
- add_data(where, data, indexes, distribution=DataDistribution.uniform)[source]
Adds given DataWithAxes at a location within the initialized h5 array
- Parameters:
where (
Union[Node,str]) – the path of a given node or the node itselfdata (
DataWithAxes)indexes (
List[int]) – indexes where to save data in the init h5array (should have the same length as extended_shape and with values coherent with this shape
- class pymodaq_data.h5modules.data_saving.DataLoader(h5saver)[source]
Bases:
objectSpecialized Object to load DataWithAxes object from a h5file
On the contrary to DataSaverLoader, does include navigation axes stored elsewhere in the h5file (for instance if saved from the DAQ_Scan)
- Parameters:
h5saver (
Union[H5SaverLowLevel,Path])- Attributes:
- h5saver
Methods
get_nav_group(where)get_node(where[, name])Convenience method to get node
load_data(where[, with_bkg, load_all])Load data from a node (or channel node)
walk_nodes([where])Return a Node generator iterating over the h5file content
close_file
load_all
- Parameters:
where (
Union[Node,str]) – the path of a given node or the node itself- Return type:
- Returns:
GROUP (
returns the group named SPECIAL_GROUP_NAMES[``’nav_axes’``] holding all NavAxis for)those data
See also
SPECIAL_GROUP_NAMES
- load_data(where, with_bkg=False, load_all=False)[source]
Load data from a node (or channel node)
Loaded data contains also nav_axes if any and with optional background subtraction
- Parameters:
- Return type:
- property h5saver
- class pymodaq_data.h5modules.data_saving.DataManagement(*args, **kwargs)[source]
Bases:
objectBase abstract class to be used for all specialized object saving and loading data to/from a h5file
- data_type
The enum for this type of data, here abstract and should be redefined
- Type:
DataType
Methods
get_last_node_name(where)Get the last node name among the ones already saved
close
close_file
get_index_from_node_name
get_node_from_index
- class pymodaq_data.h5modules.data_saving.DataSaverLoader(h5saver)[source]
Bases:
DataManagementSpecialized Object to save and load DataWithAxes object to and from a h5file
- Parameters:
h5saver (
Union[H5SaverLowLevel,Path])
- data_type
The enum for this type of data, here ‘data’
- Type:
DataType
Methods
add_data(where, data[, save_axes])Adds Array nodes to a given location adding eventually axes as others nodes and metadata
get_axes(where)get_data_arrays(where[, with_bkg, load_all])isopen()Get the opened status of the underlying hdf5 file
load_data(where[, with_bkg, load_all])Return a DataWithAxes object from the Data and Axis Nodes hanging from (or among) a given Node
get_bkg_nodes
- add_data(where, data, save_axes=True, **kwargs)[source]
Adds Array nodes to a given location adding eventually axes as others nodes and metadata
- Parameters:
where (
Union[Node,str]) – the path of a given node or the node itselfdata (
DataWithAxes)save_axes (
bool)
- load_data(where, with_bkg=False, load_all=False)[source]
Return a DataWithAxes object from the Data and Axis Nodes hanging from (or among) a given Node
Does not include navigation axes stored elsewhere in the h5file. The node path is stored in the DatWithAxis using the attribute path
- Parameters:
See also
- Return type:
- class pymodaq_data.h5modules.data_saving.DataToExportEnlargeableSaver(h5saver, enl_axis_names=None, enl_axis_units=None, axis_name='nav axis', axis_units='')[source]
Bases:
DataToExportSaverGeneric object to save DataToExport objects in an enlargeable h5 array
The next enlarged value should be specified in the add_data method
- Parameters:
h5saver (
H5SaverLowLevel)enl_axis_names (
Iterable[str]) – The names of the enlargeable axis, default [‘nav_axis’]enl_axis_units (
Iterable[str]) – The names of the enlargeable axis, default [‘’]axis_name (
str) – the name of the enlarged axis arrayaxis_units (
str) – the units of the enlarged axis array
Methods
add_data(where, data[, axis_values, ...])- add_data(where, data, axis_values=None, axis_value=None, settings_as_xml='', **kwargs)[source]
- Parameters:
where (
Union[Node,str]) – the path of a given node or the node itselfdata (
DataToExport) – The data to be saved into an enlargeable arrayaxis_values (
List[Union[float,ndarray]]) – The next value (or values) of the enlarged axisaxis_value (
Union[float,ndarray]) – The next value (or values) of the enlarged axissettings_as_xml (
str) – The settings parameter as an XML stringArguments (Keyword) – all extra metadata to be saved in the group node where data will be saved
- class pymodaq_data.h5modules.data_saving.DataToExportExtendedSaver(h5saver, extended_shape)[source]
Bases:
DataToExportSaverObject to save DataToExport at given indexes within arrays including extended shape
Mostly used for data generated from the DAQScan
- Parameters:
h5saver (
H5SaverLowLevel)extended_shape (
Tuple[int]) – the extra shape compared to the data the h5array will have
Methods
add_data(where, data, indexes[, ...])add_nav_axes(where, axes)Used to add navigation axes related to the extended array
- add_data(where, data, indexes, distribution=DataDistribution.uniform, settings_as_xml='', **kwargs)[source]
- Parameters:
where (
Union[Node,str]) – the path of a given node or the node itselfdata (
DataToExport)indexes (
Iterable[int]) – indexes where to save data in the init h5array (should have the same length as extended_shape and with values coherent with this shapesettings_as_xml (
str) – The settings parameter as an XML stringArguments (Keyword) – all extra metadata to be saved in the group node where data will be saved
Used to add navigation axes related to the extended array
Notes
For instance the scan axes in the DAQScan
- class pymodaq_data.h5modules.data_saving.DataToExportSaver(h5saver, save_type=SaveType.scan)[source]
Bases:
objectObject used to save DataToExport object into a h5file following the PyMoDAQ convention
- Parameters:
h5saver (
Union[H5SaverLowLevel,Path,str])
Methods
add_data(where, data[, settings_as_xml])channel_formatter(ind)All DataWithAxes included in the DataToExport will be saved into a channel group indexed and formatted as below
isopen()Get the opened status of the underlying hdf5 file
add_bkg
add_error
close
close_file
- static channel_formatter(ind)[source]
All DataWithAxes included in the DataToExport will be saved into a channel group indexed and formatted as below
- add_data(where, data, settings_as_xml='', **kwargs)[source]
- Parameters:
where (
Union[Node,str]) – the path of a given node or the node itselfdata (
DataToExport)settings_as_xml (
str) – The settings parameter as an XML stringArguments (Keyword) – all extra metadata to be saved in the group node where data will be saved
- class pymodaq_data.h5modules.data_saving.DataToExportTimedSaver(h5saver)[source]
Bases:
DataToExportEnlargeableSaverSpecialized DataToExportEnlargeableSaver to save data as a function of a time axis
Only one element ca be added at a time, the time axis value are enlarged using the data to be added timestamp
Notes
This object is made for continuous saving mode of DAQViewer and logging to h5file for DAQLogger
Methods
add_data(where, data[, settings_as_xml])
- class pymodaq_data.h5modules.data_saving.ErrorSaverLoader(h5saver)[source]
Bases:
DataSaverLoaderSpecialized Object to save and load DataWithAxes errors bars to and from a h5file
- Parameters:
hsaver (
H5SaverLowLevel)
- data_type
The enum for this type of data, here ‘error’
- Type:
DataType