Datasaving Examples¶
[1]:
%matplotlib nbagg
from importlib import reload
import numpy as np
from qcodes.station import Station
import qcodes_loop.data.data_set
from qcodes_loop.loops import Loop
Logging hadn't been started.
Activating auto-logging. Current session state plus future input saved.
Filename : C:\Users\Jens-Work\.qcodes\logs\command_history.log
Mode : append
Output logging : True
Raw input log : False
Timestamping : True
State : active
Qcodes Logfile : C:\Users\Jens-Work\.qcodes\logs\201004-29284-qcodes.log
[2]:
import logging
import sys
# Create logger
logger = logging.getLogger()
logger.setLevel(logging.DEBUG)
# Create STDERR handler
handler = logging.StreamHandler(sys.stderr)
# ch.setLevel(logging.DEBUG)
# Create formatter and add it to the handler
formatter = logging.Formatter('%(name)s - %(levelname)s - %(message)s')
handler.setFormatter(formatter)
# Set STDERR handler as the only handler
logger.handlers = [handler]
[3]:
from qcodes_loop.data import hdf5_format
reload(hdf5_format)
h5fmt = hdf5_format.HDF5Format()
Start a loop and generate data from dummy instruments¶
[4]:
station = Station()
[5]:
from qcodes.instrument_drivers.mock_instruments import MockParabola
station.add_component(MockParabola(name='MockParabola'))
qcodes.instrument.base - DEBUG - [MockParabola(MockParabola)] Error getting or interpreting *IDN?: ''
[5]:
'MockParabola'
[6]:
loop = Loop(station.MockParabola.x[-100:100:20]).each(station.MockParabola.skewed_parabola)
data_l = loop.run(name='MockParabola_run', formatter=qc.data.gnuplot_format.GNUPlotFormat())
qcodes.data.data_set - DEBUG - Attempting to write
qcodes.data.gnuplot_format - DEBUG - Attempting to write the following group: MockParabola_x_set
qcodes.data.gnuplot_format - DEBUG - Cannot match save range, skipping this group.
qcodes.data.data_set - DEBUG - Finalising the DataSet. Writing.
qcodes.data.gnuplot_format - DEBUG - Attempting to write the following group: MockParabola_x_set
qcodes.data.gnuplot_format - DEBUG - Wrote header to file
qcodes.data.gnuplot_format - DEBUG - Wrote to file from 0 to 10
Started at 2020-10-04 11:50:36
DataSet:
location = 'data/2020-10-04/#001_MockParabola_run_11-50-36'
<Type> | <array_id> | <array.name> | <array.shape>
Setpoint | MockParabola_x_set | x | (10,)
Measured | MockParabola_skewed_parabola | skewed_parabola | (10,)
Finished at 2020-10-04 11:50:36
[7]:
reload(hdf5_format)
h5fmt = hdf5_format.HDF5Format()
loop = Loop(station.MockParabola.x[-100:100:20]).loop(
station.MockParabola.y[-100:50:10]).each(station.MockParabola.skewed_parabola)
data_l = loop.run(name='MockParabola_run', formatter=h5fmt)
qcodes.data.data_set - DEBUG - Attempting to write
qcodes.data.data_set - DEBUG - Finalising the DataSet. Writing.
Started at 2020-10-04 11:50:36
DataSet:
location = 'data/2020-10-04/#002_MockParabola_run_11-50-36'
<Type> | <array_id> | <array.name> | <array.shape>
Setpoint | MockParabola_x_set | x | (10,)
Setpoint | MockParabola_y_set | y | (10, 15)
Measured | MockParabola_skewed_parabola | skewed_parabola | (10, 15)
Finished at 2020-10-04 11:50:36
[8]:
from importlib import reload
from qcodes_loop.data import hdf5_format
reload(hdf5_format)
h5fmt = hdf5_format.HDF5Format()
data2 = qcodes_loop.data.data_set.DataSet(location=data_l.location, formatter=h5fmt)
data2.read()