k_ratios_test_low = 1.2 k_ratios_test_high = 3.8 diff_coef_ratios_test_low = 4.2 diff_coef_ratios_test_high = 6.8 # simulate two beads print("simulating data for training") for n_data in n_datas: file_name_data = siu.sim_two_beads(data_len, k_ratios=k_ratios, diff_coef_ratios=diff_coef_ratios, dt=dt, n_data=n_data, n_steps_initial=10000, save_file=True, root_dir=root_dir) file_names_data.append(file_name_data) for avg_len in avg_lens: for n_filter_octave in n_filter_octaves: try: print("scat transforming n_data:{} with parameters avg_len:{}, n_filter_octave:{}".format(n_data, avg_len, n_filter_octave)) file_name_scat = scu.scat_transform(file_name_data, avg_len, log_transform=False, n_filter_octave=n_filter_octave, save_file=True, root_dir=root_dir) file_names_scat.append(file_name_scat) except: print("exception occurred during scat transformation for n_data:{} with parameters avg_len:{}, n_filter_octave:{}".format(n_data, avg_len, n_filter_octave)) # simulate data for testing performance print("simulating data for evaluation for randomly sampled labels") k_ratios_test = (k_ratios_test_high - k_ratios_test_low) * np.random.random(n_data_test,) + k_ratios_test_low diff_coef_ratios_test = (diff_coef_ratios_test_high - diff_coef_ratios_test_low) * np.random.random(n_data_test,) + diff_coef_ratios_test_low k_ratios_diff_coef_ratios_test = np.stack([k_ratios_test, diff_coef_ratios_test], axis=1) data_tests = [] for k_ratio_test, diff_coef_ratio_test in k_ratios_diff_coef_ratios_test: data_test = siu.sim_two_beads(data_len, k_ratios=k_ratio_test, diff_coef_ratios=diff_coef_ratio_test, dt=dt, n_data=1, n_steps_initial=10000, save_file=False) data_tests.append(data_test) processes = np.concatenate(data_tests, axis=2) # shaped (1, 1, n_data_test, n_channels, data_len)
} torch.save(samples_train, os.path.join(root_dir, 'obd_exp_0.pt')) torch.save(samples_test, os.path.join(root_dir, 'obd_exp_1.pt')) # create scat transformed versions for avg_len in avg_lens: for n_filter_octave in n_filter_octaves: try: print( "scat transforming data_len:{} with parameters avg_len:{}, n_filter_octave:{}" .format(data_len, avg_len, n_filter_octave)) file_name_scat = scu.scat_transform( 'obd_exp_0.pt', avg_len, log_transform=False, n_filter_octave=n_filter_octave, save_file=True, root_dir=root_dir) file_name_test_scat = scu.scat_transform( 'obd_exp_1.pt', avg_len, log_transform=False, n_filter_octave=n_filter_octave, save_file=True, root_dir=root_dir) file_names_scat.append(file_name_scat) except: print( "exception occurred during scat transformation for data_len:{} with parameters avg_len:{}, n_filter_octave:{}" .format(data_len, avg_len, n_filter_octave))