Added multi-thresh simulation to "full" and "short" (currently running).
Added complete "rect-lp" analysis except figure. Added multiple appendix figs. Overhauled normalization options across all condense scripts. Co-authored-by: Copilot <copilot@github.com>
This commit is contained in:
51
python/collect_inv_data_rect-lp.py
Normal file
51
python/collect_inv_data_rect-lp.py
Normal file
@@ -0,0 +1,51 @@
|
||||
import numpy as np
|
||||
from thunderhopper.filetools import search_files
|
||||
from thunderhopper.modeltools import load_data, save_data
|
||||
from IPython import embed
|
||||
|
||||
# GENERAL SETTINGS:
|
||||
mode = ['pure', 'noise'][1]
|
||||
target_species = [
|
||||
'Chorthippus_biguttulus',
|
||||
'Chorthippus_mollis',
|
||||
'Chrysochraon_dispar',
|
||||
'Euchorthippus_declivus',
|
||||
'Gomphocerippus_rufus',
|
||||
'Omocestus_rufipes',
|
||||
'Pseudochorthippus_parallelus',
|
||||
]
|
||||
stages = ['filt', 'env']
|
||||
search_path = '../data/inv/rect_lp/'
|
||||
save_path = '../data/inv/rect_lp/collected/'
|
||||
|
||||
# EXECUTION:
|
||||
for i, species in enumerate(target_species):
|
||||
print(f'Processing {species}')
|
||||
|
||||
# Fetch all species-specific song files:
|
||||
all_paths = search_files(species, incl=mode, 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')
|
||||
|
||||
if j == 0:
|
||||
# Prepare species-specific storage:
|
||||
species_data = dict(scales=data['scales'])
|
||||
for stage in stages:
|
||||
mkey = f'measure_{stage}'
|
||||
shape = data[mkey].shape + (len(all_paths),)
|
||||
species_data[mkey] = np.zeros(shape, dtype=float)
|
||||
|
||||
# Log species data:
|
||||
for stage in stages:
|
||||
mkey = f'measure_{stage}'
|
||||
species_data[mkey][..., j] = data[mkey]
|
||||
|
||||
# Save collected file data:
|
||||
save_name = save_path + species + '_' + mode
|
||||
save_data(save_name, species_data, config, overwrite=True)
|
||||
|
||||
print('Done.')
|
||||
Reference in New Issue
Block a user