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_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_VideoMode_all_instances(self): self.assertIsInstance(VideoMode.all_instances(), list) station = qtt.simulation.virtual_dot_array.initialize() dummy_processor = DummyVideoModeProcessor(station) videomode = VideoMode(station, dorun=False, nplots=1, videomode_processor=dummy_processor) self.assertIn(videomode, VideoMode.all_instances()) VideoMode.stop_all_instances()
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_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)
def test_DummyVideoModeProcessor(self): qt_application = pyqtgraph.mkQApp() station = qtt.simulation.virtual_dot_array.initialize() dummy_processor = DummyVideoModeProcessor(station) vm = VideoMode(station, Naverage=25, diff_dir=None, verbose=1, nplots=1, dorun=False, videomode_processor=dummy_processor) vm.updatebg() datasets = vm.get_dataset() vm.close() qtt.simulation.virtual_dot_array.close() self.assertIsInstance(datasets[0], qcodes.DataSet) qt_application.processEvents() time.sleep(.1)
update_scope(period) set_stimulus_oscillator_frequency(frequency) scope_reader.start_acquisition() data_arrays = scope_reader.acquire(number_of_averages=1) scope_reader.stop_acquisition() plt.clf() plt.plot(data_arrays[0].set_arrays[0], data_arrays[0]) plt.show() #%% 2D video mode sample_rate = 220e3 update_scope(sample_rate = sample_rate, trigger_enabled = True) resolution = [96, 96] sweep_gates = [{'P1': 1}, {'P2': 1}] sweep_ranges = [1000, 1000] scope = (scope_reader, [1], ['Demod 1 R']) vm = VideoMode(station, sweep_gates, sweep_ranges, minstrument=scope, resolution=resolution) vm.updatebg() #%% Disable the stimulus update_stimulus(is_enabled=False, signal_output=signal_output, oscillator=oscillator)
station = Station(ivvi, gates, virtual_awg, awg_1, digitizer) #%% from qtt.measurements.scans import scan1Dfast, scanjob_t scanjob = scanjob_t({'minstrument': [1],'Naverage':100,'wait_time_start_scan':2, 'sweepdata': {'param': 'C2','start': 100,'end': 250, 'step': 1,'wait_time': 0.28}}) dataset_measurement_fast = scan1Dfast(station, scanjob) logviewer = DataViewer() logviewer.show() #%% vm = VideoMode(station, 'C1', 50, minstrument=(digitizer.name,[3]), resolution = 50, diff_dir=[None, 'g']) vm.stopreadout() vm.updatebg() #%% virtual_awg.delay_FPGA=-3e-6 vm = VideoMode(station, ['C1','C2'], [40, 40], minstrument=(digitizer.name, [1, 3]), resolution = [96, 96]) vm.stopreadout() vm.updatebg()
_ = station.add_component(virtual_awg) _ = station.add_component(digitizer) #%% from qtt.measurements.scans import scan1Dfast, scanjob_t scanjob = scanjob_t({'minstrument': [0],'Naverage':100,'wait_time_start_scan':2, 'sweepdata': {'param': 'B2','start': 100,'end': 250, 'step': 1,'wait_time': 0.28}}) dataset_measurement_fast = scan1Dfast(station, scanjob) logviewer = DataViewer() logviewer.show() #%% vm = VideoMode(station, 'B0', 50, minstrument=(digitizer.name,[3]), resolution = 50, diff_dir=[None, 'g']) vm.stopreadout() vm.updatebg() #%% vm = VideoMode(station, [{'B0': 1}, {'B2': 1}], [40, 40], minstrument=(digitizer.name, [0, 3]), resolution = [96, 96]) vm.stopreadout() vm.updatebg()
# Initialize the virtual AWG virtual_awg = VirtualAwg([awg], settings) marker_delay = 5.49e-4 virtual_awg.digitizer_marker_delay(marker_delay) marker_uptime = 1e-4 virtual_awg.digitizer_marker_uptime(marker_uptime) # Create the station station = Station(awg, lockin, virtual_awg) station.gates = None # Create and start the video mode measure_channel = 1 video_mode = VideoMode(station, sweepparams='P1', sweepranges=100, minstrument=[lockin, measure_channel], dorun=False) #%% Execute the run or press the run button video_mode.run() #%% awg.disable_channel(4)