Ejemplo n.º 1
0
instr_Agi2 = new_lab._station.load_Agi2()
awg_wfm_q2 = WaveformAWG("Waveform 2", [(instr_Agi2, 'ch1'),
                                        (instr_Agi2, 'ch2')], 1.25e9)
awg_wfm_q2.add_waveform_segment(WFS_Gaussian("init", None, 512e-9, 0.5))
awg_wfm_q2.add_waveform_segment(
    WFS_Constant("zero1", mod_freq_qubit, 512e-9, 0.25))
awg_wfm_q2.add_waveform_segment(
    WFS_Gaussian("init2", mod_freq_qubit, 512e-9, 0.5))
awg_wfm_q2.add_waveform_segment(WFS_Constant("zero2", None, 512e-9, 0.0))
awg_wfm_q2.get_output_channel(0).marker(0).set_markers_to_segments(
    ["init", "init2"])
awg_wfm_q2.program_AWG()

#CONNECTED CHANNEL 1 of Agi1 to Input 0 of digitizer and MARKER 2 of Agi1 to Input Trg0 of digitizer

acq_module = ACQ(new_lab._station.load_M4iDigitizer())
acq_module.NumSamples = 256
acq_module.NumSegments = 1
acq_module.SampleRate = 500e6
acq_module.TriggerEdge = 1
acq_module.set_trigger_source(awg_wfm_q.get_output_channel(0).marker(1))

# awg.set_trigger_source(ddg_module.get_trigger_source('A'))

expConfig = ExperimentConfiguration(10e-6, [ddg_module],
                                    [awg_wfm_q, awg_wfm_q2], acq_module,
                                    [freq_module])
# lePlot = expConfig.plot().show()
# input('press <ENTER> to continue')

leData = expConfig.get_data()
Ejemplo n.º 2
0
    def test_SaveReload(self):
        self.initialise()
        self.lab.load_instrument('virACQ')
        hal_acq = ACQ("dum_acq", self.lab, 'virACQ')

        awg_wfm = self.lab.HAL("Wfm1")
        read_segs = []
        read_segs2 = []
        awg_wfm.clear_segments()
        awg_wfm.add_waveform_segment(WFS_Constant("SEQPAD", None, 10e-9, 0.0))
        awg_wfm.add_waveform_segment(
            WFS_Gaussian("init", None, 20e-9, 0.5 - 0.1))
        awg_wfm.add_waveform_segment(WFS_Constant("zero1", None, 30e-9, 0.1))
        awg_wfm.add_waveform_segment(
            WFS_Gaussian("init2", None, 45e-9, 0.5 - 0.1))
        awg_wfm.add_waveform_segment(WFS_Constant("zero2", None, 77e-9, 0.0))
        awg_wfm.add_waveform_segment(
            WFS_Gaussian("init3", None, 45e-9, 0.5 - 0.1))
        read_segs += ["init"]
        read_segs2 += ["zero2"]
        awg_wfm.get_output_channel(0).marker(1).set_markers_to_segments(
            read_segs)
        awg_wfm.get_output_channel(1).marker(0).set_markers_to_segments(
            read_segs2)
        #Gather initial arrays
        wfm_unmod = np.vstack(awg_wfm.get_raw_waveforms())
        #Modulations
        WFMT_ModulationIQ('IQmod', self.lab, 47e7)
        WFMT_ModulationIQ('IQmod2', self.lab, 13e7)
        #Test a basic WFS_Group construct with elastic time-frame
        awg_wfm = WaveformAWG("Wfm1",
                              self.lab, [('virAWG', 'CH1'), ('virAWG', 'CH2')],
                              1e9,
                              total_time=227e-9)
        awg_wfm.clear_segments()
        awg_wfm.add_waveform_segment(WFS_Constant("SEQPAD", None, -1, 0.0))
        awg_wfm.add_waveform_segment(
            WFS_Gaussian("init",
                         self.lab.WFMT('IQmod').apply(), 20e-9, 0.5 - 0.1))
        awg_wfm.add_waveform_segment(
            WFS_Group("TestGroup", [
                WFS_Constant("zero1", None, -1, 0.1),
                WFS_Gaussian("init2", None, 45e-9, 0.5 - 0.1)
            ],
                      time_len=75e-9))
        awg_wfm.add_waveform_segment(WFS_Constant("zero2", None, 77e-9, 0.0))
        awg_wfm.add_waveform_segment(
            WFS_Gaussian("init3", None, 45e-9, 0.5 - 0.1))
        wfm_mod = np.vstack(awg_wfm.get_raw_waveforms())
        init_stencil = np.s_[10:30]
        temp = wfm_unmod * 1.0
        omega = 2 * np.pi * self.lab.WFMT('IQmod').IQFrequency
        temp[0, init_stencil] *= np.cos(omega * 1e-9 * (np.arange(20) + 10))
        temp[1, init_stencil] *= np.sin(omega * 1e-9 * (np.arange(20) + 10))
        #
        assert self.arr_equality(
            temp, wfm_mod), "WFS_Group failed in waveform compilation."

        expConfig = ExperimentConfiguration('testConf', self.lab, 1.0,
                                            ['Wfm1'], 'dum_acq')
        # leConfig = expConfig.save_config()

        awg_wfm.clear_segments()
        awg_wfm.add_waveform_segment(WFS_Constant("SEQPAD", None, -1, 0.0))
        wfm_mod = np.vstack(awg_wfm.get_raw_waveforms())
        assert not self.arr_equality(
            temp, wfm_mod
        ), "The waveform randomly compiles correctly even though it has been redone."
        expConfig.init_instruments()
        wfm_mod = np.vstack(awg_wfm.get_raw_waveforms())
        assert self.arr_equality(
            temp,
            wfm_mod), "The waveform was not constructed properly on reloading."

        shutil.rmtree('test_save_dir')
        self.cleanup()
