from sqdtoolz.Experiment import Experiment from sqdtoolz.Laboratory import Laboratory from sqdtoolz.HAL.DDG import * from sqdtoolz.ExperimentConfiguration import * from sqdtoolz.Drivers.Agilent_N8241A import * from sqdtoolz.HAL.AWG import * from sqdtoolz.HAL.WaveformSegments import * from sqdtoolz.HAL.ACQ import * from sqdtoolz.HAL.GENmwSource import * import numpy as np from sqdtoolz.Variable import * from sqdtoolz.HAL.WaveformSegments import * from sqdtoolz.HAL.WaveformTransformations import * from sqdtoolz.Variable import * new_lab = Laboratory(instr_config_file="tests\\M4iTest.yaml", save_dir="mySaves\\") #Note the following: # - Using a 1.25GHz clock source to split and driven into the EXT CLK IN inputs of both Agilent AWGs # - SYNC CLK OUT on Master goes into SYNC CLK IN on Slave # - Using M4 on master to trigger the slave AWG via Trigger 4 (could simply do this by just routing the clock lines to both AWGs...) # - The DDG output triggers the first master AWG # - Also using an external 10MHz reference on the AWG... #Sample Clock freq_module = GENmwSource(new_lab._station.load_SGS100A().get_output('RFOUT')) freq_module.Output = True #Ideally, the length and polarity are set to default values in the drivers via the YAML file - i.e. just set TrigPulseDelay instr_ddg = new_lab._station.load_pulser() ddg_module = DDG(instr_ddg)
from sqdtoolz.Experiment import Experiment from sqdtoolz.HAL.DDG import * from sqdtoolz.HAL.ACQ import * from sqdtoolz.HAL.AWG import * from sqdtoolz.HAL.GENmwSource import * from sqdtoolz.HAL.WaveformSegments import * from sqdtoolz.HAL.WaveformTransformations import * from sqdtoolz.Drivers.dummyDDG import * from sqdtoolz.Drivers.dummyACQ import * from sqdtoolz.Drivers.dummyAWG import * from sqdtoolz.Drivers.dummyGENmwSource import * from sqdtoolz.ExperimentConfiguration import * from sqdtoolz.Variable import * from sqdtoolz.Experiments.Experimental.ExperimentCavitySpectroscopy import * 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)
from sqdtoolz.Laboratory import Laboratory from sqdtoolz.ExperimentSpecification import ExperimentSpecification lab = Laboratory('', 'save_dir') ExperimentSpecification('temp', lab) ExperimentSpecification.list_SPEC_templates(True) a = 0
from sqdtoolz.Laboratory import Laboratory from sqdtoolz.Experiment import Experiment from sqdtoolz.HAL.DDG import * from sqdtoolz.HAL.ACQ import * from sqdtoolz.HAL.AWG import * from sqdtoolz.HAL.WaveformSegments import * from sqdtoolz.HAL.WaveformTransformations import * from sqdtoolz.Drivers.dummyDDG import * from sqdtoolz.Drivers.dummyACQ import * from sqdtoolz.Drivers.dummyAWG import * from sqdtoolz.ExperimentConfiguration import * from sqdtoolz.Variable import * 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) #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
from sqdtoolz.HAL.GENmwSource import * from sqdtoolz.HAL.WaveformSegments import * from sqdtoolz.HAL.WaveformTransformations import * from sqdtoolz.Drivers.dummyDDG import * from sqdtoolz.Drivers.dummyACQ import * from sqdtoolz.Drivers.dummyAWG import * from sqdtoolz.Drivers.dummyGENmwSource import * from sqdtoolz.ExperimentConfiguration import * from sqdtoolz.Variable import * from sqdtoolz.Experiments.Experimental.ExperimentCavitySpectroscopy2 import * from sqdtoolz.ExperimentConfigurations.Experimental.ExpConfigIQpulseInSingleOut import ExpConfigIQpulseInSingleOut from sqdtoolz.Experiments.Experimental.ExperimentRabi import ExperimentRabi import numpy as np 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('DDG', new_lab, 'ddg') awg_wfm_q = WaveformAWG("Waveform 2", new_lab, [('awg_test_instr', 'CH3'), ('awg_test_instr', 'CH4')], 1e9)
from sqdtoolz.Experiment import Experiment from sqdtoolz.Laboratory import Laboratory from sqdtoolz.HAL.DDG import * from sqdtoolz.ExperimentConfiguration import * from sqdtoolz.Drivers.Agilent_N8241A import * from sqdtoolz.HAL.AWG import * from sqdtoolz.HAL.WaveformSegments import * from sqdtoolz.HAL.ACQ import * from sqdtoolz.HAL.GENmwSource import * import numpy as np from sqdtoolz.Variable import * from sqdtoolz.HAL.WaveformSegments import * from sqdtoolz.HAL.WaveformTransformations import * new_lab = Laboratory(instr_config_file="tests\\AWG_N8241A_TestMS.yaml", save_dir="mySaves\\") #Note the following: # - Using a 1.25GHz clock source to split and driven into the EXT CLK IN inputs of both Agilent AWGs # - SYNC CLK OUT on Master goes into SYNC CLK IN on Slave # - Using M4 on master to trigger the slave AWG via Trigger 4 (could simply do this by just routing the clock lines to both AWGs...) # - The DDG output triggers the first master AWG # - Also using an external 10MHz reference on the AWG... #Sample Clock new_lab.load_instrument('SGS100A') freq_module = GENmwSource('MW_sample_clock', new_lab, 'SGS100A', 'RFOUT') freq_module.Output = True #Ideally, the length and polarity are set to default values in the drivers via the YAML file - i.e. just set TrigPulseDelay new_lab.load_instrument('pulser')
from sqdtoolz.HAL.WaveformTransformations import * from sqdtoolz.Drivers.dummyDDG import * from sqdtoolz.Drivers.dummyACQex import * from sqdtoolz.Drivers.dummyAWG import * from sqdtoolz.Drivers.dummyGENmwSource import * from sqdtoolz.ExperimentConfiguration import * from sqdtoolz.Variable import * from sqdtoolz.HAL.Processors.ProcessorCPU import * from sqdtoolz.HAL.Processors.CPU.CPU_Max import * from sqdtoolz.HAL.Processors.CPU.CPU_Mean import * from sqdtoolz.ExperimentConfigurations.Experimental.ExpConfigIQpulseInSingleOut import ExpConfigIQpulseInSingleOut from sqdtoolz.Experiments.Experimental.ExperimentRabi import ExperimentRabi import numpy as np 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)
from sqdtoolz.HAL.ACQvna import * from sqdtoolz.ExperimentConfiguration import * from sqdtoolz.Drivers.Agilent_N8241A import * from sqdtoolz.HAL.AWG import * from sqdtoolz.HAL.WaveformSegments import * from sqdtoolz.HAL.ACQ import * from sqdtoolz.HAL.GENmwSource import * import numpy as np from sqdtoolz.Variable import * from sqdtoolz.HAL.WaveformSegments import * from sqdtoolz.HAL.WaveformTransformations import * import matplotlib.pyplot as plt import time lab = Laboratory(instr_config_file="tests\\VNA_Agilent_N5232A_Test.yaml", save_dir="mySaves\\") #Sample Clock lab.load_instrument('vna') #('vna_agilent') test_vna = ACQvna('VNA', lab, 'vna') #'vna_agilent') test_vna.FrequencyStart = 10e6 test_vna.FrequencyEnd = 6e9 # test_vna.FrequencySingle = 500e6 # test_vna.SweepMode = 'Time-1f' # x_var = 'time' #'power' #'frequency' # test_vna.setup_segmented_sweep([(10e6,100e6,5), (500e6,1000e6,5), (1000e6,5000e6,5)]) # x_var = 'frequency'
from sqdtoolz.HAL.AWG import * from sqdtoolz.HAL.WaveformSegments import * from sqdtoolz.HAL.ACQ import * from sqdtoolz.HAL.GENmwSource import * import numpy as np from sqdtoolz.Variable import * from sqdtoolz.HAL.WaveformSegments import * from sqdtoolz.HAL.WaveformTransformations import * from sqdtoolz.Variable import * from sqdtoolz.HAL.Processors.ProcessorGPU import * from sqdtoolz.HAL.Processors.GPU.GPU_DDC import * from sqdtoolz.HAL.Processors.GPU.GPU_FIR import * import matplotlib.pyplot as plt new_lab = Laboratory(instr_config_file="tests\\M4iTest.yaml", save_dir="mySaves\\") #Note the following: # - Using a 1.25GHz clock source to split and driven into the EXT CLK IN inputs of both Agilent AWGs # - SYNC CLK OUT on Master goes into SYNC CLK IN on Slave # - Using M4 on master to trigger the slave AWG via Trigger 4 (could simply do this by just routing the clock lines to both AWGs...) # - The DDG output triggers the first master AWG # - Also using an external 10MHz reference on the AWG... #Sample Clock # freq_module = GENmwSource(new_lab._station.load_SGS100A().get_output('RFOUT')) # freq_module.Output = True #Ideally, the length and polarity are set to default values in the drivers via the YAML file - i.e. just set TrigPulseDelay instr_ddg = new_lab.load_instrument('pulser') DDG("DDG", new_lab, 'pulser')
def runme(): lab = Laboratory('', '') new_digi = ACQ_M4i_Digitiser("test") new_digi.ChannelStates = (True, False) new_digi.NumSegments = 1 #3 * (2**26)) new_digi.NumSamples = 2**19 #(2**13)#2**8+2**7) new_digi.NumRepetitions = 1 new_digi.NumRepetitions = 5 new_digi.NumSegments = 1 new_digi.NumSamples = 512 # term = new_digi._param32bit(30130) # term = new_digi.termination_1() # new_digi.snapshot() myProc = ProcessorCPU('test', lab) myProc.add_stage(CPU_DDC([25e6] * 2)) myProc.add_stage( CPU_FIR([{ 'Type': 'low', 'Taps': 40, 'fc': 25e6, 'Win': 'hamming' }] * 4)) # myProc.add_stage(CPU_Mean('sample')) # myProc.add_stage(CPU_Mean('segment')) # myProc.add_stage_end(CPU_Mean('repetition')) myProc.add_stage(CPU_FFT()) a = new_digi.get_data(data_processor=myProc) b = new_digi.get_data(data_processor=myProc) c = new_digi.get_data(data_processor=myProc) d = new_digi.get_data(data_processor=myProc) e = new_digi.get_data(data_processor=myProc) f = 0 # new_digi._set_channels(2) # new_digi.pretrigger_memory_size(0) # for m in range(20): # a = new_digi.get_data()#(data_processor=myProc) # print(new_digi.get_error_info32bit()) # print(a['data']['ch0'].shape) cur_time = time.time() a = new_digi.get_data(data_processor=None) cur_time = time.time() - cur_time plt.plot(a['data']['ch0'][0][0]) plt.plot(a['data']['ch0'][0][0] * np.cos( 2 * np.pi * 25e6 * np.arange(a['data']['ch0'][0][0].size) / 500e6)) # plt.plot(a['data']['ch0_I'][0][0]) # plt.plot(a['data']['ch0_Q'][0][0]) # dataVals = a['data']['ch0'][0][0] # yf = scipy.fftpack.fft(dataVals) # N = dataVals.size # T = 1.0 / 500e6 # x = np.linspace(0.0, N*T, N) # xf = np.linspace(0.0, 1.0/(2.0*T), int(N/2)) # plt.plot(xf, 2.0/N * np.abs(yf[:N//2])) plt.show() input('Press ENTER') print('we made it!') # np.savetxt('sample.txt', np.ndarray.flatten(a['data']['ch0'].astype(np.float32)+np.float32(4000*1))) # time.sleep(5) print('we wrote it!') # gc.collect() fig, axs = plt.subplots(2) for r in range(2): #acq_module.NumRepetitions): for s in range(1): axs[0].plot(a['data']['ch0_I'][r][s].astype(np.float32) + np.float32(4000 * r)) axs[0].plot(a['data']['ch1_I'][r][s].astype(np.float32) + np.float32(4000 * r)) # # axs[0].plot(np.ones(a['data']['ch0'][r][s].size)) # axs[1].plot(np.ones(512)) # plt.plot(leData[0][0]) # plt.show() print('we plotted it!') # input('wait') new_digi.samples(496) #2**8+2**7) b = new_digi.get_data() #(data_processor=myProc) print('we made it!') # time.sleep(2) # np.savetxt('sample.txt', np.ndarray.flatten(a['data']['ch0'].astype(np.float32)+np.float32(4000*1))) print('we wrote it!') # gc.collect() for r in range(1): #acq_module.NumRepetitions): for s in range(new_digi.NumSegments): axs[1].plot(b['data']['ch0'][r][s].astype(np.float32) + np.float32(4000 * r)) # axs[1].plot(np.ones(512)) # plt.plot(leData[0][0]) plt.show() # # fig.show() # #a = [print(np.array(x)) for x in new_digi.multiple_trigger_fifo_acquisition(3*2**26,384,2**11)] # # assert (num_of_acquisitions*self.samples.get()%4096 == 0) or (num_of_acquisitions*self.samples.get() in [2**4, 2**5, 2**6, 2**7, 2**8, 2**9, 2**10, 2**11]), "The number of total samples requested to the card is not valid.\nThis must be 16, 32, 64, 128, 256, 512, 1k ,2k or any multiple of 4k.\nThe easiest way to ensure this is to use powers of 2 for averages, samples and segments, probably in that order of priority." # s=0 input("done")
from sqdtoolz.HAL.GENmwSource import* from sqdtoolz.HAL.WaveformSegments import* from sqdtoolz.HAL.WaveformTransformations import* from sqdtoolz.Drivers.dummyDDG import* from sqdtoolz.Drivers.dummyACQ import* from sqdtoolz.Drivers.dummyAWG import* from sqdtoolz.Drivers.dummyGENmwSource import* from sqdtoolz.ExperimentConfiguration import* from sqdtoolz.Variable import* from sqdtoolz.Experiments.Experimental.ExperimentCavitySpectroscopy2 import* from sqdtoolz.ExperimentConfigurations.Experimental.ExpConfigIQpulseInSingleOut import ExpConfigIQpulseInSingleOut from sqdtoolz.Experiments.Experimental.ExperimentRabi import ExperimentRabi import numpy as np 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", [(instr_awg, 'CH3'),(instr_awg, 'CH4')], 1e9) acq_module = ACQ(instr_acq) freq_src_module = GENmwSource(instr_fsrc.get_output('CH1'))
from sqdtoolz.HAL.ACQ import* from sqdtoolz.HAL.AWG import* from sqdtoolz.HAL.GENmwSource import* from sqdtoolz.HAL.WaveformSegments import* from sqdtoolz.HAL.WaveformTransformations import* from sqdtoolz.Drivers.dummyDDG import* from sqdtoolz.Drivers.dummyACQex import* from sqdtoolz.Drivers.dummyAWG import* from sqdtoolz.Drivers.dummyGENmwSource import* from sqdtoolz.ExperimentConfiguration import* from sqdtoolz.Variable import* from sqdtoolz.HAL.Processors.ProcessorCPU import* from sqdtoolz.HAL.Processors.CPU.CPU_Max import* from sqdtoolz.HAL.Processors.CPU.CPU_Mean import* 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')