def reset_time(self, extend_only=False): ''' Args: 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...]. Allings all segments togeter and sets the input time to 0, e.g. , chan1 : waveform until 70 ns chan2 : waveform until 140ns -> totaltime will be 140 ns, when you now as a new pulse (e.g. at time 0, it will actually occur at 140 ns in both blocks) ''' n_channels = len(self.channels) shape = list(self.shape) time_data = np.empty([n_channels] + shape) for i in range(len(self.channels)): time_data[i] = upconvert_dimension( getattr(self, self.channels[i]).total_time, shape) times = np.amax(time_data, axis=0) times, axis = reduce_arr(times) if len(axis) == 0: loop_obj = times else: loop_obj = lp.loop_obj(no_setpoints=True) loop_obj.add_data(times, axis) for i in self.channels: segment = getattr(self, i) segment.reset_time(loop_obj, False)
def reset_time(self, extend_only=False): ''' Args: 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...]. Allings all segments togeter and sets the input time to 0, e.g. , chan1 : waveform until 70 ns chan2 : waveform until 140ns -> totaltime will be 140 ns, when you now as a new pulse (e.g. at time 0, it will actually occur at 140 ns in both blocks) ''' n_branches = len(self.branches) n_channels = len(self.branches[0].channels) shape = list(self.shape) time_data = np.empty([n_branches * n_channels] + shape) for ibranch, branch in enumerate(self.branches): for ich, ch in enumerate(branch.channels): time_data[ibranch * n_channels + ich] = upconvert_dimension( branch[ch].total_time, shape) times = np.amax(time_data, axis=0) times, axis = reduce_arr(times) logging.info(f'times {times}') if len(axis) == 0: loop_obj = times else: loop_obj = lp.loop_obj(no_setpoints=True) loop_obj.add_data(times, axis) for branch in self.branches: for ch in branch.channels: branch[ch].reset_time(loop_obj, False)
def total_time(self): shape = list(self.shape) n_branches = len(self.branches) time_data = np.empty([n_branches] + shape) for i, branch in enumerate(self.branches): time_data[i] = upconvert_dimension(branch.total_time, shape) times = np.amax(time_data, axis=0) return times
def _start_time(self): ''' get the total time that will be uploaded for this segment to the AWG Returns: times (np.ndarray) : numpy array with the total time (maximum of all the channels), for all the different loops executed. ''' shape = list(self.shape) n_channels = len(self.channels) time_data = np.empty([n_channels] + shape) for i in range(len(self.channels)): time_data[i] = upconvert_dimension( getattr(self, self.channels[i]).start_time, shape) times = np.amax(time_data, axis=0) return times
def total_time(self): ''' get the total time that will be uploaded for this segment to the AWG Returns: times (np.ndarray) : numpy array with the total time (maximum of all the channels), for all the different loops executed. ''' if self.render_mode and self._total_times is not None: return self._total_times shape = list(self.shape) n_channels = len(self.channels) time_data = np.empty([n_channels] + shape) for i, channel in enumerate(self.channels): time_data[i] = upconvert_dimension(self[channel].total_time, shape) times = np.amax(time_data, axis=0) if self.render_mode: self._total_times = times return times