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

@@ -0,0 +1,52 @@
import numpy as np
from thunderhopper.filetools import search_files
from thunderhopper.modeltools import load_data, save_data
from IPython import embed
# GENERAL SETTINGS:
target_species = [
'Chorthippus_biguttulus',
'Chorthippus_mollis',
'Chrysochraon_dispar',
'Euchorthippus_declivus',
'Gomphocerippus_rufus',
'Omocestus_rufipes',
'Pseudochorthippus_parallelus',
]
search_path = '../data/inv/thresh_lp/'
save_path = '../data/inv/thresh_lp/collected/'
# ANALYSIS SETTINGS:
with_noise = False
# EXECUTION:
for i, species in enumerate(target_species):
print(f'Processing {species}')
# Fetch all species-specific song files:
incl = 'noise' if with_noise else 'pure'
all_paths = search_files(species, incl=incl, ext='npz', dir=search_path)
# Run through files:
for j, path in enumerate(all_paths):
# Load invariance data:
data, config = load_data(path, ['scales', 'measure_feat', 'thresh_rel'])
measure = data['measure_feat']
if j == 0:
# Prepare species-specific storage:
spec_data = np.zeros((measure.shape + (len(all_paths),)), dtype=float)
# Log file data:
spec_data[..., j] = measure
# Save collected file data:
save_name = save_path + species + f'_{incl}'
archive = dict(
scales=data['scales'],
measure_feat=spec_data,
thresh_rel=data['thresh_rel'])
save_data(save_name, archive, config)
print('Done.')