def correct_length_of_all_items(self): """ correct length of all items in library """ if self.need_correct_length: if not is_power_of_2(self.max_length) and self.length_is_power_of_2: self.max_length = 2 ** next_power_of_2(self.max_length) for i in self.items: i.correct_length(self.max_length) self.need_correct_length = False
def fft_diff_len(x): """ Fast Fourier transform for different lists which can have length not power of 2 function correct length and if all ok run fft @param x: list of data @return: list with fft """ if is_power_of_2(len(x)): return FFT.fft(x) else: return FFT.fft_diff_len(correct_len(x, is_pow_of_2=True))