Example #1
0
    def test_init_HasNoErrors(self) -> None:
        awgs = TestVirtualAwg.__create_awg_drivers()
        awg_driver1, awg_driver2 = awgs
        virtual_awg = VirtualAwg(awgs, settings=self.settings)

        self.assertEqual(virtual_awg.settings, self.settings)
        self.assertEqual(awg_driver1, virtual_awg.awgs[0].fetch_awg)
        self.assertEqual(awg_driver2, virtual_awg.awgs[1].fetch_awg)
        virtual_awg.close()
    def __init__(self,
                 address: str,
                 instrument_name: Optional[str] = None) -> None:
        super().__init__(address, instrument_name)

        settings_instrument = SettingsInstrument(
            f'settings_{self._instrument_name}')
        self._instrument: VirtualAwg = VirtualAwg(name=self._instrument_name,
                                                  settings=settings_instrument)
        self._adapters: Dict[str, InstrumentAdapter] = {}
Example #3
0
    def test_add_instruments(self) -> None:
        awgs = TestVirtualAwg.__create_awg_drivers()
        awg_driver1, awg_driver2 = awgs

        virtual_awg = VirtualAwg(settings=self.settings)
        virtual_awg.add_instruments(awgs)
        self.assertEqual(2, len(virtual_awg.instruments))
        self.assertEqual(awgs, virtual_awg.instruments)

        virtual_awg.add_instruments(awgs)
        self.assertEqual(2, len(virtual_awg.instruments))
        self.assertEqual(awgs, virtual_awg.instruments)

        virtual_awg.close()
Example #4
0
    def test_enable_outputs(self):
        self.settings.awg_map = {'P1': (0, 1), 'P2': (0, 2), 'P3': (1, 3), 'm4i_mk': (1, 4, 1)}
        virtual_awg = VirtualAwg(settings=self.settings)
        awgs = TestVirtualAwg.__create_awg_drivers()
        awg_driver1, awg_driver2 = awgs
        virtual_awg._awgs = awgs

        virtual_awg.enable_outputs(['P1', 'P2', 'P3'])
        awg_driver1.enable_outputs.assert_has_calls([call([1]), call([2])])
        awg_driver2.enable_outputs.assert_has_calls([call([(3)]), call([4])])

        virtual_awg.close()
Example #5
0
    def test_snapshot_includes_settings(self) -> None:
        awgs = TestVirtualAwg.__create_awg_drivers()
        awg_driver1, awg_driver2 = awgs
        virtual_awg = VirtualAwg(awgs, settings=self.settings)
        instrument_snapshot = virtual_awg.snapshot()

        self.assertIn('settings_snapshot', instrument_snapshot['parameters'])
        self.assertDictEqual(
            instrument_snapshot['parameters']['settings_snapshot']['value'],
            virtual_awg.settings_snapshot())
        virtual_awg.close()
Example #6
0
    def test_reset(self):
        awgs = TestVirtualAwg.__create_awg_drivers()
        awg_driver1, awg_driver2 = awgs
        virtual_awg = VirtualAwg(awgs, settings=self.settings)

        awg_driver1.reset.assert_not_called()
        awg_driver2.reset.assert_not_called()
        virtual_awg.reset()
        awg_driver1.reset.assert_called_once()
        awg_driver2.reset.assert_called_once()

        virtual_awg.close()
Example #7
0
awg_adapter.instrument.system_clocks_referenceclock_source(external_clock)

grouping_1x8 = 2
awg_adapter.instrument.set_channel_grouping(grouping_1x8)

output1_marker1 = 4
awg_adapter.instrument.triggers_out_0_source(output1_marker1)

awg_sampling_rate_586KHz = 12
awg_adapter.instrument.awgs_0_time(awg_sampling_rate_586KHz)


#  Virtual AWG

settings = HardwareSettings()
virtual_awg = VirtualAwg([awg_adapter.instrument], settings)

marker_delay = 16e-6
virtual_awg.digitizer_marker_delay(marker_delay)

marker_uptime = 1e-2
virtual_awg.digitizer_marker_uptime(marker_uptime)


#  Station

gates = VirtualIVVI('gates', gates=['P1', 'P2'], model=None)
station = Station(virtual_awg, scope_reader.adapter.instrument, awg_adapter.instrument, gates)

#%% Enable the stimulus
for ii in range(4):
    getattr(digitizer, 'termination_%d' %ii)(0)

# %%

## VIRUAL AWG ##

address =  'TCPIP0::192.168.137.13::INSTR'
awg_1 = Tektronix_AWG5014(name='awg1', address=address)

hardware = Hardware('hardware')

import qtt.instrument_drivers.virtual_awg
 
if 1:
    virtual_awg = VirtualAwg([awg_1], hardware) # new style
else:
    virtual_awg = qtt.instrument_drivers.virtual_awg.virtual_awg('awg', instruments=[awg_1], awg_map=hardware.awg_map, hardware=hardware)
    #station.add_component(virtual_awg)
    
#%%

uptime_in_seconds = 1e-7
marker_delay_in_sec = 2e-7
virtual_awg.update_digitizer_marker_settings(uptime_in_seconds, marker_delay_in_sec)

amplitude = 4
sample_rate = 1e7
update_awg_settings(virtual_awg, amplitude, sample_rate)

Example #9
0
    def test_init_HasNoInstruments(self) -> None:
        virtual_awg = VirtualAwg(settings=self.settings)

        self.assertEqual(virtual_awg.settings, self.settings)
        self.assertEqual(virtual_awg.instruments, [])
        virtual_awg.close()
sampling_rate_293KHz = 13
awg.awgs_0_time(sampling_rate_293KHz)

# Initialize the lock-in amplifier

lockin = ZIUHFLI(name='ZIUHFLI', device_ID='DEV2338')

lockin.scope_trig_enable('ON')

lockin.scope_trig_signal('Trig Input 1')

lockin.scope_samplingrate('7.03 MHz')

# 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