Skip to content
Snippets Groups Projects
Commit b999c2e0 authored by Stephan Philips's avatar Stephan Philips
Browse files

clean up

parent a09565b5
No related branches found
No related tags found
No related merge requests found
import sys
sys.path.append('C:\Program Files (x86)\Keysight\SD1\Libraries\Python')
sys.path.append("C:\\V2_code\\Qcodes")
import numpy as np
import matplotlib.pyplot as plt
from segments import *
from keysight_fx import *
import uuid
import qcodes.instrument_drivers.Keysight.SD_common.SD_AWG as keysight_awg
import qcodes.instrument_drivers.Keysight.SD_common.SD_DIG as keysight_dig
'''
ideas:
# Make a virtual sequence.
#
'''
class pulselib:
'''
Global class that is an organisational element in making the pulses.
The idea is that you first make individula segments,
you can than later combine them into a sequence, this sequence will be uploaded
'''
def __init__(self):
# awg channels and locations need to be input parameters.
self.awg_channels = ['P1','P2','P3','P4','P5','B0','B1','B2','B3','B4','B5','G1','I_MW', 'Q_MW', 'M1', 'M2']
self.awg_channels_to_physical_locations = dict({'B0':('AWG1', 1),
'P1':('AWG1', 2),
'B1':('AWG1', 3),
'P2':('AWG1', 4),
'B2':('AWG2', 1),
'P3':('AWG2', 2),
'B3':('AWG2', 3),
'P4':('AWG2', 4),
'B4':('AWG3', 1),
'P5':('AWG3', 2),
'B5':('AWG3', 3),
'G1':('AWG3', 4),
'I_MW':('AWG4', 1),
'Q_MW':('AWG4', 2),
'M1':('AWG4', 3),
'M2':('AWG4', 4)})
self.awg_channels_kind = []
self.awg_virtual_channels = {'virtual_gates_names_virt' : ['vP1','vP2','vP3','vP4','vP5','vB0','vB1','vB2','vB3','vB4','vB5'],
'virtual_gates_names_real' : ['P1','P2','P3','P4','P5','B0','B1','B2','B3','B4','B5'],
'virtual_gate_matrix' : np.eye(11)}
self.awg_virtual_channels['virtual_gate_matrix'][0,1] = 0.1
self.awg_virtual_channels['virtual_gate_matrix'][0,2] = 0.1
# Not implemented
self.awg_markers =['mkr1', 'mkr2', 'mkr3' ]
self.awg_markers_to_location = []
self.channel_delays = dict()
for i in self.awg_channels:
self.channel_delays[i] = 0
self.delays = []
self.convertion_matrix= []
self.segments_bin = segment_bin(self.awg_channels, self.awg_virtual_channels)
awg1 = keysight_awg.SD_AWG('awg1', chassis = 0, slot= 2, channels = 4, triggers= 8)
awg2 = keysight_awg.SD_AWG('awg2', chassis = 0, slot= 3, channels = 4, triggers= 8)
awg3 = keysight_awg.SD_AWG('awg3', chassis = 0, slot= 4, channels = 4, triggers= 8)
awg4 = keysight_awg.SD_AWG('awg4', chassis = 0, slot= 5, channels = 4, triggers= 8)
# Keysight properties.
self.backend = 'keysight'
self.awg = keysight_AWG(self.segments_bin, self.awg_channels_to_physical_locations, self.awg_channels, self.channel_delays)
self.awg.add_awg('AWG1',awg1)
self.awg.add_awg('AWG2',awg2)
self.awg.add_awg('AWG3',awg3)
self.awg.add_awg('AWG4',awg4)
self.sequencer = sequencer(self.awg, self.channel_delays, self.segments_bin)
def add_channel_delay(self, delays):
'''
Adds to a channel a delay.
The delay is added by adding points in front of the first sequence/or
just after the last sequence. The first value of the sequence will be
taken as an extentsion point.
Args:
delays: dict, e.g. {'P1':20, 'P2':16} delay P1 with 20 ns and P2 with 16 ns
Returns:
0/Error
'''
for i in delays.items():
if i[0] in self.awg_channels:
self.channel_delays[i[0]] = i[1]
else:
raise ValueError("Channel delay error: Channel '{}' does not exist. Please provide valid input".format(i[0]))
return 0
def add_awgs(self, name, awg):
self.awg.add_awg(name, awg)
def mk_segment(self, name):
return self.segments_bin.new(name)
def get_segment(self, name):
return self.segments_bin.get(name)
def add_sequence(self,name,seq):
'''
name: name for the sequence, if name already present, it will be overwritten.
seq: list of list,
e.g. [ ['name segment 1' (str), number of times to play (int), prescale (int)] ]
prescale (default 0, see keysight manual) (not all awg's will support this).
'''
self.sequencer.add_sequence(name, seq)
def start_sequence(self, name):
self.sequencer.start_sequence(name)
def show_sequences(self):
self.segments_bin.print_segments_info()
class segment_bin():
def __init__(self, channels, virtual_gate_matrix=None):
self.segment = []
self.channels = channels
self.virtual_gate_matrix = virtual_gate_matrix
return
def new(self,name):
if self.exists(name):
raise ValueError("sement with the name : % \n alreadt exists"%name)
self.segment.append(segment_container(name,self.channels, self.virtual_gate_matrix))
return self.get_segment(name)
def get_segment(self, name):
for i in self.segment:
if i.name == name:
return i
raise ValueError("segment not found :(")
def used(self, name):
''' check if a segment is used (e.g. that a leas one element is used)
name is a string.
'''
seg = self.get_segment(name)
if seg.total_time == 0:
return False
return True
def print_segments_info(self):
mystring = "Sequences\n"
for i in self.segment:
mystring += "\tname: " + i.name + "\n"
print(mystring)
def exists(self, name):
for i in self.segment:
if i.name ==name:
return True
return False
def get_time_segment(self, name):
return self.get_segment(name).total_time
class sequencer():
def __init__(self, awg_system, channel_delays, segment_bin):
self.awg = awg_system
self.segment_bin = segment_bin
self.channels = segment_bin.channels
self.channel_delays = channel_delays
self.sequences = dict()
def add_sequence(self, name, sequence):
self.sequences[name] = sequence
def start_sequence(self, name):
self.get_sequence_upload_data(name)
self.awg.upload(self.sequences[name], self.get_sequence_upload_data(name))
self.awg.start()
def get_sequence_upload_data(self, name):
'''
Function that generates sequence data per channel.
It will also assign unique id's to unique sequences (sequence that depends on the time of playback). -> mainly important for iq mod purposes.
structure:
dict with key of channel:
for each channels list of sequence:
name of the segments,
number of times to play
uniqueness -> segment is reusable?
identifiers for marking differnt locations in the ram of the awg.
'''
upload_data = dict()
# put in a getter to make sure there is no error -- it exists...
seq = self.sequences[name]
for chan in self.channels:
sequence_data_single_channel = []
num_elements = len(seq)
for k in range(len(seq)):
segment_play_info = seq[k]
# if starting segment or finishing segment, here there should be added the delay info.
pre_delay, post_delay = (0,0)
if k == 0:
pre_delay = self.get_pre_delay(chan)
if k == len(seq)-1:
post_delay = self.get_post_delay(chan)
if pre_delay!=0 or post_delay!=0:
rep = segment_play_info[1]
segment_play_info[1] = 1
input_data = self.generate_input_data(segment_play_info, chan, pre_delay, post_delay)
sequence_data_single_channel.append(input_data)
# If only one, go to next segment in the sequence.
if rep == 1 :
continue
else:
segment_play_info[1] = rep -1
sequence_data_single_channel.append(self.generate_input_data(segment_play_info, chan))
upload_data[chan] = sequence_data_single_channel
return upload_data
def generate_input_data(self, segment_play_info, channel, pre_delay=0, post_delay=0):
'''
function that will generate a dict that defines the input data, this will contain all the neccesary info to upload the segment.
returns:
dict with sequence info for a cerain channel (for parameters see the code).
'''
input_data = {'segment': segment_play_info[0],
'segment_name': self.make_segment_name(segment_play_info[0], pre_delay, post_delay),
'ntimes': segment_play_info[1],
'prescaler': segment_play_info[2],
'pre_delay': pre_delay,
'post_delay': post_delay}
unique = getattr(self.segment_bin.get_segment(segment_play_info[0]), channel).unique
input_data['unique'] = unique
# Make unique uuid's for each segment
if unique == True:
input_data['identifier'] = [uuid.uuid4() for i in range(segment_play_info[1])]
return input_data
def make_segment_name(self, segment, pre_delay, post_delay):
'''
function that makes the name of the segment that is delayed.
Note that if the delay is 0 there should be no new segment name.
'''
segment_name = segment
if pre_delay!=0 or post_delay!= 0:
segment_name = segment + '_' + str(pre_delay) + '_' + str(post_delay)
return segment_name
def calculate_total_channel_delay(self):
'''
function for calculating how many ns time there is a delay in between the channels.
Also support for negative delays...
returns:
tot_delay (the total delay)
max_delay (hight amount of the delay)
'''
delays = np.array( list(self.channel_delays.values()))
tot_delay = np.max(delays) - np.min(delays)
return tot_delay, np.max(delays)
def get_pre_delay(self, channel):
'''
get the of ns that a channel needs to be pushed forward/backward.
returns
pre-delay : number of points that need to be pushed in from of the segment
'''
tot_delay, max_delay = self.calculate_total_channel_delay()
max_pre_delay = tot_delay - max_delay
delay = self.channel_delays[channel]
return delay + max_pre_delay
def get_post_delay(self, channel):
'''
get the of ns that a channel needs to be pushed forward/backward.
returns
post-delay: number of points that need to be pushed after the segment
'''
tot_delay, max_delay = self.calculate_total_channel_delay()
delay = self.channel_delays[channel]
print(tot_delay, max_delay, delay)
print("post_delay", delay - (tot_delay - max_delay))
return -delay + max_delay
p = pulselib()
p.add_channel_delay({'B4':-3,})
p.add_channel_delay({'M2':-115,})
#%%
p.sequencer = sequencer(p.awg, p.channel_delays, p.segments_bin)
seg = p.mk_segment('INIT')
seg2 = p.mk_segment('Manip')
seg3 = p.mk_segment('Readout')
# seg.B4.add_block(0,10,1)
# seg.B4.wait(100)
# seg.B4.add_block(0,10,1)
# seg.B4.add_block(200,300,1)
seg.B0.add_block(0, 10, 1.5)
# seg.B0.add_block(10000, 10010, 1)
# seg.B0.add_block(10010, 10112, 0)
seg.B0.wait(10000)
seg.B4.add_block(0, 10, -1.5)
seg.B4.wait(10000)
# amp = np.linspace(0,1,50)
# period = 1000
# t = 0
# for i in range(50):
# seg.B4.add_block(t, t+period, amp[i])
# t+= period
# seg.B4.repeat(5)
# amp = np.linspace(0,1,50)
# period = 1000*50
# t = 0
# for i in range(50):
# seg.I_MW.add_block(t, t+period, amp[i])
# t+= period
# seg.G1.add_block(100, 130, 1)
# seg.M2.add_block(100, 130, 1)
# seg.B0.add_block(20,205,1)
# seg.B0.add_block(205,285,-1)sd
# seg.B0.add_block(20,205,1)
# seg.B0.add_block(20,50000,1)
# segs = [seg.B0, seg.P1, seg.B1, seg.P2]
# amp = 0.25
# for i in segs:
# i.add_pulse([[0,-amp]])
# # i.add_block(20,25, -amp + 3)
# # i.add_block(60,65, -amp + 2)
# # i.add_block(100,105, -amp + 1)
# # i.add_block(140,145, -amp + 0.5)
# # i.add_block(180,185, -amp + 0.2)
# t = 10
# for j in range(1,50):
# i.add_block(t,t+j*2,amp)
# t = t+j*2
# t = t + 50
# i.add_pulse([[10000,-amp]])
# amp = 1
# seg.P1.add_pulse([
# [0,-amp],
# [10,amp],
# [9000,amp],
# [9000,-amp],
# [14000,-amp]])
# seg.B4.add_pulse([
# [0,-amp],
# [10,amp],
# [9000,amp],
# [9000,-amp],
# [14000,-amp]])
# t = 0
# amp = 0.1
# seg.B4.add_pulse([
# [0,-amp]])
# for i in range(1,50):
# seg.B4.add_block(t,t+i*2,amp)
# t = t+i*2
# t = t + 50
# t = 0
# seg.P1.add_pulse([
# [0,-amp]])
# for i in range(1,50):
# seg.P1.add_block(t,t+i*2,amp)
# t = t+i*2
# t = t + 50
# seg.B4.add_pulse([
# [0,-1.5],
# [40,-1.5],
# [40,1.5],
# [80,0],
# [80,-0.75],
# [90,-0.75]])
# seg.B4.add_block(100,110,-0.75+0.15)
# seg.B4.add_block(120,130,-0.75+0.1)
# seg.B4.add_block(140,150,-0.75+0.05)
# seg.B4.add_pulse([
# [200,0],
# [210,1],
# [210,-0.2],
# [240,0],
# [275,1.3],
# [275,-0.75],
# [300,-0.75],
# [300,-0.5],
# [310,-0.5],
# [310,0]])
# seg.B4.add_block(10,20000,0.3)
# seg.P5.add_block(10,20000,-0.3)
# seg.B5.add_block(10,20000,-0.3)
# seg.G1.add_block(10,20000,0.3)
# append functions?
# seg.P1.add_block(2,5,-1)
# seg.P1.add_pulse([[100,0.5]
# ,[800,0.5],
# [1400,0]])
# seg.B2.add_block(2,5,-1)
# seg.B2.add_pulse([[20,0],[30,0.5], [30,0]])
# seg.B2.add_block(40,70,1)
# seg.B2.add_pulse([[70,0],
# [80,0],
# [150,0.5],
# [150,0]])
# seg.B4.add_block(2,5,1)
# seg.B4.add_block(2,10,1)
# seg.M2.wait(50)
# seg.M2.plot_sequence()
# seg.B0.repeat(20)
# seg.B0.wait(20)
# print(seg.B0.my_pulse_data)
# seg.reset_timevoltage_range_reset_needed()
# seg.B2.add_block(30,60,1)
# seg.B2.add_block(400,800,0.5)
# seg.B2.add_block(1400,1500,0.5)
# seg.B1.plot_sequence()
# seg.M2.add_pulse([[20,0.2],[30,0]])
# seg.M2.add_block(30,60,1)
# seg.M2.wait(2000)
# seg.M2.add_block(90,120,1)
# seg.M2.plot_sequence()
# seg.M2.add_block(400,800,0.5)
# seg.M2.add_block(1400,1500,0.5)
# seg2.B2.add_block(30,60,0)
# seg2.B2.add_block(400,2000,0.1)
# seg2.P1.add_block(30,60,0)
# seg2.P1.add_block(400,800,0.5)
# seg2.B0.add_block(30,60,0.1)
# seg2.B0.add_block(400,800,0.1)
# seg2.B0.wait(2000)
# seg3.B5.add_block(30,600,0.1)
# seg3.B5.wait(2000)
p.show_sequences()
SEQ = [['INIT', 1, 0]]
p.add_sequence('mysequence', SEQ)
p.start_sequence('mysequence')
SEQ2 = [['INIT', 1, 0], ['Manip', 1, 0], ['Readout', 1, 0] ]
# p.add_sequence('mysequence2', SEQ2)
# p.start_sequence('mysequence2')
# insert in the begining of a segment
# seg.insert_mode()
# seg.clear()
# # class channel_data_obj():
# # #object containing the data for a specific channels
# # #the idea is that all the data is parmeterised and will be constuceted whenever the function is called.
# # self.my_data_array = np.empty()
# # add_data
# # class block_pulses:
# # # class to make block pulses
# # how to do pulses
# # -> sin?
# # -> pulses?
# # -> step_pulses
# # p = pulselin()
# # seg = pulselib.mk_segment('manip')
# # seg.p1.add_pulse(10,50, 20, prescaler= '1')
# # seg.p3.add_pulse(12,34, 40,)
# # seg.k2.add_pulse_advanced([pulse sequence])
# # seg.add_np(array, tstart_t_stop
# # seg.p5.add_sin(14,89, freq, phase, amp)
# # pulse
# import datetime
# print(datetime.datetime.utcfromtimestamp(0))
\ No newline at end of file
File added
from example_init import return_pulse_lib
pulse = return_pulse_lib()
\ No newline at end of file
from pulse_lib.base_pulse import pulselib
import numpy as np
def return_pulse_lib():
pulse = pulselib()
# Let's just use a non-pysical AWG
pulse.add_awgs('AWG1',None)
pulse.add_awgs('AWG2',None)
# define real channels
awg_channels_to_physical_locations = dict({'B0':('AWG1', 1), 'P1':('AWG1', 2),
'B1':('AWG1', 3), 'P2':('AWG1', 4),'B2':('AWG2', 1),
'MW_gate_I':('AWG2', 2), 'MW_gate_Q':('AWG2', 3),
'MW_marker':('AWG2', 4)})
pulse.define_channels(awg_channels_to_physical_locations)
# define virtual channels
awg_virtual_gates = {
'virtual_gates_names_virt' :
['vB0', 'vB1', 'vB2', 'vP1', 'vP2'],
'virtual_gates_names_real' :
['B0', 'B1', 'B2', 'P1', 'P2'],
'virtual_gate_matrix' : np.eye(5)
}
pulse.add_virtual_gates(awg_virtual_gates)
# define IQ channels
awg_IQ_channels = {
'vIQ_channels' : ['qubit_1','qubit_2'],
'rIQ_channels' : [['MW_gate_I','MW_gate_Q'],['MW_gate_I','MW_gate_Q']],
'LO_freq' :[10e9, 10e9]
}
pulse.add_IQ_virt_channels(awg_IQ_channels)
# define delays
pulse.add_channel_delay({
'B0': 20,
'P1': 20,
'B1': 20,
'P2': 20,
'B2': 20,
'MW_gate_I': 70,
'MW_gate_Q': 70,
'MW_marker': 5
})
# finish initialisation (! important if using keysight uploader)
return pulse.finish_init()
if __name__ == '__main__':
pulse = return_pulse_lib()
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
File deleted
File deleted
No preview for this file type
......@@ -134,6 +134,7 @@ class pulselib:
def finish_init(self):
# function that finishes the initialisation
# TODO rewrite, so this function is embedded in the other ones.
self.uploader = keysight_uploader(self.awg_devices, self.cpp_uploader, self.awg_channels, self.awg_channels_to_physical_locations , self.channel_delays_computed, self.channel_compenstation_limits)
def mk_segment(self):
......
from pulse_lib.base_pulse import pulselib
import numpy as np
import matplotlib.pyplot as plt
# w1 = 10e6*np.pi*2
# w2 = 10.1e6*np.pi*2
# phase = np.pi
# t = np.linspace(0, 1e-5, 2000)
# a = np.sin(w1*t)
# b = np.sin(w2*t)
# d = np.sin(w2*t + phase)
# plt.plot(t,a+b)
# plt.plot(t,a+d)
# plt.show()
p = pulselib()
class AWG(object):
"""docstring for AWG"""
def __init__(self, name):
self.name = name
self.chassis = 0
self.slot = 0
self.type = "DEMO"
AWG1 = AWG("AWG1")
AWG2 = AWG("AWG2")
AWG3 = AWG("AWG3")
AWG4 = AWG("AWG4")
# add to pulse_lib
p.add_awgs('AWG1',AWG1)
p.add_awgs('AWG2',AWG2)
p.add_awgs('AWG3',AWG3)
p.add_awgs('AWG4',AWG4)
# define channels
awg_channels_to_physical_locations = dict({'B0':('AWG1', 1), 'P1':('AWG1', 2),
'B1':('AWG1', 3), 'P2':('AWG1', 4),
'B2':('AWG2', 1), 'P3':('AWG2', 2),
'B3':('AWG2', 3), 'P4':('AWG2', 4),
'B4':('AWG3', 1), 'P5':('AWG3', 2),
'B5':('AWG3', 3), 'G1':('AWG3', 4),
'I_MW1':('AWG4', 1), 'Q_MW1':('AWG4', 2),
'I_MW2':('AWG4', 3), 'Q_MW2':('AWG4', 4)})
p.define_channels(awg_channels_to_physical_locations)
# format : dict of channel name with delay in ns (can be posive/negative)
p.add_channel_delay({
'I_MW1':50,
'Q_MW1':50,
# 'M1':20,
# 'M2':-25,
})
awg_virtual_gates = {
'virtual_gates_names_virt' :
['vP1','vP2','vP3','vP4','vP5','vB0','vB1','vB2','vB3','vB4','vB5'],
'virtual_gates_names_real' :
['P1','P2','P3','P4','P5','B0','B1','B2','B3','B4','B5'],
'virtual_gate_matrix' :
np.eye(11)
}
p.add_virtual_gates(awg_virtual_gates)
p.add_channel_compenstation_limits({'P1': (-100,100),'P2': (-100,100),'B0': (-50,50),'B1': (-50,50)})
awg_IQ_channels = {
'vIQ_channels' : ['qubit_1','qubit_2'],
'rIQ_channels' : [['I_MW1','Q_MW1'],['I_MW2','Q_MW2']],
'LO_freq' :[18.4e9, 19.65e9]
# do not put the brackets for the MW source
# e.g. MW_source.frequency
}
p.add_IQ_virt_channels(awg_IQ_channels)
p.finish_init()
# importarant voltages
P1_unload_Q2 = -20
P2_unload_Q2 = -40
P1_hotspot = -40
P2_hotspot = -50
P1_load_init_Q2 = 0
P2_load_init_Q2 = 0
P1_operating_point =10
P2_operating_point =15
P1_detuning_pulse = -20
P2_detuning_pulse = -35
seg1 = p.mk_segment()
seg1.P1.add_block(0,1e4, P1_unload_Q2)
seg1.P2.add_block(0,1e4, P2_unload_Q2)
seg1.reset_time()
seg1.P1.add_block(0,1e4, P1_hotspot)
seg1.P2.add_block(0,1e4, P2_hotspot)
seg1.reset_time()
seg1.P2.add_block(0,3e4, P1_load_init_Q2)
seg1.P2.add_block(0,3e4, P2_load_init_Q2)
seg2 = p.mk_segment()
#let's make a loop over the 4 possible input combinations
import pulse_lib.segments.looping as lp
phaseQ1 = lp.loop_obj()
phaseQ1.add_data([np.pi/2, np.pi/2, -np.pi/2, -np.pi/2], axis = 0, names = 'phases', units = 'Rad')
phaseQ2 = lp.loop_obj()
phaseQ2.add_data([np.pi/2, -np.pi/2, np.pi/2, -np.pi/2], axis = 0, names = 'phases', units = 'Rad')
freq_1 = 18.4e9
freq_2 = 19.7e9
# define global voltage for the whole sequence (operating point voltages (we do not want to define them in every pulse))
seg2.P1 += P1_operating_point
seg2.P2 += P2_operating_point
# two microwave pulses
seg2.qubit_1.add_sin(0,225,freq_1 ,40, np.pi/4)
seg2.qubit_2.add_sin(0,225,freq_2 ,20, np.pi/4)
seg2.qubit_2.wait(5)
seg2.reset_time()
# cphase
seg2.P1.add_block(0, 90, P1_detuning_pulse)
seg2.P2.add_block(0, 90, P2_detuning_pulse)
seg2.P2.wait(5)
seg2.reset_time()
# add reference shifts for the microwave pulses
seg2.qubit_1.add_global_phase(phaseQ1)
seg2.qubit_2.add_global_phase(phaseQ2)
# two microwave pulses
seg2.qubit_1.add_sin(0,225,freq_1 ,40, np.pi/4)
seg2.qubit_2.add_sin(0,225,freq_2 ,20, np.pi/4)
seg2.qubit_2.wait(5)
seg2.reset_time()
# cphase
seg2.P1.add_block(0, 90, P1_detuning_pulse)
seg2.P2.add_block(0, 90, P2_detuning_pulse)
seg2.P2.wait(5)
seg2.reset_time()
# two microwave pulses
seg2.qubit_1.add_sin(0,225,freq_1 ,40, np.pi/4)
seg2.qubit_2.add_sin(0,225,freq_2 ,20, np.pi/4)
seg2.qubit_2.wait(5)
seg2.reset_time()
plt.figure()
seg2.I_MW1.plot_segment([0])
seg2.Q_MW1.plot_segment([0])
# seg2.I_MW2.plot_segment([0])
# seg2.Q_MW2.plot_segment([0])
plt.legend()
# plt.figure()
# seg2.I_MW1.plot_segment([1])
# seg2.Q_MW1.plot_segment([1])
# seg2.I_MW2.plot_segment([1])
# seg2.Q_MW2.plot_segment([1])
# plt.legend()
# plt.figure()
# seg2.I_MW1.plot_segment([2])
# seg2.Q_MW1.plot_segment([2])
# seg2.I_MW2.plot_segment([2])
# seg2.Q_MW2.plot_segment([2])
# plt.legend()
# plt.figure()
# seg2.I_MW1.plot_segment([3])
# seg2.Q_MW1.plot_segment([3])
# seg2.I_MW2.plot_segment([3])
# seg2.Q_MW2.plot_segment([3])
# plt.legend()
# plt.figure()
# seg1.P1.plot_segment()
# seg1.P2.plot_segment()
# plt.show()
seg3 = p.mk_segment()
seg3.P1.add_block(0,1e4, 0.4)
# seg1.extend_dim(seg2.shape, ref=True)
# # print(seg1.B0.data)
# channel = 'P1'
# pre_delay = -5
# post_delay = 0
# index = [0]
# neutralize = True
# sample_rate = 1e9
# import time
# start = time.time()
# wvf = seg1.get_waveform(channel, [0], pre_delay, post_delay, sample_rate)
# stop = time.time()
# print(stop-start, len(wvf))
# start = time.time()
# wvf = seg1.get_waveform(channel, [1], pre_delay, post_delay, sample_rate)
# stop = time.time()
# print(stop-start, len(wvf))
# wvf = seg1.get_waveform(channel, [1], pre_delay, post_delay, sample_rate)
# print(seg1.P1._pulse_data_all[1])
# stop = time.time()
# print(stop-start, len(wvf))
# pre_delay = 0
# post_delay = 0
# intgral = 0
# if neutralize == True:
# intgral = getattr(seg1, channel).integrate(index, pre_delay, post_delay, sample_rate)
# vmin = getattr(seg1, channel).v_min(index, sample_rate)
# vmax = getattr(seg1, channel).v_max(index, sample_rate)
# print(intgral)
# sequence using default settings
sequence = [seg1,seg2,seg3]
# same sequence using extended settings (n_rep = 1, prescalor = 1)
sequence = [[seg1,1, 1],[seg2,1, 1],[seg3,1, 1]]
my_seq = p.mk_sequence(sequence)
my_seq.upload([0])
my_seq.upload([1])
my_seq.upload([2])
my_seq.upload([3])
p.uploader.uploader()
my_seq.play([0])
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment