Data loading and analysis

Loading data

To load previously measured data, the easiest way is to load by the counter number.

qc.load_data_num(number)

Number can be a string or an integer. e.g.

data=qc.load_data_num(123) or data=qc.load_data_num(‘2’)

If the folder your data is in isn’t just ‘data’, you can use the datafolder argument. Likewise, if underscore (‘_’) doesn’t appear after the number in your data file names, you need to specify what does.

data=qc.load_data_num(123,datafolder='magneticfielddata',delimiter=' ')

But for most cases, you can simply exclude datafolder and delimiter to use the default values.

For loading multiple data files, use

qc.load_data_nums(listofnumbers,datafolder=”data”,delimiter='_')

e.g.

datafiles=qc.load_data_nums([2,123,436,20])

or even

datafiles=qc.load_data_nums([x*2+12 for x in range(4)])

To load a filepath directly,

data=qc.load_data('path/to/datafile')

DataArrays

When imported, you can use data.param_name to access the data from a specific parameter. Other information, e.g. name, unit, etc is available using e.g. data.Voltage.unit. The data are also stored in a dictionary under data.arrays, which means you can address arrays via strings, e.g. data.arrays['Voltage'], which is useful for programattically addressing them (e.g. in a loop).

Each of these DataArray elements inside the DataSetPP at heart are just numpy.ndarray objects with some extra details ontop. They will mostly behave like numpy arrays, but if you want to access the underlying ndarray directly, use data.param_name.ndarray.

Metadata

data.metadata is a python dictionary containing the metadata saved by the Station. It contains, among other things, the value of every single parameter of every single instrument declared in ``station`` when the measurement started. This is extremely useful two years into your project and you forgot which lock-in time constant you used. This is the entire point of creating the Station and ensuring that you keep it updated. The offline_plotting also offers an easy-to-use tool for metadata exploration.

Incomplete DataSets

If you terminate a Loop before it finishes, the remaining data will be NaNs. Upon load, NaNs are ‘removed’ from the arrays by finding the first NaN index, N, in the innermost independent parameter. Columns with an index larger than N-1 will be stripped from the arrays. If the measurement was stopped mid-column, this column will not be loaded to ensure the data behaves nicely for e.g. matplotlib pcolormesh. If this is not the desired behaviour, use remove_incomplete=False in any of the above load functions. Data on disk is not affected.

Plotting and analysis

For cases not covered by the built-in live_plot or offline_plotting, you will likely prepare plots using matplotlib. There are a few useful functions in qcodes++ to help you with this.

  • You can use the functions in qcodespp.colorplot and qcodespp.colored_traces to quickly plot decent-looking colorplots and line plots colored according to a matplotlib colormap.

  • You can use the fitting and filter functions from qcodespp.plotting.offline_plotting.fits and qcodespp.plotting.offline_plotting.filters either directly, or as inspiration for your own fitting and filtering functions.

See API (analysis_tools, fits, filters) and/or source code to see how to use these functions.