def button1D_clicked(): testInstrument = MockParabola(name='test1D') testInstrument.noise(1) sweep = Sweep1D(testInstrument.x,start=0,stop=1,step = 0.01, save_data=True,inter_delay = 0.3) follow_parameters = { testInstrument.parabola, testInstrument.skewed_parabola, } sweep.follow_param(*follow_parameters) database_name = "test_sweep.db" exp_name = __name__ sample_name = 'test1D' init_database(database_name, exp_name, sample_name, sweep) sweep.start()
def test_loop_writing_2D(self): # pass station = Station() MockPar = MockParabola(name='Loop_writing_test_2D') station.add_component(MockPar) loop = Loop(MockPar.x[-100:100:20]).loop(MockPar.y[-50:50:10]).each( MockPar.skewed_parabola) data1 = loop.run(name='MockLoop_hdf5_test', formatter=self.formatter) data2 = DataSet(location=data1.location, formatter=self.formatter) data2.read() for key in data2.arrays.keys(): self.checkArraysEqual(data2.arrays[key], data1.arrays[key]) metadata_equal, err_msg = compare_dictionaries(data1.metadata, data2.metadata, 'original_metadata', 'loaded_metadata') self.assertTrue(metadata_equal, msg='\n' + err_msg) self.formatter.close_file(data1) self.formatter.close_file(data2) MockPar.close()
import os import datetime import numpy as np import scipy.optimize as opt import matplotlib.pyplot as plt import qcodes as qc from qcodes.dataset.plotting import plot_dataset from qcodes.dataset.data_set import load_by_run_spec from qcodes.dataset.sqlite.database import initialise_or_create_database_at from qcodes.dataset.experiment_container import load_or_create_experiment from qcodes.tests.instrument_mocks import MockParabola station = qc.station.Station() station.add_component(MockParabola(name='MockParabola')) class MyCounter(qc.Parameter): def __init__(self, name): # only name is required super().__init__( name, label='Times this has been read', docstring='counts how many times get has been called ' 'but can be reset to any integer >= 0 by set') self._count = 0 # you must provide a get method, a set method, or both. def get_raw(self): self._count += 1 return self._count