Holiday syncing :)

This commit is contained in:
j-hartling
2026-04-02 16:00:56 +02:00
parent 298969a067
commit 0b9264b1e1
14 changed files with 627 additions and 667 deletions

View File

@@ -8,13 +8,13 @@ from thunderhopper.model import convolve_kernels
from IPython import embed
# GENERAL SETTINGS:
target = ['Omocestus_rufipes', '*'][1]
target = ['Omocestus_rufipes', '*'][0]
data_paths = search_files(target, excl='noise', dir='../data/processed/')
noise_path = '../data/processed/white_noise_sd-1.npz'
save_path = '../data/inv/thresh_lp/'
# ANALYSIS SETTINGS:
add_noise = True
add_noise = False
save_snippets = add_noise and (target == 'Omocestus_rufipes')
plot_results = False
example_scales = np.array([0, 1, 10, 30, 100])
@@ -62,8 +62,8 @@ for data_path, name in zip(data_paths, crop_paths(data_paths)):
thresh_abs = ref_conv[segment, :].std(axis=0, keepdims=True) * thresh_rel[:, None]
# Prepare measure storage:
shape = (scales.size, kern_specs.shape[0], thresh_rel.size)
measure_feat = np.zeros(shape, dtype=float)
measure_inv = np.zeros((scales.size,), dtype=float)
measure_feat = np.zeros((scales.size, kern_specs.shape[0], thresh_rel.size), dtype=float)
if save_snippets:
# Prepare snippet storage:
snip_inv = np.zeros((song.size, example_scales.size), dtype=float)
@@ -81,6 +81,9 @@ for data_path, name in zip(data_paths, crop_paths(data_paths)):
if add_noise:
# Add noise:
scaled_song += noise
# Log input intensity measure:
measure_inv[i] = scaled_song[segment].std()
# Process mixture:
scaled_conv = convolve_kernels(scaled_song, config['kernels'], config['k_specs'])
@@ -130,6 +133,7 @@ for data_path, name in zip(data_paths, crop_paths(data_paths)):
data = dict(
scales=scales,
example_scales=example_scales,
measure_inv=measure_inv,
measure_feat=measure_feat,
thresh_rel=thresh_rel,
thresh_abs=thresh_abs,