Ejemplo n.º 3
0
#Can be done in YAML
# instr_ddg = DDG_DG645('ddg_real')
# new_exp.add_instrument(instr_ddg)

#Ideally, the length and polarity are set to default values in the drivers via the YAML file - i.e. just set TrigPulseDelay
ddg_module = DDG(new_exp._station.load_pulser())
ddg_module.get_trigger_output('AB').TrigPulseLength = 50e-9
ddg_module.get_trigger_output('AB').TrigPolarity = 1
ddg_module.get_trigger_output('AB').TrigPulseDelay = 10e-9
ddg_module.get_trigger_output('CD').TrigPulseLength = 100e-9
ddg_module.get_trigger_output('CD').TrigPulseDelay = 50e-9
ddg_module.get_trigger_output('CD').TrigPolarity = 1
ddg_module.get_trigger_output('EF').TrigPulseLength = 400e-9
ddg_module.get_trigger_output('EF').TrigPulseDelay = 250e-9
ddg_module.get_trigger_output('EF').TrigPolarity = 0

acq_module = ACQ(new_exp._station.load_fpgaACQ())
acq_module.NumSamples = 50
acq_module.NumSegments = 1
# acq_module.SampleRate = 1e9
# acq_module.TriggerEdge = 0
acq_module.set_trigger_source(ddg_module, 'AB')

# awg.set_trigger_source(ddg_module.get_trigger_source('A'))

tc = TimingConfiguration(1e-6, [ddg_module], [], acq_module)
# lePlot = tc.plot().show()
leData = new_exp.run(tc)
input('press <ENTER> to continue')
Ejemplo n.º 4
0
#Can be done in YAML
instr_ddg = DummyDDG('ddg')
new_lab.add_instrument(instr_ddg)
instr_acq = DummyACQ('acq')
new_lab.add_instrument(instr_acq)
instr_awg = DummyAWG('awg_test_instr')
new_lab.add_instrument(instr_awg)
instr_fsrc = DummyGENmwSrc('freq_src_instr')
new_lab.add_instrument(instr_fsrc)

ddg_module = DDG('DDG', new_lab, 'ddg')
awg_wfm_q = WaveformAWG("Waveform 2", new_lab, [('awg_test_instr', 'CH3'),
                                                ('awg_test_instr', 'CH4')],
                        1e9)
acq_module = ACQ('ACQ', new_lab, 'acq')
freq_src_module = GENmwSource('MWS', new_lab, 'freq_src_instr', 'CH1')

mod_freq_qubit = WM_SinusoidalIQ("QubitFreqMod", 100e6)

#
#Setup Parameters
#
param_cav_freq = new_lab.add_variable_property('Cavity Frequency',
                                               freq_src_module, 'Frequency')
