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:
@@ -26,7 +26,21 @@ search_path = '../data/inv/thresh_lp/'
|
||||
save_path = '../data/inv/thresh_lp/condensed/'
|
||||
|
||||
# ANALYSIS SETTINGS:
|
||||
with_noise = False
|
||||
mode = ['pure', 'noise'][1]
|
||||
normalization = [
|
||||
'none',
|
||||
'min',
|
||||
'max',
|
||||
'base',
|
||||
'range',
|
||||
][0]
|
||||
suffix = dict(
|
||||
none='_unnormed',
|
||||
min='_norm-min',
|
||||
max='_norm-max',
|
||||
base='_norm-base',
|
||||
range='_norm-range'
|
||||
)[normalization]
|
||||
plot_overview = False
|
||||
thresh_rel = np.array([0.5, 1, 3])
|
||||
|
||||
@@ -53,8 +67,7 @@ for i, species in enumerate(target_species):
|
||||
all_axes[thresh][0, i].set_title(shorten_species(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)
|
||||
all_paths = search_files(species, incl=mode, ext='npz', dir=search_path)
|
||||
|
||||
# Sort song files by recording (one or more per source):
|
||||
sorted_paths = sort_files_by_rec(all_paths, sources)
|
||||
@@ -78,6 +91,21 @@ for i, species in enumerate(target_species):
|
||||
rec_sd = np.zeros(shape, dtype=float)
|
||||
|
||||
# Log song file data:
|
||||
if normalization == 'min':
|
||||
# Minimum normalization:
|
||||
measure /= measure.min(axis=0, keepdims=True)
|
||||
elif normalization == 'max':
|
||||
# Maximum normalization:
|
||||
measure /= measure.max(axis=0, keepdims=True)
|
||||
elif normalization == 'base':
|
||||
# Noise baseline normalization:
|
||||
measure /= measure[0]
|
||||
elif normalization == 'range':
|
||||
# Min-max normalization:
|
||||
min_measure = measure.min(axis=0, keepdims=True)
|
||||
max_measure = measure.max(axis=0, keepdims=True)
|
||||
measure = (measure - min_measure) / (max_measure - min_measure)
|
||||
|
||||
file_data[..., k] = measure
|
||||
|
||||
if plot_overview:
|
||||
@@ -100,11 +128,7 @@ for i, species in enumerate(target_species):
|
||||
axes[1, i].fill_between(scales, *spread, color=c, alpha=0.2)
|
||||
|
||||
# Save condensed recording data:
|
||||
save_name = save_path + species
|
||||
if with_noise:
|
||||
save_name += '_noise'
|
||||
else:
|
||||
save_name += '_pure'
|
||||
save_name = save_path + species + '_' + mode + suffix
|
||||
archive = dict(
|
||||
scales=scales,
|
||||
mean_feat=rec_mean,
|
||||
|
||||
Reference in New Issue
Block a user