Skip to content
Snippets Groups Projects
Commit 59d55f5c authored by Sander Snoo's avatar Sander Snoo
Browse files

Improved copying of segment slice

parent 2aa038b9
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ class segment_HVI_variables(segment_base):
marker_voltage (double) : voltage in mV to output when the marker is on (default is 1V),
"""
super(segment_HVI_variables, self).__init__(name, marker_HVI_variable(), segment_type = 'render')
self._data_hvi_variable = self.data
self._data_hvi_variable = None
@last_edited
@loop_controller
......@@ -36,7 +36,7 @@ class segment_HVI_variables(segment_base):
return self.data_tmp
# TODO: Remove global information from segment.
# The global time shift should be kept local to the sequence rendering function.
# The global time shift should be kept local to the sequence rendering function.
@loop_controller_post_processing
def _add_global_time_shift(self, time):
'''
......
......@@ -136,13 +136,15 @@ class segment_acquisition():
# Put it in a data_container to maintain pulse_lib structure.
data_item = data_container(data_item)
# To avoid unnecessary copying of data we first slice on self, copy, and then restore data in self.
# To avoid unnecessary copying of data we first slice data of self, set self.data = None,
# copy, and then restore data in self.
# This trick makes the indexing operation orders faster.
data_org = self.data
self.data = data_item
self.data = None
item = copy.copy(self)
item.data = data_item # TODO [SdS]: make clean solution
self.data = data_org
item.data = data_item
return item
def append(self, other, time = None):
......
......@@ -173,13 +173,19 @@ class segment_base():
# Put it in a data_container to maintain pulse_lib structure.
data_item = data_container(data_item)
# To avoid unnecessary copying of data we first slice on self, copy, and then restore data in self.
# To avoid unnecessary copying of data we first slice data, set self.data=None, copy, and then restore data in self.
# This trick makes the indexing operation orders faster.
data_org = self.data
self.data = data_item
self.data = None
item = copy.copy(self)
item.data = data_item # TODO [SdS]: make clean solution
self.data = data_org
item.data = data_item
if self._data_hvi_variable is not None:
if self._data_hvi_variable is not self.data:
item._data_hvi_variable = item._data_hvi_variable[key[0]]
else:
item._data_hvi_variable = item.data
return item
@last_edited
......
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