param_rab_freq = new_lab.add_variable('Rabi Frequency')

#
#Setup ExperimentConfiguration
#
#Setup the trigger and instrument relations
Ejemplo n.º 5
0
new_lab = Laboratory(instr_config_file="", save_dir="mySaves\\")

#Can be done in YAML
instr_ddg = DummyDDG('ddg')
new_lab.add_instrument(instr_ddg)
instr_acq = DummyACQ('acq')
new_lab.add_instrument(instr_acq)
instr_awg = DummyAWG('awg_test_instr')
new_lab.add_instrument(instr_awg)
instr_fsrc = DummyGENmwSrc('freq_src_instr')
new_lab.add_instrument(instr_fsrc)

ddg_module = DDG(instr_ddg)
awg_wfm_q = WaveformAWG("Waveform 2 CH", [(instr_awg, 'CH3'),
                                          (instr_awg, 'CH4')], 1e9)
acq_module = ACQ(instr_acq)
freq_src_module = GENmwSource(instr_fsrc.get_output('CH1'))

param_cav_freq = new_lab.add_variable_property('Cavity Frequency',
                                               freq_src_module, 'Frequency')

#Setup the trigger and instrument relations
ddg_module.set_trigger_output_params('A', 0.0, 50e-9)
acq_module.set_trigger_source(awg_wfm_q.get_output_channel(0).marker(0))
awg_wfm_q.set_trigger_source_all(ddg_module.get_trigger_output('A'))
acq_module.SampleRate = 1e9
acq_module.NumSamples = 100
#Cement the parameters into the experiment configuration
exp_config = ExperimentConfiguration(100e-9, [ddg_module], [awg_wfm_q],
                                     acq_module, [freq_src_module])
Ejemplo n.º 6
0
from sqdtoolz.HAL.WaveformGeneric import *
from sqdtoolz.HAL.WaveformMapper import *

import numpy as np
import time

new_lab = Laboratory('UnitTests\\UTestExperimentConfiguration.yaml',
                     'test_save_dir/')

new_lab.load_instrument('virACQ')
new_lab.load_instrument('virDDG')
new_lab.load_instrument('virAWG')
new_lab.load_instrument('virMWS')

#Initialise test-modules
hal_acq = ACQ("dum_acq", new_lab, 'virACQ')
hal_ddg = DDG(
    "ddg",
    new_lab,
    'virDDG',
)
awg_wfm = WaveformAWG("Wfm1", new_lab, [('virAWG', 'CH1'), ('virAWG', 'CH2')],
                      1e9)
awg_wfm2 = WaveformAWG("Wfm2", new_lab, [('virAWG', 'CH3'), ('virAWG', 'CH4')],
                       1e9)
hal_mw = GENmwSource("MW-Src", new_lab, 'virMWS', 'CH1')

ExperimentConfiguration('testConf', new_lab, 1.0, ['ddg'], 'dum_acq')
#
VariableInternal('myFreq', new_lab)
VariableInternal('testAmpl', new_lab)
Ejemplo n.º 7
0
#Ideally, the length and polarity are set to default values in the drivers via the YAML file - i.e. just set TrigPulseDelay
ddg_module = DDG(instr_ddg)
ddg_module.set_trigger_output_params('A', 50e-9)
ddg_module.get_trigger_output('B').TrigPulseLength = 100e-9
ddg_module.get_trigger_output('B').TrigPulseDelay = 50e-9
ddg_module.get_trigger_output('B').TrigPolarity = 1
ddg_module.get_trigger_output('C').TrigPulseLength = 400e-9
ddg_module.get_trigger_output('C').TrigPulseDelay = 250e-9
ddg_module.get_trigger_output('C').TrigPolarity = 0

temp_config = ddg_module._get_current_config()
ddg_module.get_trigger_output('C').TrigPolarity = 1
ddg_module._set_current_config(temp_config, instr_ddg)

acq_module = ACQ(instr_acq)
acq_module.NumSamples = 50
acq_module.SampleRate = 1e9
acq_module.InputTriggerEdge = 0
acq_module.set_trigger_source(ddg_module.get_trigger_output('B'))

mod_freq1 = WM_SinusoidalIQ("FreqMod 1", 100e6)
mod_freq2 = WM_SinusoidalIQ("FreqMod 2", 50e6)
#
awg_wfm2 = WaveformAWG("Waveform 2", [(instr_awg, 'CH3'), (instr_awg, 'CH4')],
                       1e9)
