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

updated pulse

parent 38033d89
No related branches found
No related tags found
No related merge requests found
......@@ -10,10 +10,10 @@ class pulselib:
def __init__(self):
self.awg_channels = ['ch1']
self.awg_channels = ['P1','P2','P3','P4','P5','B0','B1','B2','B3','B4','B5',]
self.awg_channels_to_physical_locations = ['here_dict']
self.awg_channels_kind = []
self.marker_channels =['names']
self.marker_channels =['mkr1', 'mkr2', 'mkr3' ]
self.marger_channels_to_location = []
self.delays = []
self.convertion_matrix= []
......@@ -46,30 +46,93 @@ class segment_container():
for i in self.channels:
setattr(self, i, segment_single())
def reset_time(self):
maxtime = 0
for i in self.channels:
k = getattr(self, i)
t = k.get_total_time()
if t > maxtime:
maxtime = t
print(maxtime)
for i in self.channels:
getattr(self, i).latest_time = maxtime
class segment_single():
def __init__(self):
self.test = 'test'
self.type = 'default'
self.to_swing = False
self.latest_time = 0
self.my_pulse_data = np.zeros([1,2])
self.last = None
self.IQ_data = [] #todo later.
def add_pulse(self,array):
'''
format ::
[[t0, Amp0],[t1, Amp1]]
'''
arr = np.asarray(array)
arr[:,0] = arr[:,0] + self.latest_time
self.my_pulse_data = np.append(self.my_pulse_data,arr, axis=0)
def add_pulse(array, channel):
def add_block(self,start,stop, amplitude):
amp_0 = self.my_pulse_data[-1,1]
pulse = [ [start, amp_0], [start,amplitude], [stop, amplitude], [stop, amp_0]]
self.add_pulse(pulse)
def wait(self, wait):
amp_0 = self.my_pulse_data[-1,1]
t0 = self.my_pulse_data[-1,0]
pulse = [wait+t0, amp_0]
def repeat(self, number):
return
def add_np(self,start, array):
return
def add_IQ_pair():
return
def add():
return
def reset_time():
# aligns all time together -- the channel with the longest time will be chosen
return
def get_total_time(self):
return self.my_pulse_data[-1,0]
def get_sequence(self, voltage_range = None, off_set = None):
'''
Returns a numpy array that contains the points for each ns
'''
return None
def plot_sequence(self):
return None
class marker_single():
def __init__(self):
self.type = 'default'
self.swing = False
self.latest_time = 0
self.my_pulse_data = np.zeros([1,2])
def add(self, start, stop):
self.my_pulse_data = np,append(self.my_pulse_data, [[start,0],[start,1],[stop,1],[stop,0]])
class segment_bin():
def __init__(self, channels):
self.segment = []
self.channels = channels
return
return
def new(self,name):
if self.exists(name):
......@@ -88,10 +151,24 @@ class segment_bin():
if i.name ==name:
return True
return False
p = pulselib()
seg = p.mk_segment('test')
print(seg.ch1.test)
# append functions?
seg.B0.add_pulse([[10,5]
,[20,5]])
seg.B0.add_pulse([[20,0],[30,5], [30,0]])
seg.B0.add_block(40,70,2)
seg.B0.add_pulse([[70,0], [80,0], [150,100], [150,0]])
# seg.B0.repeat(20)
seg.B0.wait(20)
print(seg.B0.my_pulse_data)
seg.reset_time()
# 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.
......
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