Read data
ParamInfo
Parameter information for items of param_dict
Attributes: id (str): param_dict key value (any): the value of the parameter name (str): full name of the parameter (e.g. Readout frequency) symbol (str): symbol of the parameter in Latex notation (e.g. f_{RO}) unit (str): base unit of measurement (e.g. Hz) scale (int): the scale that should be generally applied to raw data (e.g. 1e-9 to take raw Hz to GHz)
Source code in sqil_core/utils/_read.py
__str__()
to_dict()
Convert ParamInfo to a dictionary.
_enrich_param_dict(param_dict)
Add metadata to param_dict entries.
Source code in sqil_core/utils/_read.py
_h5_to_dict(obj)
Convert h5 data into a dictionary
Source code in sqil_core/utils/_read.py
extract_h5_data(path, keys=None)
Extract data at the given keys from an HDF5 file. If no keys are given (None) returns the data field of the object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
path to the HDF5 file or a folder in which is contained a data.ddh5 file |
required |
keys
|
None or List
|
list of keys to extract from file['data'], by default None |
None
|
Returns:
Type | Description |
---|---|
Dict or Tuple[ndarray, ...]
|
The full data dictionary if keys = None. The tuple with the requested keys otherwise. |
Example
Extract the data object from the dataset:
>>> data = extract_h5_data(path)
Extracting only 'amp' and 'phase' from the dataset:
>>> amp, phase = extract_h5_data(path, ['amp', 'phase'])
Extracting only 'phase':
>>> phase, = extract_h5_data(path, ['phase'])
Source code in sqil_core/utils/_read.py
read_json(path)
read_param_dict(path)
Read param_dict and include additional information for each entry.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
path
|
str
|
Path to the file or a folder in which is contained a param_dict.json file |
required |
Returns:
Type | Description |
---|---|
ParamDict
|
The param_dict with additional metadata |