def setup_AWG(self, *args): self.arb.abort() self.arb.delete_all_waveforms() self.arb.reset_sequence_table() self.arb.set_output_route("DC", channel=1) self.arb.voltage_amplitude = 1.0 self.arb.set_marker_level_low(0.0, channel=1, marker_type="sync") self.arb.set_marker_level_high(1.5, channel=1, marker_type="sync") self.arb.continuous_mode = False self.arb.gate_mode = False def arb_pulse(amplitude, sample_rate=12e9): pulse_points = int(self.duration.value * sample_rate) if pulse_points < 320: wf = np.zeros(320) else: wf = np.zeros(64 * int(np.ceil(pulse_points / 64.0))) wf[:pulse_points] = amplitude return wf segment_ids = [] arb_voltage = arb_voltage_lookup() for amp in self.amplitudes: waveform = arb_pulse(np.sign(amp) * arb_voltage(abs(amp))) wf_data = KeysightM8190A.create_binary_wf_data(waveform) segment_id = self.arb.define_waveform(len(wf_data)) segment_ids.append(segment_id) self.arb.upload_waveform(wf_data, segment_id) # NIDAQ trigger waveform nidaq_trig_wf = KeysightM8190A.create_binary_wf_data(np.zeros(3200), sync_mkr=1) nidaq_trig_segment_id = self.arb.define_waveform(len(nidaq_trig_wf)) self.arb.upload_waveform(nidaq_trig_wf, nidaq_trig_segment_id) settle_pts = int(640 * np.ceil(self.settle_delay * 12e9 / 640)) start_idxs = [0] scenario = Scenario() seq = Sequence(sequence_loop_ct=int(self.repeats)) for si in segment_ids: # seq = Sequence(sequence_loop_ct=int(1)) seq.add_waveform(si) # Apply switching pulse to the sample seq.add_idle(settle_pts, 0.0) # Wait for the measurement to settle seq.add_waveform( nidaq_trig_segment_id) # Trigger the NIDAQ measurement seq.add_idle(1 << 14, 0.0) # bonus non-contiguous memory delay scenario.sequences.append(seq) self.arb.upload_scenario(scenario, start_idx=start_idxs[-1]) start_idxs.append(start_idxs[-1] + len(scenario.scpi_strings())) # The last entry is eroneous start_idxs = start_idxs[:-1] self.arb.sequence_mode = "SCENARIO" self.arb.scenario_advance_mode = "REPEAT" self.arb.stop() self.arb.scenario_start_index = 0 self.arb.run()
def setup_arb(self): self.arb.abort() self.arb.delete_all_waveforms() self.arb.reset_sequence_table() reset_wf = arb_pulse(-self.polarity * self.reset_amplitude, self.reset_duration) wf_data = KeysightM8190A.create_binary_wf_data(reset_wf) rst_segment_id = self.arb.define_waveform(len(wf_data)) self.arb.upload_waveform(wf_data, rst_segment_id) no_reset_wf = arb_pulse(0.0, 3.0 / 12e9) wf_data = KeysightM8190A.create_binary_wf_data(no_reset_wf) no_rst_segment_id = self.arb.define_waveform(len(wf_data)) self.arb.upload_waveform(wf_data, no_rst_segment_id) # nTron waveforms nTron_control_voltage = pulse_voltage_lookup() nTron_segment_ids = [] for dur, vpeak in zip(self.pulse_durations, self.pulse_voltages): volt = self.polarity * nTron_control_voltage(vpeak) logger.debug("Set nTron pulse: {}V -> AWG {}V, {}s".format( vpeak, volt, dur)) ntron_wf = ntron_pulse(amplitude=volt, fall_time=dur) wf_data = KeysightM8190A.create_binary_wf_data(ntron_wf) ntron_segment_id = self.arb.define_waveform(len(wf_data)) self.arb.upload_waveform(wf_data, ntron_segment_id) nTron_segment_ids.append(ntron_segment_id) # NIDAQ trigger waveform nidaq_trig_wf = KeysightM8190A.create_binary_wf_data(np.zeros(3200), sync_mkr=1) nidaq_trig_segment_id = self.arb.define_waveform(len(nidaq_trig_wf)) self.arb.upload_waveform(nidaq_trig_wf, nidaq_trig_segment_id) settle_pts = int(640 * np.ceil(self.settle_delay * 12e9 / 640)) self.start_idxs = [0] self.start_id = 0 for si in nTron_segment_ids: scenario = Scenario() seq = Sequence(sequence_loop_ct=int(self.attempts)) seq.add_waveform(rst_segment_id) seq.add_idle(settle_pts, 0.0) seq.add_waveform(nidaq_trig_segment_id) seq.add_idle(1 << 16, 0.0) # bonus non-contiguous memory delay # seq.add_waveform(pspl_trig_segment_id) seq.add_waveform(si) seq.add_idle(settle_pts, 0.0) seq.add_waveform(nidaq_trig_segment_id) seq.add_idle(1 << 16, 0.0) # bonus non-contiguous memory delay scenario.sequences.append(seq) self.arb.upload_scenario(scenario, start_idx=self.start_idxs[-1]) self.start_idxs.append(self.start_idxs[-1] + len(scenario.scpi_strings())) # The last entry is eroneous self.start_idxs = self.start_idxs[:-1] self.arb.sequence_mode = "SCENARIO" self.arb.scenario_advance_mode = "SINGLE" self.arb.scenario_start_index = 0