def test_simulated_digitizer(self, fig=None, verbose=0): station = qtt.simulation.virtual_dot_array.initialize(reinit=True, nr_dots=3, maxelectrons=2, verbose=verbose) station.model.sdnoise = .05 station.gates.B0(-300) station.gates.B3(-300) awg = SimulationAWG(qtt.measurements.scans.instrumentName('test_simulation_awg')) waveform, _ = awg.sweep_gate('B3', 400, 1e-3) digitizer = SimulationDigitizer(qtt.measurements.scans.instrumentName('test_digitizer'), model=station.model) r = digitizer.measuresegment(waveform, channels=[1]) self.assertTrue(isinstance(r[0], np.ndarray)) if fig: plt.figure(fig) plt.clf() plt.plot(r[0], label='signal from simulation digitizer') plt.close('all') awg.close() digitizer.close() qtt.simulation.virtual_dot_array.close(verbose=verbose)
def guitest_videomode(): import pyqtgraph _ = pyqtgraph.mkQApp() from qtt.instrument_drivers.simulation_instruments import SimulationDigitizer from qtt.instrument_drivers.simulation_instruments import SimulationAWG assert(VideoMode.get_instance(-1) is None) import qtt.simulation.virtual_dot_array station = qtt.simulation.virtual_dot_array.initialize() digitizer = SimulationDigitizer( qtt.measurements.scans.instrumentName('sdigitizer'), model=station.model) station.add_component(digitizer) station.awg = SimulationAWG(qtt.measurements.scans.instrumentName('vawg')) station.add_component(station.awg) sweepparams = {'gates_horz': {'P1': 1}, 'gates_vert': {'P2': 1}} minstrument = (digitizer.name, [0]) vm = VideoMode(station, sweepparams, sweepranges=[120] * 2, minstrument=minstrument, resolution=[12] * 2, Naverage=2) vm.stop() vm.close() all = VideoMode.all_instances(verbose=0) assert(vm in all)
def test_video_mode_get_data_set(self, verbose=0): with mock.patch('sys.stdout', new_callable=io.StringIO) as mock_stdout: station = qtt.simulation.virtual_dot_array.initialize( reinit=True, verbose=verbose) digitizer = SimulationDigitizer( qtt.measurements.scans.instrumentName('sdigitizer'), model=station.model) station.add_component(digitizer) station.awg = SimulationAWG( qtt.measurements.scans.instrumentName('vawg')) station.add_component(station.awg) sweepparams = {'gates_horz': {'P1': 1}, 'gates_vert': {'P2': 1}} minstrument = (digitizer.name, [0]) vm = VideoMode(station, sweepparams, sweepranges=[120] * 2, minstrument=minstrument, resolution=[12] * 2, Naverage=2) vm.stop() vm.updatebg() data = vm.get_dataset() vm.close() self.assertIsInstance(data, list) self.assertIsInstance(data[0], qcodes.DataSet) self.assertEqual(data[0].measured.shape, (12, 12)) vm = VideoMode(station, ['P1', 'P2'], sweepranges=[20] * 2, minstrument=minstrument, resolution=[32] * 2, Naverage=2) vm.stop() vm.updatebg() data = vm.get_dataset() vm.close() self.assertIsInstance(data, list) self.assertIsInstance(data[0], qcodes.DataSet) self.assertEqual(data[0].measured.shape, (32, 32)) for _, instrument in station.components.items(): instrument.close() qtt.simulation.virtual_dot_array.close(verbose=verbose) std_output = mock_stdout.getvalue() print(std_output) self.assertIn('VideoMode: start readout', std_output)
def test_video_1d(self): with mock.patch('sys.stdout', new_callable=io.StringIO): station = qtt.simulation.virtual_dot_array.initialize(reinit=True, verbose=0) digitizer = SimulationDigitizer( qtt.measurements.scans.instrumentName('sdigitizer'), model=station.model) station.add_component(digitizer) station.awg = SimulationAWG(qtt.measurements.scans.instrumentName('vawg')) station.add_component(station.awg) minstrument = (digitizer.name, [0]) videomode = VideoMode(station, 'P1', sweepranges=[120], minstrument=minstrument, Naverage=2) self.assertEqual(videomode.videomode_processor.scan_dimension(), 1)
def test_videomode_getdataset(self): station = qtt.simulation.virtual_dot_array.initialize(reinit=True, verbose=0) digitizer = SimulationDigitizer( qtt.measurements.scans.instrumentName('sdigitizer'), model=station.model) station.add_component(digitizer) station.awg = SimulationAWG( qtt.measurements.scans.instrumentName('vawg')) station.add_component(station.awg) sweepparams = {'gates_horz': {'P1': 1}, 'gates_vert': {'P2': 1}} minstrument = (digitizer.name, [0]) vm = VideoMode(station, sweepparams, sweepranges=[120] * 2, minstrument=minstrument, resolution=[12] * 2, Naverage=2) vm.stop() vm.updatebg() data = vm.get_dataset() vm.close() self.assertIsInstance(data, list) self.assertIsInstance(data[0], qcodes.DataSet) self.assertEqual(data[0].measured.shape, (12, 12)) vm = VideoMode(station, ['P1', 'P2'], sweepranges=[20] * 2, minstrument=minstrument, resolution=[32] * 2, Naverage=2) vm.stop() vm.updatebg() data = vm.get_dataset() vm.close() self.assertIsInstance(data, list) self.assertIsInstance(data[0], qcodes.DataSet) self.assertEqual(data[0].measured.shape, (32, 32)) for name, instrument in station.components.items(): instrument.close() qtt.simulation.virtual_dot_array.close(verbose=0)
def test_video_mode_update_position(self): with mock.patch('sys.stdout', new_callable=io.StringIO): station = qtt.simulation.virtual_dot_array.initialize(reinit=True, verbose=0) digitizer = SimulationDigitizer( qtt.measurements.scans.instrumentName('sdigitizer'), model=station.model) station.add_component(digitizer) minstrument = (digitizer.name, [0]) station.awg = SimulationAWG(qtt.measurements.scans.instrumentName('vawg')) station.add_component(station.awg) vm = VideoMode(station, 'P1', sweepranges=[10.], minstrument=minstrument, resolution=[12], Naverage=2) new_position = 2 vm._update_position((new_position, 0)) self.assertEqual(station.gates.P1(), new_position)
gates = station.gates from qtt.instrument_drivers.simulation_instruments import SimulationDigitizer from qtt.instrument_drivers.simulation_instruments import SimulationAWG #from qtt.gui.live_plotting import * pv = qtt.createParameterWidget([gates]) # type: ignore verbose = 1 multiprocess = False digitizer = SimulationDigitizer( qtt.measurements.scans.instrumentName('sdigitizer'), model=station.model) station.components[digitizer.name] = digitizer station.awg = SimulationAWG(qtt.measurements.scans.instrumentName('vawg')) station.components[station.awg.name] = station.awg if 1: sweepparams = ['P1', 'P2'] sweepranges = [160, 80] resolution = [80, 48] minstrument = (digitizer.name, [0, 1]) else: sweepparams = 'B0' sweepranges = 160 resolution = [60] minstrument = (digitizer.name, [0]) station.model.sdnoise = .1 vm = VideoMode(station, sweepparams, sweepranges, minstrument, Naverage=25, resolution=resolution, sample_rate='default', diff_dir=None,
def initialize(reinit=False, nr_dots=2, maxelectrons=2, verbose=2, start_manager=False): global station, _initialized, model logger.info('virtualDot: start') if verbose >= 2: print('initialize: create virtual dot system') if _initialized: if reinit: close(verbose=verbose) else: return station logger.info('virtualDot: make DotModel') model = DotModel(name=qtt.measurements.scans.instrumentName('dotmodel'), verbose=verbose >= 3, nr_dots=nr_dots, maxelectrons=maxelectrons, sdplunger='SD1b') gate_map = model.gate_map if verbose >= 2: logger.info('initialize: DotModel created') ivvis = [] for ii in range(model.nr_ivvi): ivvis.append(VirtualIVVI(name='ivvi%d' % (ii + 1), model=model)) gates = virtual_gates(name='gates', gate_map=gate_map, instruments=ivvis) gates.set_boundaries(gate_boundaries(gate_map)) logger.info('initialize: set values on gates') gates.set('D0', 101) for g in model.gates: gates.set(g, np.random.rand() - .5) # take into account the voltage divider on the ohmics for g in gates.parameters.keys(): if g.startswith('O'): gg = getattr(gates, g) gg.unit = 'uV' vawg = SimulationAWG(qtt.measurements.scans.instrumentName('vawg')) logger.info('initialize: create virtual keithley instruments') keithley1 = VirtualMeter('keithley1', model=model) keithley3 = VirtualMeter('keithley3', model=model) keithley4 = VirtualMeter('keithley4', model=model) digitizer = SimulationDigitizer( qtt.measurements.scans.instrumentName('sdigitizer'), model=model) logger.info('initialize: create station') station = qcodes.Station(gates, keithley1, keithley3, keithley4, *ivvis, vawg, digitizer, update_snapshot=False) station.awg = station.vawg station.metadata['sample'] = 'virtual_dot' station.model = model station.gate_settle = gate_settle station.depletiongate_name = 'D0' station.bottomchannel_current = station.keithley3.amplitude station.jobmanager = None station.calib_master = None _initialized = True if verbose: print('initialized virtual dot system (%d dots)' % nr_dots) return station