diff --git a/pulse_lib/segments/segment_HVI_variables.py b/pulse_lib/segments/segment_HVI_variables.py index ba5753f1201ce8805c2eb4446ae92d9002966d72..991a411cab1d3a778e0070303ea6c3e98f2ba49b 100644 --- a/pulse_lib/segments/segment_HVI_variables.py +++ b/pulse_lib/segments/segment_HVI_variables.py @@ -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): ''' diff --git a/pulse_lib/segments/segment_acquisition.py b/pulse_lib/segments/segment_acquisition.py index e1d053054c87e69731273b8ed3cc17e3ae072afd..cb87087a9cb5e1f027c1f45fb282f34e2765a850 100644 --- a/pulse_lib/segments/segment_acquisition.py +++ b/pulse_lib/segments/segment_acquisition.py @@ -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): diff --git a/pulse_lib/segments/segment_base.py b/pulse_lib/segments/segment_base.py index 5728ab60b4f05c81b944594d37023b432e4722a9..86f8ced59a2d5e8bae4b725347777448d7e52fee 100644 --- a/pulse_lib/segments/segment_base.py +++ b/pulse_lib/segments/segment_base.py @@ -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