Seriously, no idea. Wild amount of changes. Good luck.

This commit is contained in:
j-hartling
2026-04-17 17:19:30 +02:00
parent 36ac504efa
commit 3b4b7f2161
40 changed files with 2067 additions and 672 deletions

View File

@@ -2,6 +2,7 @@ import numpy as np
from thunderhopper.modeltools import load_data, save_data
from thunderhopper.filetools import search_files, crop_paths
from thunderhopper.filters import decibel, sosfilter
from misc_functions import draw_noise_segment
from IPython import embed
# GENERAL SETTINGS:
@@ -12,17 +13,18 @@ noise_path = '../data/processed/white_noise_sd-1.npz'
save_path = '../data/inv/log_hp/'
# ANALYSIS SETTINGS:
add_noise = search_target == '*' or False
save_detailed = search_target == example_file
add_noise = search_target == '*'
example_scales = np.array([0.1, 1, 10, 30, 100, 300])
scales = np.geomspace(0.01, 10000, 1000)
scales = np.unique(np.concatenate((scales, example_scales)))
scales = np.unique(np.concatenate(([0], scales, example_scales)))
# PREPARATION:
pure_noise = np.load(noise_path)['filt']
if add_noise:
pure_noise = np.load(noise_path)['filt']
# EXECUTION:
for data_path, name in zip(data_paths, crop_paths(data_paths)):
save_detailed = example_file in name
print(f'Processing {name}')
# Get filtered song (prior to envelope extraction):
@@ -38,7 +40,7 @@ for data_path, name in zip(data_paths, crop_paths(data_paths)):
song /= song[segment].std()
if add_noise:
# Get normalized noise component:
noise = pure_noise[:song.shape[0]]
noise = draw_noise_segment(pure_noise, song.shape[0])
noise /= noise[segment].std()
# Prepare storage:
@@ -93,10 +95,12 @@ for data_path, name in zip(data_paths, crop_paths(data_paths)):
snip_log=snip_log,
snip_inv=snip_inv,
)
file_name = save_path + name
save_name = save_path + name
if add_noise:
file_name += '_noise'
save_data(file_name, archive, config, overwrite=True)
save_name += '_noise'
else:
save_name += '_pure'
save_data(save_name, archive, config, overwrite=True)
print('Done.')
embed()