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

update

parent dd20f89f
No related branches found
No related tags found
1 merge request!1Iq envelopes
......@@ -10,6 +10,10 @@ pulse_lib.egg-info/SOURCES.txt
pulse_lib.egg-info/dependency_links.txt
pulse_lib.egg-info/requires.txt
pulse_lib.egg-info/top_level.txt
pulse_lib/keysight/uploader_core/keysight_awg_post_processing_and_upload.cpp
pulse_lib/keysight/uploader_core/mem_ctrl.cpp
pulse_lib/keysight/uploader_core/uploader.cpp
pulse_lib/segments/utility/segments_c_func.c
pulse_lib/keysight/__init__.py
pulse_lib/keysight/uploader.py
pulse_lib/keysight/uploader_core/__init__.py
......
......@@ -218,10 +218,10 @@ class keysight_uploader():
job.waveform_cache = waveform_cache
if job.prescaler == 0:
job.playback_time = waveform_cache.npt
else:
elif job.prescaler == 1:
job.playback_time = waveform_cache.npt*5*job.prescaler
print(waveform_cache.npt)
print(job.playback_time)
else:
job.playback_time = waveform_cache.npt*5*job.prescaler*2
# 3)
if job.HVI is not None:
......
......@@ -18,7 +18,7 @@ class pulse_data(parent_data):
self.baseband_pulse_data = np.zeros([1,2], dtype=np.double)
self.MW_pulse_data = list()
self.start = 0
self.start_time = 0
def add_pulse_data(self, input):
self.baseband_pulse_data = self._add_up_pulse_data(input)
......@@ -44,15 +44,21 @@ class pulse_data(parent_data):
return self.baseband_pulse_data[-1,0]
def reset_time(self, time = None):
def reset_time(self, time, extend_only = False):
'''
Preform a reset time on the current segment.
Args:
time (float) : time where you want the reset. Of None, the totaltime of the segment will be taken.
extend_only (bool) : will just extend the time in the segment and not reset it if set to true [do not use when composing wavoforms...].
'''
if time is not None:
pulse = np.asarray([[0, 0],[time, 0]], dtype=np.double)
self.add_pulse_data(pulse)
if time is None:
time = self.total_time
pulse = np.asarray([[0, 0],[time, 0]], dtype=np.double)
self.add_pulse_data(pulse)
if extend_only == False:
self.start_time = time
def wait(self, time):
"""
......@@ -65,7 +71,7 @@ class pulse_data(parent_data):
pulse = np.asarray([[0, 0],[wait_time, 0]])
self.add_pulse_data(pulse)
def append(self, other, time):
def append(self, other, time = None):
'''
Append two segments to each other, where the other segment is places after the first segment. Time is the total time of the first segment.
Args:
......@@ -74,6 +80,8 @@ class pulse_data(parent_data):
** what to do with start time argument?
'''
if time is None:
time = self.total_time
self.slice_time(0, time)
......@@ -304,7 +312,7 @@ class pulse_data(parent_data):
my_copy = pulse_data()
my_copy.baseband_pulse_data = copy.copy(self.baseband_pulse_data)
my_copy.MW_pulse_data = copy.copy(self.MW_pulse_data)
my_copy.start = copy.copy(self.start)
my_copy.start_time = copy.copy(self.start_time)
return my_copy
def __add__(self, other):
......
......@@ -136,5 +136,5 @@ if __name__ == '__main__':
s1.add_MW_pulse(0,1000,1,1e7,0, "flattop")
s1.reset_time()
s1.add_chirp(1500,2500,1e6,1e7,1)
s1.plot_segment(sample_rate = 1e9)
s1.plot_segment(sample_rate = 1e10)
plt.show()
\ No newline at end of file
......@@ -103,13 +103,14 @@ class segment_base():
@last_edited
@loop_controller
def reset_time(self, time=None):
def reset_time(self, time=None, extend_only = False):
'''
resets the time back to zero after a certain point
Args:
time (double) : (optional), after time to reset back to 0. Note that this is absolute time and not rescaled time.
extend_only (bool) : will just extend the time in the segment and not reset it if set to true [do not use when composing wavoforms...].
'''
self.data_tmp.reset_time(time)
self.data_tmp.reset_time(time, extend_only)
@last_edited
@loop_controller
......@@ -406,9 +407,12 @@ class segment_base():
pulse_data_curr_seg = self.data.flat[flat_index]
y = pulse_data_curr_seg.render(0, 0, sample_rate)
x = np.linspace(0, pulse_data_curr_seg.total_time*sample_time_step-sample_time_step, len(y))*1e9
x = np.linspace(0, pulse_data_curr_seg.total_time, len(y))
plt.plot(x,y, label=self.name)
plt.xlabel("time (ns)")
plt.ylabel("amplitude (mV)")
plt.legend()
# plt.show()
......@@ -116,7 +116,7 @@ class segment_pulse(segment_base):
Args:
wait (double) : time in ns to wait
'''
amp_0 = self.data_tmp.my_pulse_data[-1,1]
amp_0 = self.data_tmp.baseband_pulse_data[-1,1]
t0 = self.data_tmp.total_time
pulse = np.asarray([[t0, 0],[wait+t0, 0]], dtype=np.double)
......@@ -150,6 +150,12 @@ if __name__ == '__main__':
s = segment_pulse("test")
from pulse_lib.segments.utility.looping import linspace
s.add_block(0, 10, linspace(2,10,50, unit=("ee")))
s.add_block(0, 10, 50)
s.reset_time()
s.add_block(20, 30, 50)
s.wait(10)
s.plot_segment()
plt.show()
# print(s.loops)
# print(s.units)
\ 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