awg_wfm2.add_waveform_segment(WFS_Gaussian("init", mod_freq1, 75e-9, 1.0))
awg_wfm2.add_waveform_segment(WFS_Constant("pad1", None, 45e-9, 0.5))
awg_wfm2.add_waveform_segment(WFS_Constant("hold", None, 45e-9, 0.5))
awg_wfm2.add_waveform_segment(WFS_Gaussian("pulse", None, 75e-9, 1.0))
awg_wfm2.add_waveform_segment(WFS_Constant("pad2", mod_freq2, 45e-9, 0.5))
Ejemplo n.º 8
0
new_lab = Laboratory(instr_config_file="", save_dir="mySaves\\")

#Can be done in YAML
instr_ddg = DummyDDG('ddg')
new_lab.add_instrument(instr_ddg)
instr_acq = DummyACQex('acq')
new_lab.add_instrument(instr_acq)
instr_awg = DummyAWG('awg_test_instr')
new_lab.add_instrument(instr_awg)
instr_fsrc = DummyGENmwSrc('freq_src_instr')
new_lab.add_instrument(instr_fsrc)

ddg_module = DDG(instr_ddg)
awg_wfm_q = WaveformAWG("Waveform 2", [(instr_awg, 'CH3'), (instr_awg, 'CH4')],
                        1e9)
acq_module = ACQ(instr_acq)
freq_src_module = GENmwSource(instr_fsrc.get_output('CH1'))

mod_freq_qubit = WM_SinusoidalIQ("QubitFreqMod", 100e6)

param_rab_freq = new_lab.add_variable('Rabi Frequency')

#Setup the trigger and instrument relations
ddg_module.set_trigger_output_params('A', 0.0, 50e-9)
acq_module.set_trigger_source(awg_wfm_q.get_output_channel(0).marker(0))
awg_wfm_q.set_trigger_source_all(ddg_module.get_trigger_output('A'))
acq_module.SampleRate = 1e9
acq_module.NumSamples = 100
acq_module.NumRepetitions = 100
#Attach a CPU post-processor
myProc = ProcessorCPU()
Ejemplo n.º 9
0
# instr._chk_err("")
# # instr._set_cmd(':DSP:DEC:IQP:INP', 'IQ')
# instr._set_cmd(':DSP:DEC:IQP:INP', 'AMPH')
# instr._chk_err("")

# instr._set_cmd(':DSP:DEC:FRAM', 240)
# instr._chk_err("")
# instr._set_cmd(':DSP:DEC:IQP:OUTP', 'THR')
# instr._chk_err("")

# #Try some MATH operations
# instr._set_cmd(':DSP:MATH:OPERation', 'I1, -2, 10')   #Scale Offset
# instr._set_cmd(':DSP:MATH:OPERation', 'Q1, 1, 0')
# instr._chk_err("")

acq_module = ACQ("TabourACQ", new_lab, ['TaborAWG', 'ACQ'])
acq_module.NumSamples = 480
acq_module.NumSegments = 2
acq_module.NumRepetitions = 2

myProc = ProcessorCPU("DDC", new_lab)
myProc.add_stage(CPU_DDC([100e6] * 2))
myProc.add_stage(
    CPU_FIR([{
        'Type': 'low',
        'Taps': 40,
        'fc': 10e6,
        'Win': 'hamming'
    }] * 4))
# acq_module.set_data_processor(myProc)
Ejemplo n.º 10
0
awg_wfm_q.prepare_final()

awg_wfm_q.get_output_channel(0).Output = True
awg_wfm_q.get_output_channel(1).Output = True
inst_tabor.AWG._get_channel_output('CH1').marker1_output(True)
inst_tabor.AWG._get_channel_output('CH1').marker2_output(True)

# my_param1 = VariableInstrument("len1", awg_wfm2, 'IQFrequency')
# my_param2 = VariableInstrument("len2", awg_wfm2, 'IQPhase')

# tc = TimingConfiguration(1.2e-6, [ddg_module], [awg_wfm2], None)
# lePlot = tc.plot().show()
# leData = new_exp.run(tc, [(my_param1, np.linspace(20e6,35e6,10)),(my_param2, np.linspace(0,3,3))])

