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

update

parent 5c57d558
No related branches found
No related tags found
No related merge requests found
No preview for this file type
No preview for this file type
File added
No preview for this file type
File added
import numpy as np
import copy
import segments_c_func as seg_func
class pulse_data():
......@@ -7,8 +11,12 @@ class pulse_data():
def __init__(self):
self.my_pulse_data = np.zeros([1,2], dtype=np.double)
self.sin_data = []
self.sim_mod_data = []
self.numpy_data = []
self.start_time = 0
def add_pulse_data(self, input):
self.my_pulse_data = self._add_up_pulse_data(input)
......@@ -29,6 +37,9 @@ class pulse_data():
total_time = self.my_pulse_data[-1,0]
return total_time
def reset_time(self,):
self.start_time = self.total_time
def get_vmax(self):
'''
calculate the maximum voltage in the current segment_single.
......@@ -63,6 +74,19 @@ class pulse_data():
return max_pulse_data - max_amp_sin
def render(self, start_time = 0, stoptime = 0, sample_rate=1e9):
'''
renders pulse
Args:
start_time (double) : from which points the rendering needs to start
stop_time (double) : to which point the rendering needs to go (default (-1), to entire segement)
sample_rate (double) : rate at which the AWG will be run
returns
pulse (np.ndarray) : numpy array of the pulse
'''
raise NotImplemented
def _add_up_pulse_data(self, new_pulse):
'''
add a pulse up to the current pulse in the memory.
......@@ -114,14 +138,68 @@ class pulse_data():
my_copy.numpy_data = copy.copy(self.numpy_data)
return my_copy
def __add__(self, other):
'''
define addition operator for segment_single
'''
new_data = pulse_data()
if type(other) is pulse_data:
if len(other.my_pulse_data) == 1:
new_data.my_pulse_data = copy.copy(self.my_pulse_data)
elif len(self.my_pulse_data) == 1:
new_data.my_pulse_data = copy.copy(other.my_pulse_data)
else:
new_data.my_pulse_data = self._add_up_pulse_data(other.my_pulse_data)
sin_data = copy.copy(self.sin_data)
sin_data.extend(other.sin_data)
new_data.sin_data = sin_data
elif type(other) == int or type(other) == float:
new_pulse = copy.copy(self.my_pulse_data)
new_pulse[:,1] += other
new_data.my_pulse_data = new_pulse
new_data.sin_data = self.sin_data
else:
raise TypeError("Please add up segment_single type or a number ")
return new_data
def __mul__(self, other):
'''
muliplication operator for segment_single
'''
new_data = pulse_data()
if type(other) is pulse_data:
raise NotImplemented
elif type(other) == int or type(other) == float or type(other) == np.float64:
new_pulse = copy.copy(self.my_pulse_data)
new_pulse[:,1] *= other
new_data.my_pulse_data = new_pulse
sin_data = []
for i in self.sin_data:
my_sin = copy.copy(i)
my_sin['amplitude'] *=other
sin_data.append(my_sin)
new_data.sin_data = sin_data
else:
raise TypeError("muliplication shoulf be done with a number, type {} not supported".format(type(other)))
return new_data
class IQ_data():
"""class that manages the data used for generating IQ data
"""
class that manages the data used for generating IQ data
"""
def __init__(self, LO):
self.LO = LO
self.simple_IQ_data = []
self.MOD_IQ_data = []
self.numpy_IQ_data = []
self.start_time = 0
self.global_phase = 0
def add_simple_data(self, input_dict):
self.simple_IQ_data.append(input_dict)
......@@ -132,9 +210,60 @@ class IQ_data():
def add_numpy_IQ(self, input_dict):
self.numpy_IQ_data.append(input_dict)
@property
def total_time(self,):
total_time = 0
for IQ_data_item in self.simple_IQ_data:
if IQ_data_item['stop_time'] > total_time:
total_time = IQ_data_item['stop_time']
for IQ_data_item in self.MOD_IQ_data:
if IQ_data_item['stop_time'] > total_time:
total_time = IQ_data_item['stop_time']
for IQ_data_item in self.numpy_IQ_data:
if IQ_data_item['stop_time'] > total_time:
total_time = IQ_data_item['stop_time']
return total_time
def reset_time(self,):
self.start_time = self.total_time
def __copy__(self,):
my_copy = IQ_data(self.LO)
my_copy.simple_IQ_data = copy.copy(self.simple_IQ_data)
my_copy.MOD_IQ_data = copy.copy(self.MOD_IQ_data)
my_copy.numpy_IQ_data = copy.copy(self.numpy_IQ_data)
my_copy.global_phase = copy.copy(self.global_phase)
my_copy.start_time = copy.copy(self.start_time)
return my_copy
def get_I(self,):
new_data = pulse_data()
for i in self.simple_IQ_data:
my_input = copy.copy(i)
my_input['frequency'] -= self.LO
new_data.add_sin_data(input)
return new_data
def get_Q(self,):
new_data = pulse_data()
for i in self.simple_IQ_data:
my_input = copy.copy(i)
my_input['frequency'] -= self.LO
my_input['phase'] += np.pi/2
new_data.add_sin_data(input)
return new_data
def __add__(self,):
# aussume we do not need this.
raise NotImplemented
def __mul__(self):
# aussume we do not need this.
raise NotImplemented
\ No newline at end of file
import segments_c_func as seg_func
import numpy as np
import copy
class pulse_data():
"""object that saves all the pulse data that is present in an segment object.
This object support all the fundametal operations needed to define the segments."""
def __init__(self):
self.my_pulse_data = np.zeros([1,2], dtype=np.double)
self.sin_data = []
self.numpy_data = []
def add_pulse_data(self, input):
self.my_pulse_data = self._add_up_pulse_data(input)
def add_sin_data(self, input):
self.sin_data.append(input)
def add_numpy_data(self, input):
raise NotImplemented
@property
def total_time(self,):
total_time = 0
for sin_data_item in self.sin_data:
if sin_data_item['stop_time'] > total_time:
total_time = sin_data_item['stop_time']
if self.my_pulse_data[-1,0] > total_time:
total_time = self.my_pulse_data[-1,0]
return total_time
def get_vmax(self):
'''
calculate the maximum voltage in the current segment_single.
Mote that the function now will only look at pulse data and sin data. It will count up the maxima of both the get to a absulute maxima
this could be done more exacly by first rendering the whole sequence, and then searching for the maximum in there.
Though current one is faster. When limiting, this should be changed (though here one shuold implment some smart chaching to avaid havinf to calculate the whole waveform twice).
'''
max_pulse_data = np.max(self.my_pulse_data[:,1])
max_amp_sin = 0.0
for i in self.sin_data:
if max_amp_sin < i['amplitude']:
max_amp_sin = i['amplitude']
return max_pulse_data + max_amp_sin
def get_vmin(self):
'''
calculate the maximum voltage in the current segment_single.
Mote that the function now will only look at pulse data and sin data. It will count up the maxima of both the get to a absulute maxima
this could be done more exacly by first rendering the whole sequence, and then searching for the maximum in there.
Though current one is faster. When limiting, this should be changed (though here one shuold implment some smart chaching to avaid havinf to calculate the whole waveform twice).
'''
max_pulse_data = np.min(self.my_pulse_data[:,1])
max_amp_sin = 0
for i in self.sin_data:
if max_amp_sin < i['amplitude']:
max_amp_sin = i['amplitude']
return max_pulse_data - max_amp_sin
def _add_up_pulse_data(self, new_pulse):
'''
add a pulse up to the current pulse in the memory.
new_pulse --> default format as in the add_pulse function
'''
my_pulse_data_copy = self.my_pulse_data
# step 1: make sure both pulses have the same length
if self.total_time < new_pulse[-1,0]:
to_insert = [[new_pulse[-1,0],my_pulse_data_copy[-1,1]]]
my_pulse_data_copy = self._insert_arrays(my_pulse_data_copy, to_insert, len(my_pulse_data_copy)-1)
elif self.total_time > new_pulse[-1,0]:
to_insert = [[my_pulse_data_copy[-1,0],new_pulse[-1,1]]]
new_pulse = self._insert_arrays(new_pulse, to_insert, len(new_pulse)-1)
my_pulse_data_tmp, new_pulse_tmp = seg_func.interpolate_pulses(my_pulse_data_copy, new_pulse)
final_pulse = np.zeros([len(my_pulse_data_tmp),2])
final_pulse[:,0] = my_pulse_data_tmp[:,0]
final_pulse[:,1] += my_pulse_data_tmp[:,1] + new_pulse_tmp[:,1]
return final_pulse
@staticmethod
def _insert_arrays(src_array, to_insert, insert_position):
'''
insert pulse points in array
Args:
src_array : 2D pulse table
to_insert : 2D pulse table to be inserted in the source
insert_position: after which point the insertion needs to happen
'''
# calcute how long the piece is you want to insert
dim_insert = len(to_insert)
insert_position += 1
new_arr = np.zeros([src_array.shape[0]+dim_insert, src_array.shape[1]])
new_arr[:insert_position, :] = src_array[:insert_position, :]
new_arr[insert_position:(insert_position + dim_insert), :] = to_insert
new_arr[(insert_position + dim_insert):] = src_array[insert_position :]
return new_arr
def __copy__(self):
my_copy = pulse_data()
my_copy.my_pulse_data = copy.copy(self.my_pulse_data)
my_copy.sin_data = copy.copy(self.sin_data)
my_copy.numpy_data = copy.copy(self.numpy_data)
return my_copy
class IQ_data():
"""class that manages the data used for generating IQ data
"""
def __init__(self, LO):
self.LO = LO
self.simple_IQ_data = []
self.MOD_IQ_data = []
self.numpy_IQ_data = []
def add_simple_data(self, input_dict):
self.simple_IQ_data.append(input_dict)
def add_mod_data (self, input_dict):
self.simple_IQ_data.append(input_dict)
def add_numpy_IQ(self, input_dict):
self.numpy_IQ_data.append(input_dict)
def __copy__(self,):
my_copy = IQ_data(self.LO)
my_copy.simple_IQ_data = copy.copy(self.simple_IQ_data)
my_copy.MOD_IQ_data = copy.copy(self.MOD_IQ_data)
my_copy.numpy_IQ_data = copy.copy(self.numpy_IQ_data)
return my_copy
def update_dimension(data, new_dimension_info):
'''
update dimension of the data object to the one specified in new dimension_info
......@@ -383,6 +243,41 @@ def get_new_dim_loop(current_dim, loop_spec):
def update_labels(data_object, loop_spec):
pass
def get_union_of_shapes(shape1, shape2):
"""
function that combines the shape of two shapes.
Args:
shape1 (tuple/array) : shape of the first array
shape2 (tuple/array) : shape of the second array
Returns
new_shape (tuple) : shape of the combined array
"""
shape1 = list(shape1)
shape2 = list(shape2)
len_1 = len(shape1)
len_2 = len(shape2)
max_len = np.max([len_1, len_2])
min_len = np.min([len_1, len_2])
new_shape = [1]*max_len
if len_1>len_2:
new_shape = shape1
elif len_2>len_1:
new_shape = shape2
for i in range(-1, -1-min_len, -1):
if shape1[i] == shape2[i]:
new_shape[i] = shape1[i]
elif shape1[i] == 1:
new_shape[i] = shape2[i]
elif shape2[i] == 1:
new_shape[i] = shape1[i]
else:
raise ValueError("Dimension Mismatch when trying to combine two data object. The first object has on axis {} a dimension of {}, where the second one has a dimension of {}".format(i, shape1[i], shape2[i]))
return tuple(new_shape)
class linspace():
"""docstring for linspace"""
def __init__(self, start, stop, n_steps = 50, name = "undefined", unit = 'a.u.', axis = -1):
......
......@@ -5,6 +5,12 @@ import segments_std as seg_std
import numpy as np
import datetime
"""
TODO :
implement reset time for all channels.
force right dimensions.
"""
class segment_container():
'''
......@@ -37,7 +43,7 @@ class segment_container():
if virtual_gates is not None:
# make segments for virtual gates.
for i in self.virtual_gates['virtual_gates_names_virt']:
setattr(self, i, segment_single())
setattr(self, i, seg_base.segment_single())
# add reference in real gates.
for i in range(len(self.virtual_gates['virtual_gates_names_virt'])):
......@@ -49,6 +55,20 @@ class segment_container():
current_channel.add_reference_channel(self.virtual_gates['virtual_gates_names_virt'][virt_channel],
getattr(self, self.virtual_gates['virtual_gates_names_virt'][virt_channel]),
virtual_gates_values[virt_channel])
if IQ_channels is not None:
for i in range(len(IQ_channels['vIQ_channels'])):
setattr(self, IQ_channels['vIQ_channels'][i], seg_IQ.segment_single_IQ(IQ_channels['LO_freq'][i]))
for i in range(len(IQ_channels['rIQ_channels'])):
I_channel = getattr(self, IQ_channels['rIQ_channels'][i][0])
Q_channel = getattr(self, IQ_channels['rIQ_channels'][i][1])
I_channel.add_IQ_ref_channel(IQ_channels['vIQ_channels'][i],
getattr(self, IQ_channels['vIQ_channels'][i]), 'I')
Q_channel.add_IQ_ref_channel(IQ_channels['vIQ_channels'][i],
getattr(self, IQ_channels['vIQ_channels'][i]), 'Q')
@property
def total_time(self):
time_segment = 0
......@@ -132,4 +152,12 @@ class segment_container():
def clear_chache():
return
t = segment_container("test", ['P1', 'P2', 'P3', 'I', 'Q'])
\ No newline at end of file
awg_IQ_channels = {'vIQ_channels' : ['qubit_1','qubit_2'],
'rIQ_channels' : [['I','Q'],['I','Q']],
'LO_freq' :[1e9, 1e9]
# do not put the brackets for the MW source
}
seg = segment_container("test", ['P1', 'P2', 'P3', 'I', 'Q'], IQ_channels= awg_IQ_channels)
seg.qubit_1
\ No newline at end of file
......@@ -18,27 +18,44 @@ As data format we will use a class to store
'''
import segments_base as seg_base
import numpy as np
from data_handling_functions import loop_controller, IQ_data, linspace
from data_handling_functions import loop_controller, linspace
from data_classes import IQ_data
class segment_single_IQ(seg_base.segment_single):
"""Standard single segment """
"""
Standard single segment for IQ purposes
todo --> add global phase and time shift in the data class instead of this one (cleaner and more generic).
"""
def __init__(self, LO):
'''
Args: frequency of the LO (in Hz)
Args: frequency of the LO (in Hz).
Tip, make on of these segments for each qubit. Then you get a very clean implementation of reference frame changes!
'''
super(seg_base.segment_single, self).__init__()
self.data = np.empty([1], dtype=object)
self.data[0] = IQ_data(LO)
self.ndim = 0
self.shape = []
self.units = []
self.names = []
@loop_controller
def add_global_phase(self,phase):
"""
global shift in phase for all the pulses that will follow.
Args:
phase (double) : phase in radians
Use this function to apply a reference change for the qubit.
"""
print("adding_phase")
self.data_tmp.global_phase += phase
@loop_controller
def add_sin(self, t0, t1, freq, amp, phase = 0):
'''
......@@ -52,14 +69,16 @@ class segment_single_IQ(seg_base.segment_single):
'''
data = {
'type' : 'std',
't0' : t0,
't1' : t1,
'start_time' : t0 + self.data_tmp.start_time,
'stop_time' : t1 + self.data_tmp.start_time,
'frequency' : freq,
'amplitude' : amp,
'phase' : phase,
'phase' : phase + self.data_tmp.global_phase,
}
self.data_tmp.add_simple_data(data)
@loop_controller
def add_chirp(self, t0, t1, f0, f1, amp):
'''
Add chirp to the segment.
......@@ -72,14 +91,15 @@ class segment_single_IQ(seg_base.segment_single):
'''
data = {
'type' : 'chirp',
't0' : t0,
't1' : t1,
'start_time' : t0 + self.data_tmp.start_time,
'stop_time' : t1 + self.data_tmp.start_time,
'frequency1' : f0,
'frequency2' : f1,
'amplitude' : amp,
}
self.data_tmp.add_simple_data(data)
@loop_controller
def add_AM_sin(self, t0, t1, freq, amp, phase, mod=None):
'''
Add amplitude modulation.
......@@ -92,15 +112,16 @@ class segment_single_IQ(seg_base.segment_single):
'''
data = {
'type' : 'AM_mod',
't0' : t0,
't1' : t1,
'start_time' : t0 + self.data_tmp.start_time,
'stop_time' : t1 + self.data_tmp.start_time,
'frequency' : freq,
'amplitude' : amp,
'phase' : phase,
'phase' : phase + self.data_tmp.global_phase,
'mod' : mod
}
self.data_tmp.add_simple_data(data)
@loop_controller
def add_FM_sin(self, t0, t1, freq, amp, phase, mod=None):
'''
Add frequency modulation.
......@@ -113,15 +134,16 @@ class segment_single_IQ(seg_base.segment_single):
'''
data = {
'type' : 'FM_mod',
't0' : t0,
't1' : t1,
'start_time' : t0 + self.data_tmp.start_time,
'stop_time' : t1 + self.data_tmp.start_time,
'frequency' : freq,
'amplitude' : amp,
'phase' : phase,
'phase' : phase + self.data_tmp.global_phase,
'mod' : mod
}
self.data_tmp.add_simple_data(data)
@loop_controller
def add_PM_sin(self, t0, t1, freq, amp, phase, mod=None):
'''
Add phase modulation.
......@@ -134,21 +156,54 @@ class segment_single_IQ(seg_base.segment_single):
'''
data = {
'type' : 'PM_mod',
't0' : t0,
't1' : t1,
'start_time' : t0 + self.data_tmp.start_time,
'stop_time' : t1 + self.data_tmp.start_time,
'frequency' : freq,
'amplitude' : amp,
'phase' : phase,
'phase' : phase + self.data_tmp.global_phase,
'mod' : mod
}
self.data_tmp.add_simple_data(data)
@loop_controller
def add_numpy_IQ(self,I, Q):
raise NotImplemented
def get_I(self):
return
'''
get I and Q data from the main element.
'''
local_data = np.flatten(local_data)
I_data = np.empty(local_data.shape, dtype=object)
for i in range(len(I_data)):
I_data[i] = local_data[i].get_I()
I_data.reshape(self.data.shape)
return I_data
def get_Q(self):
return
local_data = np.flatten(local_data)
Q_data = np.empty(local_data.shape, dtype=object)
for i in range(len(Q_data)):
Q_data[i] = local_data[i].get_I()
Q_data.reshape(self.data.shape)
return Q_data
seg = segment_single_IQ(1e9)
seg.add_sin(0, linspace(5,105,100, axis = 0), 100, 1.1e9)
seg.reset_time()
seg.add_global_phase(0.1)
seg.add_sin(0, linspace(5,105,100, axis = 0), 1.1e9, 10)
print(seg.data[0].simple_IQ_data)
print(seg.data[20].simple_IQ_data)
print(seg.data[80].simple_IQ_data)
\ No newline at end of file
import numpy as np
import datetime
from data_handling_functions import loop_controller, linspace
from data_handling_functions import loop_controller, linspace, get_union_of_shapes, update_dimension
from data_classes import pulse_data
import copy
......@@ -22,7 +22,7 @@ class segment_single():
def __init__(self):
self.type = 'default'
self.to_swing = False
self.starttime = 0
# variable specifing the laetest change to the waveforms
self._last_edit = datetime.datetime.now()
......@@ -36,6 +36,8 @@ class segment_single():
# references to other channels (for virtual gates).
self.reference_channels = []
# reference channels for IQ virtual channels
self.IQ_ref_channels = []
# local copy of self that will be used to count up the virtual gates.
self._pulse_data_all = None
# variable specifing the lastest time the pulse_data_all is updated
......@@ -52,7 +54,22 @@ class segment_single():
virtual_segment = {'name': channel_name, 'segment': segment_data, 'multiplication_factor': multiplication_factor}
self.reference_channels.append(virtual_segment)
# @last_edited
def add_IQ_ref_channel(self, channel_name, pointer_to_channel, I_or_Q_part):
'''
Add a reference to an IQ channel. Same principle as for the virtual one.
Args:
channel_name (str): human readable name of the virtual channel
pointer_to_channel (*segment_single_IQ): pointer to segment_single_IQ object
I_or_Q_part (str) : 'I' or 'Q' to indicate that the reference is to the I or Q part of the signal.
'''
virtual_IQ_segment = {'name': channel_name, 'segment': pointer_to_channel, 'I/Q': I_or_Q_part}
self.IQ_ref_channels.append(virtual_IQ_segment)
@loop_controller
def reset_time(self):
self.data_tmp.reset_time()
@last_edited
@loop_controller
def add_pulse(self,array):
'''
......@@ -65,25 +82,25 @@ class segment_single():
'''
if array[0] != [0.,0.]:
array = [[0,0]] + array
if self.starttime != 0:
if self.data_tmp.start_time != 0:
array = [[0,0]] + array
arr = np.asarray(array)
arr[1:,0] = arr[1:,0] + self.starttime
arr[1:,0] = arr[1:,0] + self.data_tmp.start_time
self.data_tmp.add_pulse_data(arr)
# @last_edited
@last_edited
@loop_controller
def add_block(self,start,stop, amplitude):
'''
add a block pulse on top of the existing pulse.
'''
if start != 0:
pulse = np.array([[0,0], [start + self.starttime, 0], [start + self.starttime,amplitude], [stop + self.starttime, amplitude], [stop + self.starttime, 0]], dtype=np.double)
pulse = np.array([[0,0], [start + self.data_tmp.start_time, 0], [start + self.data_tmp.start_time,amplitude], [stop + self.data_tmp.start_time, amplitude], [stop + self.data_tmp.start_time, 0]], dtype=np.double)
else:
pulse = np.array([[start + self.starttime, 0], [start + self.starttime,amplitude], [stop + self.starttime, amplitude], [stop + self.starttime, 0]], dtype=np.double)
pulse = np.array([[start + self.data_tmp.start_time, 0], [start + self.data_tmp.start_time,amplitude], [stop + self.data_tmp.start_time, amplitude], [stop + self.data_tmp.start_time, 0]], dtype=np.double)
self.data_tmp.add_pulse_data(pulse)
......@@ -106,8 +123,8 @@ class segment_single():
The pulse will have a relative phase (as this is needed to all IQ work).
'''
self.data_tmp.add_sin_data(
{'start_time' : start + self.starttime,
'stop_time' : stop + self.starttime,
{'start_time' : start + self.data_tmp.start_time,
'stop_time' : stop + self.data_tmp.start_time,
'amplitude' : amp,
'frequency' : freq,
'phase_offset' : phase_offset})
......@@ -185,22 +202,17 @@ class segment_single():
'''
new_segment = segment_single()
if type(other) is segment_single:
if len(other.my_pulse_data) == 1:
new_segment.my_pulse_data = copy.copy(self.my_pulse_data)
elif len(self.my_pulse_data) == 1:
new_segment.my_pulse_data = copy.copy(other.my_pulse_data)
else:
new_segment.my_pulse_data = self._add_up_pulse_data(other.my_pulse_data)
sin_data = copy.copy(self.sin_data)
sin_data.extend(other.sin_data)
new_segment.sin_data = sin_data
elif type(other) == int or type(other) == float:
new_pulse = copy.copy(self.my_pulse_data)
new_pulse[:,1] += other
new_segment.my_pulse_data = new_pulse
new_segment.sin_data = self.sin_data
shape1 = self.data.shape
shape2 = other.data.shape
new_shape = get_union_of_shapes(shape1, shape2)
other.data = update_dimension(other.data, new_shape)
self.data= update_dimension(self.data, new_shape)
new_segment.data = copy.copy(self.data)
new_segment.data += other.data
elif type(other) == int or type(other) == float:
new_segment.data = copy.copy(self.data)
new_segment.data += other
else:
raise TypeError("Please add up segment_single type or a number ")
......@@ -214,23 +226,22 @@ class segment_single():
muliplication operator for segment_single
'''
new_segment = segment_single()
if type(other) is segment_single:
raise NotImplemented
elif type(other) == int or type(other) == float or type(other) == np.float64:
new_pulse = copy.copy(self.my_pulse_data)
new_pulse[:,1] *= other
new_segment.my_pulse_data = new_pulse
sin_data = []
for i in self.sin_data:
my_sin = copy.copy(i)
my_sin['amplitude'] *=other
sin_data.append(my_sin)
new_segment.sin_data = sin_data
shape1 = self.data.shape
shape2 = other.data.shape
new_shape = get_union_of_shapes(shape1, shape2)
other.data = update_dimension(other.data, new_shape)
self.data= update_dimension(self.data, new_shape)
new_segment.data = copy.copy(self.data)
new_segment.data *= other.data
elif type(other) == int or type(other) == float:
new_segment.data = copy.copy(self.data)
new_segment.data *= other
else:
raise TypeError("Please add up segment_single type or a number ")
return new_segment
def __truediv__(self, other):
......@@ -324,9 +335,13 @@ class segment_single():
# seg = segment_single()
# seg.add_block(0,linspace(2,20,18, axis=1),2)
# seg.wait(20)
# seg.reset_time()
# seg.add_sin(0,20,1,1e9,0)
# seg.repeat(5)
# # seg.repeat(5)
# print(seg.data.shape)
# print(seg.data[0,0].my_pulse_data)
# print(seg.data[0,0].my_pulse_data.T)
# # print(seg.data[0,0].sin_data)
# seg*=2
# print(seg.data[0,0].sin_data)
\ No newline at end of file
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