Exemplo n.º 1
0
 def test_generate_large_csv_sequence_program(self):
     expected = textwrap.dedent("""
                     // generated by qcodes.instrument_drivers.ZI.ZIHDAWG8
                     
                     wave wave_1 = "wave_1";
                     wave marker_1 = "marker_1";
                     wave_1 = wave_1 + marker_1;
                     wave marker_2 = "marker_2";
                     wave marker_3 = "marker_3";
                     wave wave_4 = "wave_4";
                     wave wave_5 = "wave_5";
                     wave marker_5 = "marker_5";
                     wave_5 = wave_5 + marker_5;
                     wave wave_6 = "wave_6";
                     wave wave_7 = "wave_7";
                     wave marker_7 = "marker_7";
                     wave_7 = wave_7 + marker_7;
                     wave marker_8 = "marker_8";
                     
                     while(true){
                         playWave(1, wave_1, 2, marker_2, 3, marker_3, 4, wave_4, 5, wave_5, 6, wave_6, 7, wave_7, 8, marker_8);
                     }
                     """)
     sequence_program = ZIHDAWG8.generate_csv_sequence_program([
         (1, "wave_1", "marker_1"), (2, None, "marker_2"),
         (3, None, "marker_3"), (4, "wave_4", None),
         (5, "wave_5", "marker_5"), (6, "wave_6", None),
         (7, "wave_7", "marker_7"), (8, None, "marker_8")
     ])
     self.assertEqual(expected, sequence_program)
Exemplo n.º 2
0
 def test_generate_csv_sequence_program_with_marker_no_waves(self):
     expected = textwrap.dedent("""
                     // generated by qcodes.instrument_drivers.ZI.ZIHDAWG8
                     
                     wave marker_1 = "marker_1";
                     
                     while(true){
                         playWave(6, marker_1);
                     }
                     """)
     sequence_program = ZIHDAWG8.generate_csv_sequence_program([
         (6, None, "marker_1")
     ])
     self.assertEqual(expected, sequence_program)
Exemplo n.º 3
0
 def test_generate_csv_sequence_program_1_wave(self):
     expected = textwrap.dedent("""
                     // generated by qcodes.instrument_drivers.ZI.ZIHDAWG8
                     
                     wave wave_1 = "wave_1";
                     
                     while(true){
                         playWave(7, wave_1);
                     }
                     """)
     sequence_program = ZIHDAWG8.generate_csv_sequence_program([
         (7, 'wave_1', None)
     ])
     self.assertEqual(expected, sequence_program)
Exemplo n.º 4
0
 def test_generate_csv_sequence_program(self):
     expected = textwrap.dedent("""
                     // generated by qcodes.instrument_drivers.ZI.ZIHDAWG8
                     
                     wave wave_1 = "wave_1";
                     wave wave_2 = "wave_2";
                     wave wave_3 = "wave_3";
                     
                     while(true){
                         playWave(1, wave_1, 2, wave_2, 3, wave_3);
                     }
                     """)
     sequence_program = ZIHDAWG8.generate_csv_sequence_program([
         (1, 'wave_1', None), (2, 'wave_2', None), (3, 'wave_3', None)
     ])
     self.assertEqual(expected, sequence_program)
Exemplo n.º 5
0
 def test_generate_csv_sequence_program_with_2_markers_1_wave(self):
     expected = textwrap.dedent("""
                     // generated by qcodes.instrument_drivers.ZI.ZIHDAWG8
                     
                     wave wave_1 = "wave_1";
                     wave marker_1 = "marker_1";
                     wave_1 = wave_1 + marker_1;
                     wave marker_2 = "marker_2";
                     
                     while(true){
                         playWave(1, wave_1, 2, marker_2);
                     }
                     """)
     sequence_program = ZIHDAWG8.generate_csv_sequence_program([
         (1, "wave_1", "marker_1"), (2, None, "marker_2")
     ])
     self.assertEqual(expected, sequence_program)
Exemplo n.º 6
0
    def test_create_parameters_from_node_tree(self):
        with patch.object(zhinst.utils, 'create_api_session',
                          return_value=3 * (MagicMock(),)), \
             patch.object(ZIHDAWG8, 'download_device_node_tree',
                          return_value=self.node_tree):
            hdawg8 = ZIHDAWG8('hdawg8', 'dev-test')

            self.assertIn('system_awg_channelgrouping', hdawg8.parameters)
            with self.assertRaises(ValueError):
                hdawg8.system_awg_channelgrouping.set(4)
            self.assertEqual('None', hdawg8.system_awg_channelgrouping.unit)
            self.assertEqual('system_awg_channelgrouping',
                             hdawg8.system_awg_channelgrouping.name)
            self.assertIsNotNone(hdawg8.system_awg_channelgrouping.vals)
            self.assertIsInstance(hdawg8.system_awg_channelgrouping.vals,
                                  validators.Enum)

            self.assertIn('sigouts_0_on', hdawg8.parameters)
            self.assertEqual('None', hdawg8.sigouts_0_on.unit)
            self.assertEqual('sigouts_0_on', hdawg8.sigouts_0_on.name)
            self.assertIsNone(hdawg8.sigouts_0_on.vals)

            self.assertIn('system_owner', hdawg8.parameters)
            self.assertEqual('None', hdawg8.system_owner.unit)
            self.assertEqual('system_owner', hdawg8.system_owner.name)
            self.assertIsNone(hdawg8.system_owner.vals)

            self.assertIn('sines_0_amplitudes_0', hdawg8.parameters)
            self.assertEqual('None', hdawg8.sines_0_amplitudes_0.unit)
            self.assertEqual('sines_0_amplitudes_0',
                             hdawg8.sines_0_amplitudes_0.name)
            self.assertIsNone(hdawg8.sines_0_amplitudes_0.vals)

            self.assertIn('awgs_1_waveform_memoryusage', hdawg8.parameters)
            self.assertEqual('%', hdawg8.awgs_1_waveform_memoryusage.unit)
            self.assertEqual('awgs_1_waveform_memoryusage',
                             hdawg8.awgs_1_waveform_memoryusage.name)
            self.assertIsNone(hdawg8.awgs_1_waveform_memoryusage.vals)
            hdawg8.close()
        for awg_gate in self.awg_map:
            parameter_name = 'awg_to_{}'.format(awg_gate)
            parameter_label = '{} (factor)'.format(parameter_name)
            self.add_parameter(parameter_name,
                               parameter_class=ManualParameter,
                               initial_value=1000,
                               label=parameter_label,
                               vals=Numbers(1, 1000))


settings = HardwareSettings()

# Initialize the arbitrary waveform generator

awg = ZIHDAWG8(name='HDAWG8', device_id='DEV8049')

grouping_1x8 = 2
awg.set_channel_grouping(grouping_1x8)

output1_marker1 = 4
awg.triggers_out_4_source(output1_marker1)

output2_marker1 = 6
awg.triggers_out_5_source(output2_marker1)

sampling_rate_293KHz = 13
awg.awgs_0_time(sampling_rate_293KHz)

# Initialize the lock-in amplifier