Again, numerous changes.

Mostly figure polishing and fixing.
Crucial fix to "short" invariance analysis.
This commit is contained in:
j-hartling
2026-04-21 17:49:30 +02:00
parent 3b4b7f2161
commit 1a586848e8
41 changed files with 1392 additions and 242 deletions

View File

@@ -165,7 +165,7 @@ target_species = [
'Chorthippus_biguttulus',
'Chorthippus_mollis',
'Chrysochraon_dispar',
'Euchorthippus_declivus',
# 'Euchorthippus_declivus',
'Gomphocerippus_rufus',
'Omocestus_rufipes',
'Pseudochorthippus_parallelus',
@@ -185,7 +185,7 @@ load_kwargs = dict(
)
save_path = '../figures/fig_invariance_thresh_lp_species.pdf'
exclude_zero = True
show_floor = False
show_floor = True
# SUBSET SETTINGS:
thresh_rel = np.array([0.5, 1, 3])[0]
@@ -267,14 +267,15 @@ fs = dict(
bar=16,
)
species_colors = load_colors('../data/species_colors.npz')
kernel_shades = [0, 0.75]
kernel_shades = [0, 0.5]
scale_shades = [1, 0]
noise_colors = [(0.5, 0.5, 0.5), (0.7, 0.7, 0.7)]
lw = dict(
song=0.5,
feat=3,
kern=2.5,
plateau=3,
bar=3,
plateau=1.5,
)
space_kwargs = dict(
s=30,
@@ -411,6 +412,17 @@ plateau_settings = dict(
last=True,
condense='norm',
)
plateau_line_kwargs = dict(
lw=lw['plateau'],
ls='--',
zorder=1,
)
plateau_dot_kwargs = dict(
marker='o',
markersize=8,
markeredgewidth=1,
clip_on=False,
)
# EXECUTION:
@@ -566,6 +578,28 @@ for i, species in enumerate(target_species):
handles = noise_ax.plot(scales, noise_measure, lw=lw['feat'])
[h.set_color(c) for h, c in zip(handles, kern_colors)]
# Indicate saturation points:
for j in range(pure_measure.shape[1]):
color = kern_colors[j]
# Indicate feature-specific saturation points of pure curves:
ind = get_saturation(pure_measure[:, j], **plateau_settings)[1]
scale = scales[ind]
pure_ax.plot(scale, 0, c='w', alpha=1, zorder=5.5, **plateau_dot_kwargs,
transform=pure_ax.get_xaxis_transform())
pure_ax.plot(scale, 0, mfc=color, mec='k', alpha=0.75, zorder=6, **plateau_dot_kwargs,
transform=pure_ax.get_xaxis_transform())
pure_ax.vlines(scale, pure_ax.get_ylim()[0], pure_measure[ind, j],
color=color, **plateau_line_kwargs)
# Indicate feature-specific saturation points of noise curves:
ind = get_saturation(noise_measure[:, j], **plateau_settings)[1]
scale = scales[ind]
noise_ax.plot(scale, 0, c='w', alpha=1, zorder=5.5, **plateau_dot_kwargs,
transform=noise_ax.get_xaxis_transform())
noise_ax.plot(scale, 0, mfc=color, mec='k', alpha=0.75, zorder=6, **plateau_dot_kwargs,
transform=noise_ax.get_xaxis_transform())
noise_ax.vlines(scale, noise_ax.get_ylim()[0], noise_measure[ind, j],
color=color, **plateau_line_kwargs)
if i == 0:
# Indicate kernel waveforms:
ylims = ylimits(config['kernels'], pad=0.05)
@@ -604,15 +638,15 @@ for i, species in enumerate(target_species):
noise_bars[0].tick_params(axis='y', which='both', left=True, labelleft=True)
ylabel(noise_bars[0], ylabels['bar'], **ylab_cbar_kwargs)
# Indicate plateaus of pure invariance curves:
# Indicate across-feature saturation points of pure curves:
low_ind, high_ind = get_saturation(pure_measure, **plateau_settings)
pure_bars[i].axhline(scales[low_ind], c=noise_colors[0], lw=lw['plateau'])
pure_bars[i].axhline(scales[high_ind], c=noise_colors[1], lw=lw['plateau'])
pure_bars[i].axhline(scales[low_ind], c=noise_colors[0], lw=lw['bar'])
pure_bars[i].axhline(scales[high_ind], c=noise_colors[1], lw=lw['bar'])
# Indicate plateaus of noise invariance curves:
# Indicate across-feature saturation points of noise curves:
low_ind, high_ind = get_saturation(noise_measure, **plateau_settings)
noise_bars[i].axhline(scales[low_ind], c=noise_colors[0], lw=lw['plateau'])
noise_bars[i].axhline(scales[high_ind], c=noise_colors[1], lw=lw['plateau'])
noise_bars[i].axhline(scales[low_ind], c=noise_colors[0], lw=lw['bar'])
noise_bars[i].axhline(scales[high_ind], c=noise_colors[1], lw=lw['bar'])
# Log start and end of invariance curve:
min_noise_feat[i, :] = noise_measure.min(axis=0)