%matplotlib nbagg
import numpy as np
from importlib import reload
import qcodes as qc
from qcodes.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
import sys
import logging
# 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]
from qcodes.data import hdf5_format
reload(hdf5_format)
h5fmt = hdf5_format.HDF5Format()
station = qc.station.Station()
from qcodes.tests.instrument_mocks import MockParabola
station.add_component(MockParabola(name='MockParabola'))
qcodes.instrument.base - DEBUG - [MockParabola(MockParabola)] Error getting or interpreting *IDN?: ''
'MockParabola'
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
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
from importlib import reload
from qcodes.data import hdf5_format
reload(hdf5_format)
h5fmt = hdf5_format.HDF5Format()
data2 = qc.data.data_set.DataSet(location=data_l.location, formatter=h5fmt)
data2.read()
from qcodes.utils import helpers
reload(helpers)
reload(hdf5_format)
import unittest
h5fmt = hdf5_format.HDF5Format()
import qcodes.tests.legacy.test_hdf5formatter as tf
reload(tf)
tst = tf.TestHDF5_Format
suite = unittest.defaultTestLoader.loadTestsFromTestCase(tst)
result = unittest.TextTestRunner(verbosity=2).run(suite)
test_closed_file (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) ... root - WARNING - Cannot close file, data_set has no open hdf5 file root - WARNING - Cannot close file, data_set has no open hdf5 file ok test_dataset_closing (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) ... ok test_dataset_finalize_closes_file (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) ... qcodes.data.data_set - DEBUG - Finalising the DataSet. Writing. ok test_dataset_flush_after_write (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) ... ok test_dataset_with_missing_attrs (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) ... ok test_double_closing_gives_warning (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) ... ok test_full_write_read_1D (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) Test writing and reading a file back in ... ok test_full_write_read_2D (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) Test writing and reading a file back in ... ok test_incremental_write (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) ... ok test_loop_writing (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) ... qcodes.instrument.base - DEBUG - [Loop_writing_test(MockParabola)] Error getting or interpreting *IDN?: '' qcodes.data.data_set - DEBUG - Attempting to write qcodes.data.data_set - DEBUG - Finalising the DataSet. Writing. ok test_loop_writing_2D (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) ... qcodes.instrument.base - DEBUG - [Loop_writing_test_2D(MockParabola)] Error getting or interpreting *IDN?: '' qcodes.data.data_set - DEBUG - Attempting to write qcodes.data.data_set - DEBUG - Finalising the DataSet. Writing. ok test_metadata_write_read (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) Test is based on the snapshot of the 1D dataset. ... ok test_partial_dataset (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) ... ok test_read_writing_dicts_withlists_to_hdf5 (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) ... ok test_reading_into_existing_data_array (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) ... ok test_str_to_bool (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) ... ok test_writing_metadata (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) ... ok test_writing_unsupported_types_to_hdf5 (qcodes.tests.legacy.test_hdf5formatter.TestHDF5_Format) Tests writing of ... root - WARNING - Type "<class 'qcodes.data.data_set.DataSet'>" for "nested_dataset":"DataSet: location = 'c:\\users\\jens-work\\source\\repos\\qcodes\\qcodes\\tests\\unittest_data/2020-10-04/#036_test_missing_attr_11-50-36' <Type> | <array_id> | <array.name> | <array.shape>" not supported, storing as string root - WARNING - List of type "<class 'qcodes.data.data_set.DataSet'>" for "list_of_dataset":"[DataSet: location = 'c:\\users\\jens-work\\source\\repos\\qcodes\\qcodes\\tests\\unittest_data/2020-10-04/#036_test_missing_attr_11-50-36' <Type> | <array_id> | <array.name> | <array.shape>, DataSet: location = 'c:\\users\\jens-work\\source\\repos\\qcodes\\qcodes\\tests\\unittest_data/2020-10-04/#036_test_missing_attr_11-50-36' <Type> | <array_id> | <array.name> | <array.shape>]" not supported, storing as string
Started at 2020-10-04 11:50:36 DataSet: location = 'c:\\users\\jens-work\\source\\repos\\qcodes\\qcodes\\tests\\unittest_data/2020-10-04/#029_MockLoop_hdf5_test_11-50-36' <Type> | <array_id> | <array.name> | <array.shape> Setpoint | Loop_writing_test_x_set | x | (10,) Measured | Loop_writing_test_skewed_parabola | skewed_parabola | (10,) Finished at 2020-10-04 11:50:36 Started at 2020-10-04 11:50:36 DataSet: location = 'c:\\users\\jens-work\\source\\repos\\qcodes\\qcodes\\tests\\unittest_data/2020-10-04/#030_MockLoop_hdf5_test_11-50-36' <Type> | <array_id> | <array.name> | <array.shape> Setpoint | Loop_writing_test_2D_x_set | x | (10,) Setpoint | Loop_writing_test_2D_y_set | y | (10, 10) Measured | Loop_writing_test_2D_skewed_parabola | skewed_parabola | (10, 10) Finished at 2020-10-04 11:50:36
ok ---------------------------------------------------------------------- Ran 18 tests in 0.302s OK