inst_tabor.ACQ.TriggerInputEdge = 1
acq_module = ACQ(inst_tabor.ACQ)
# acq_module.NumSamples = 2400
# acq_module.NumSegments = 2
# acq_module.NumRepetitions = 2
acq_module.NumSamples = 16848
acq_module.NumSegments = 1
acq_module.NumRepetitions = 1
leData = inst_tabor.ACQ.get_data()
import matplotlib.pyplot as plt
for r in range(acq_module.NumRepetitions):
    for s in range(acq_module.NumSegments):
        plt.plot(leData[0][r][s])
plt.show(
)  #!!!REMEMBER TO CLOSE THE PLOT WINDOW BEFORE CLOSING PYTHON KERNEL OR TABOR LOCKS UP (PC restart won't cut it - needs to be a chassis restart)!!!
input('press <ENTER> to continue')
Ejemplo n.º 11
0
# for m in range(4):
#     awg_wfm_q2.add_waveform_segment(WFS_Gaussian(f"init{m}", None, 512e-9, 0.5-0.1*m))
#     awg_wfm_q2.add_waveform_segment(WFS_Constant(f"zero1{m}", None, 512e-9, 0.1*m))
#     awg_wfm_q2.add_waveform_segment(WFS_Gaussian(f"init2{m}", None, 512e-9, 0.5-0.1*m))
#     awg_wfm_q2.add_waveform_segment(WFS_Constant(f"zero2{m}", None, 512e-9, 0.0))
#     read_segs += [f"init{m}"]

awg_wfm_q.prepare_initial()
# awg_wfm_q2.prepare_initial()
awg_wfm_q.prepare_final()
# awg_wfm_q2.prepare_final()
awg_wfm_q.get_output_channel(0).Output = True

#CONNECTED CHANNEL 1 of Agi1 to Input 0 of digitizer and MARKER 2 of Agi1 to Input Trg0 of digitizer
instr_digi = new_lab._station.load_M4iDigitizer()
acq_module = ACQ(instr_digi)
acq_module.NumSamples = 512
acq_module.NumSegments = 4
acq_module.NumRepetitions = 5
acq_module.SampleRate = 500e6
acq_module.TriggerEdge = 1
# acq_module.set_trigger_source(awg_wfm_q.get_output_channel(0).marker(1))

#expConfig = ExperimentConfiguration(10e-6, [ddg_module], [awg_wfm_q], acq_module, [freq_module])
expConfig = ExperimentConfiguration(10e-6, [ddg_module], [], acq_module,
                                    [freq_module])
# lePlot = expConfig.plot().show()
# input('press <ENTER> to continue')

leData = expConfig.get_data()
# leData2 = expConfig.get_data()
Ejemplo n.º 12
0
new_lab = Laboratory(instr_config_file = "", save_dir = "mySaves\\")

#Can be done in YAML
instr_ddg = DummyDDG('ddg')
new_lab.add_instrument(instr_ddg)
instr_acq = DummyACQex('acq')
new_lab.add_instrument(instr_acq)
instr_awg = DummyAWG('awg_test_instr')
new_lab.add_instrument(instr_awg)
instr_fsrc = DummyGENmwSrc('freq_src_instr')
new_lab.add_instrument(instr_fsrc)

ddg_module = DDG('DDG', new_lab, 'ddg')
awg_wfm_q = WaveformAWG("Waveform 2", new_lab, [('awg_test_instr', 'CH3'),('awg_test_instr', 'CH4')], 1e9)
acq_module = ACQ('ACQ', new_lab, 'acq')
freq_src_module = GENmwSource('MWS', new_lab, 'freq_src_instr', 'CH1')

param_cav_freq = new_lab.add_variable_property('Cavity Frequency', freq_src_module, 'Frequency')

#Setup the trigger and instrument relations
ddg_module.set_trigger_output_params('A', 0.0, 50e-9)
acq_module.set_trigger_source(awg_wfm_q.get_output_channel(0).marker(0))
awg_wfm_q.set_trigger_source_all(ddg_module.get_trigger_output('A'))
acq_module.SampleRate = 1e9
acq_module.NumSamples = 100
acq_module.NumSegments = 1
acq_module.NumRepetitions = 200
#Cement the parameters into the experiment configuration
exp_config = ExperimentConfiguration(100e-9, [ddg_module, awg_wfm_q, freq_src_module], acq_module)