Added loads of units in nearly all graphs.
Overhauled fig_invariance_full.pdf. Added some legends, somewhere.
This commit is contained in:
@@ -2,7 +2,7 @@ import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from thunderhopper.filetools import search_files
|
||||
from thunderhopper.modeltools import load_data, save_data
|
||||
from misc_functions import shorten_species, sort_files_by_rec
|
||||
from misc_functions import shorten_species, sort_files_by_rec, divide_by_zero
|
||||
from IPython import embed
|
||||
|
||||
# GENERAL SETTINGS:
|
||||
@@ -41,7 +41,7 @@ suffix = dict(
|
||||
base='_norm-base',
|
||||
range='_norm-range'
|
||||
)[normalization]
|
||||
plot_overview = True
|
||||
plot_overview = False
|
||||
|
||||
# PREPARATION:
|
||||
if plot_overview:
|
||||
@@ -59,7 +59,7 @@ for i, species in enumerate(target_species):
|
||||
|
||||
# Fetch all species-specific song files:
|
||||
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)
|
||||
|
||||
@@ -82,18 +82,22 @@ for i, species in enumerate(target_species):
|
||||
# Log song file data:
|
||||
if normalization == 'min':
|
||||
# Minimum normalization:
|
||||
measure /= measure.min(axis=0, keepdims=True)
|
||||
measure = divide_by_zero(measure, measure.min(axis=0, keepdims=True))
|
||||
# measure /= measure.min(axis=0, keepdims=True)
|
||||
elif normalization == 'max':
|
||||
# Maximum normalization:
|
||||
measure /= measure.max(axis=0, keepdims=True)
|
||||
measure = divide_by_zero(measure, measure.max(axis=0, keepdims=True))
|
||||
# measure /= measure.max(axis=0, keepdims=True)
|
||||
elif normalization == 'base':
|
||||
# Noise baseline normalization:
|
||||
measure /= measure[0]
|
||||
measure = divide_by_zero(measure, measure[0])
|
||||
# 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)
|
||||
measure = divide_by_zero(measure - min_measure, max_measure - min_measure)
|
||||
# measure = (measure - min_measure) / (max_measure - min_measure)
|
||||
|
||||
file_data[:, k] = measure
|
||||
|
||||
@@ -101,8 +105,8 @@ for i, species in enumerate(target_species):
|
||||
axes[0, i].plot(scales, measure, c='k', alpha=0.5)
|
||||
|
||||
# Get recording statistics:
|
||||
rec_mean[:, j] = file_data.mean(axis=1)
|
||||
rec_sd[:, j] = file_data.std(axis=1)
|
||||
rec_mean[:, j] = np.nanmean(file_data, axis=1)
|
||||
rec_sd[:, j] = np.nanstd(file_data, axis=1)
|
||||
|
||||
if plot_overview:
|
||||
axes[1, i].plot(scales, rec_mean[:, j], c='k')
|
||||
|
||||
Reference in New Issue
Block a user