Nearly finished 1st draft of species-specific Thresh-LP invariance figure (WIP).

This commit is contained in:
j-hartling
2026-03-13 17:15:03 +01:00
parent 4f5054c8fd
commit 1516fe6090
19 changed files with 735 additions and 239 deletions

View File

@@ -52,7 +52,7 @@ def side_distributions(axes, snippets, inset_bounds, thresh, nbins=50,
# GENERAL SETTINGS:
with_noise = False
with_noise = True
target = 'Omocestus_rufipes'
search_kwargs = dict(
incl=['subset', 'noise'] if with_noise else 'subset',
@@ -186,9 +186,10 @@ bar_kwargs = dict(
lw=0,
)
kernel = np.array([
[2, 0.008],
[4, 0.008],
])[:1]
[1, 0.008],
[2, 0.004],
[3, 0.002],
])[np.array([1])]
zoom_rel = np.array([0.5, 0.525])
@@ -207,13 +208,11 @@ for data_path in data_paths:
data['snip_conv'] = data['snip_conv'][zoom_inds, kern_ind, ...]
data['snip_bi'] = data['snip_bi'][zoom_inds, kern_ind, ...]
data['snip_feat'] = data['snip_feat'][zoom_inds, kern_ind, ...]
data['measure_conv'] = data['measure_conv'][:, kern_ind, :]
data['measure_feat'] = data['measure_feat'][:, kern_ind, :]
data['threshs'] = data['threshs'][:, kern_ind]
t_full = np.arange(data['snip_conv'].shape[0]) / config['env_rate']
# Get threshold-specific colors:
factors = np.linspace(*color_factors, data['thresh_perc'].size)
factors = np.linspace(*color_factors, data['threshs'].size)
colors = dict(
conv=shade_colors(colors['conv'], factors),
bi=shade_colors(colors['bi'], factors),
@@ -221,7 +220,7 @@ for data_path in data_paths:
)
# Adjust grid parameters:
super_grid_kwargs['nrows'] = data['thresh_perc'].size
super_grid_kwargs['nrows'] = data['threshs'].size
snip_grid_kwargs['ncols'] = data['example_scales'].size
# Prepare overall graph:
@@ -230,13 +229,13 @@ for data_path in data_paths:
# Prepare snippet axes:
snip_axes = {}
for i in range(data['thresh_perc'].size):
for i in range(data['threshs'].size):
subfig_specs['snip'] = (i, subfig_specs['snip'][1])
snip_subfig = fig.add_subfigure(super_grid[subfig_specs['snip']])
axes = add_snip_axes(snip_subfig, snip_grid_kwargs)
snip_axes[snip_subfig] = axes
super_ylabel(f'{data["thresh_perc"][i]}%', snip_subfig,
axes[0, 0], axes[-1, 0], **ylab_super_kwargs)
super_ylabel(f'{strip_zeros(100 * data["thresh_perc"][i])}%',
snip_subfig, axes[-1, 0], axes[0, 0], **ylab_super_kwargs)
for ax, stage in zip(axes[:, 0], stages):
ylabel(ax, ylabels[stage], **ylab_snip_kwargs,
transform=snip_subfig.transSubfigure)