components.dataset_keyvalue

Module Contents

Classes

Dataset_KeyValue

Dataset_KeyValue class is used as a converter between a dictionary formated in an HDF5 storable way to a hdf file

class components.dataset_keyvalue.Dataset_KeyValue(name, path=None)

Bases: Storage

Dataset_KeyValue class is used as a converter between a dictionary formated in an HDF5 storable way to a hdf file

Parameters
  • Name (str) – Name of the whole HDF file/Run

  • Path (str) – The storage path

  • name (str) –

  • path (str) –

Examples

DictToHDF_1 = Dataset_KeyValue(“run1”, ‘C:/Users/Administrator/Desktop/pykkn/test/test_key_value.h5’)

DictToHDF_1.nested_dict(dict)

nested_dict(self, Dict, _last_group=None, _key=None, _nested_group=None)

Expects a Dictionary that starts with run

Parameter: 1. see if dictname = parameter; 2. if last group = parameter, go into dict and create parameter for each (e. g.: gain, offset ) 3. Go into the parameters and add the attributes

Data is similar to parameter, just that we add data instead

XXXXXXXXXX data kann also have attributes —-> How would attributes look in a JSON-> Dict?

_Groupstr

parameter to be used by the recursive function; describes the last “wrapper class” (pipeline,instruments,model)

_last_groupstr

parameter to be used by the recursive function

Dictlist, tuple, dict

nested key value pairs –> Dicti[key]: whole dictionary is called by the name Dicti, to get a single value Dicti[key] is called Dict structure => Dicti = {key : value, .. ,}