This notebook is intended to show the readout of created hdf5 files with python. For the handling of the measured file qkit provides a file info database (fid) for convenient access to the stored data, for more info on that see the corresponding notebook.
The readout (as well as the storage in the first place) is done with the store.Data
module.
In [ ]:
## start qkit and import the needed modules. we here assume an already configured qkit analysis environment
import qkit
qkit.start()
from qkit.storage.store import Data
The qkit.start()
starts the fid which searches the given qkit.conf['datadir']
for hdf5 files. A python dict is created, mapping the 6-digit timestamp of the measurement (UUID) to its absolute path on the hard drive. For getting the absolute path of the measurement file usethe qkit.fid.get
command with the UUID.
In [ ]:
abs_path = qkit.fid.get('XXXXXX')
To open a measurement and get the information a h5 object has to be created
In [ ]:
h5 = Data(qkit.fid.get('XXXXXX'))
The data and metadata can be accessed via the h5 object. All the needed information can be auto-compleded via tabbing.
In [ ]:
amp = h5.data.amplitude[:] # gets the measurement data as numpy array
pha = h5.data.phase[:]
## general rule: h5.[folder].[ds_name] gives the dataset, '[:]' gives the bare data cast to a numpy array
## already analyzed data is stored in the 'analysis' folder
In [ ]:
# all stored metadata can be accessed by auto-complete as well
x_ds_url = h5.data.amplitude.x_ds_url
comment = h5.data.comment
The UUID can also be reverted back to recover the time the file was created.
In [ ]:
qkit.fid.get_date('XXXXXX')
In [ ]: