Exemplo n.º 1
0
    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)
Exemplo n.º 2
0
    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)
Exemplo n.º 3
0
    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)