def example(self): x = self.generate(1).detach().cpu() x = np.array(x) x = iflatten_complex_data(x) x = ifft_data(x)[0] return x
def play_rnn_OLA(model, path, n, win, format='rov', args=None, translation=True, lpf=True): net = model(*args) net.load_state_dict(torch.load(path)) x = net.generate(1, n).detach().squeeze().numpy() x = iflatten_complex_data_with(x, 31) x = pad_data_zeros(x, get_single_side_frequency().shape[0]) x = ifft_data(x) x = iwindow(x, win + 0.001, 0.9) x = istandardize_data(x) x = overlap_and_add_data(x) if lpf: x = low_pass_filter(x) write_one_file('example', x, format=format) cmd = CMD + PAR1 + 'example' + PAR2 if translation: cmd += TRANSLATION os.system(cmd) return x
def example(self): # Generate an example with numpy array data type x = self.generate(1).detach().cpu() x = np.array(x) x = iflatten_complex_data(x) x = ifft_data(x)[0] return x
def example(self): # Generate an example with numpy array data type x = self.generate(1).detach().cpu() x = np.array(x) x = istandardize_data_with(x, self.mean, self.std) x = iflatten_complex_data(x) x = ifft_data(x)[0] return x
def example(self): # Generate an example with numpy array data type global win x = self.generate(1).detach().cpu() x = np.array(x) x = iflatten_complex_data(x) x = ifft_data(x) # x = iwindow(x, win, 0.6)[0] return x
def example(self): # Generate an example with numpy array data type x = self.generate(1).detach().cpu() x = np.array(x) x = iflatten_complex_data_with(x, 16) x = pad_data_zeros(x, get_single_side_frequency().shape[0]) x = ifft_data(x) # x = iwindow(x, WIN, 0.8) return x[0]
def example(self, r): # Generate an example with numpy array data type global dim x = self.generate(1, r).detach().cpu() x = x.squeeze().unsqueeze(0) x = np.array(x) x = iflatten_complex_data_with(x, 31) x = pad_data_zeros(x, get_single_side_frequency().shape[0]) x = ifft_data(x) # x = iwindow(x, WIN, 0.8) return x[0]
def example(self): r = get_random_example(1, config.TRIM_LENGTH) e = fft_data(r) e = flatten_complex_data(e) if self.in_cpu: e = torch.tensor(e) else: e = torch.tensor(e, device=self.device, dtype=torch.float32) e = self.forward(e).detach().cpu() e = np.array(e) e = iflatten_complex_data(e) e = ifft_data(e)[0] r = np.array(r[0]) return e - r
# %% samples = sample_net(WGAN, 6) # %% draw_frequency_analysis(samples) # %% draw_frequency_analysis_lpf(samples) # %% lpf_compare(samples) # %% origin = get_random_example(6, 300) originf = fft_data(origin) yf, _ = lpf_dimension_reduction(originf, 5) yf = pad_data_zeros(yf, 151) y = ifft_data(yf) # %% draw_frequency_analysis(origin) # %% draw_frequency_analysis(y) # %% compare(origin, y) # %% originw, win = window(origin, 'hamming') originfw = fft_data(originw) yfw, _ = lpf_dimension_reduction(originfw, 5) yfw = pad_data_zeros(yfw, 151) yw = ifft_data(yfw) yw = iwindow(yw, win, 0.7) # %% draw_frequency_analysis(origin)
from data_reader import get_trajectory from data_processor import trim_data from scipy.fft import fft, fftfreq, ifft # %% data = get_trajectory('Adam') data = trim_data(data, 300) # %% data[0] # %% data_f = fft_data(data) # %% data_f[0].shape # %% idata = ifft_data(data_f) # %% idata[0] # %% data[0] - idata[0] # %% x = data[0].iloc[:, 0] # %% x # %% fx = fft(np.array(x)) # %% x # %% pfx = fx[:151] pfx.shape