def extract_specific_interval(self, interval_start, interval_end):
interval_start = int(interval_start)<EOL>interval_end = int(interval_end)<EOL>if interval_start >= interval_end:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT>elif interval_start > self.time_series.size:<EOL><INDENT>if self.repeat:<EOL><INDENT>interval_end = interval_end - interval_start<EOL>interval_start = <NUM_LIT:0><EOL><DEDENT>else:<EOL><INDENT>raise ValueError("<STR_LIT>")<EOL><DEDENT><DEDENT>if interval_end < self.time_series.size:<EOL><INDENT>interval = self.time_series[interval_start:interval_end]<EOL><DEDENT>else:<EOL><INDENT>requested_interval_size = interval_end - interval_start<EOL>remaining_signal = self.time_series[interval_start:self.time_series.size]<EOL>if self.repeat:<EOL><INDENT>if requested_interval_size < self.time_series.size:<EOL><INDENT>self._next_interval_start = requested_interval_size-remaining_signal.size<EOL>interval = np.hstack((remaining_signal, self.time_series[<NUM_LIT:0>:self._next_interval_start]))<EOL><DEDENT>else:<EOL><INDENT>repeated_signal = np.repeat(self.time_series, np.floor(requested_interval_size/self.time_series.size))<EOL>self._next_interval_start = requested_interval_size % self.time_series.size<EOL>interval = (np.hstack((remaining_signal, repeated_signal)))[<NUM_LIT:0>:requested_interval_size]<EOL><DEDENT><DEDENT>else:<EOL><INDENT>self.warning("<STR_LIT>")<EOL>self._next_interval_start = self.time_series.size + <NUM_LIT:1><EOL>samples_per_interval = self.interval_length*self.sample_rate<EOL>interval = np.hstack((remaining_signal, np.zeros(samples_per_interval-remaining_signal.size)))<EOL><DEDENT><DEDENT>return interval<EOL>
Overload if special behaviour is required when a series ends.