Finished (:D) fig_invariance_thresh_lp_single.pdf.
Added/modified few plot functions. Cleaned up simulation/plotting scripts regarding Thresh-LP.
This commit is contained in:
@@ -1,73 +1,71 @@
|
||||
import plotstyle_plt
|
||||
import numpy as np
|
||||
import matplotlib.pyplot as plt
|
||||
from itertools import product
|
||||
from thunderhopper.filetools import search_files
|
||||
from thunderhopper.modeltools import load_data
|
||||
from thunderhopper.filtertools import find_kern_specs
|
||||
from color_functions import load_colors, shade_colors
|
||||
from plot_functions import hide_axis, ylimits, xlabel, ylabel, super_ylabel, super_xlabel,\
|
||||
plot_line, plot_barcode, strip_zeros, time_bar,\
|
||||
letter_subplot, letter_subplots, title_subplot
|
||||
from plot_functions import shift_subplot, hide_axis, ylimits, xlabel, ylabel,\
|
||||
super_ylabel, plot_line, plot_barcode, strip_zeros,\
|
||||
time_bar, letter_subplot, letter_subplots, title_subplot,\
|
||||
set_clip_box
|
||||
from IPython import embed
|
||||
|
||||
def add_snip_axes(fig, grid_kwargs, snip_specs):
|
||||
def add_snip_axes(fig, grid_kwargs):
|
||||
grid = fig.add_gridspec(**grid_kwargs)
|
||||
axes = np.zeros((len(snip_specs), grid.ncols), dtype=object)
|
||||
for i, specs in enumerate(snip_specs.values()):
|
||||
for j in range(grid.ncols):
|
||||
axes[i, j] = fig.add_subplot(grid[specs, j])
|
||||
[hide_axis(ax, 'left') for ax in axes[:, 1:].flatten()]
|
||||
axes = np.zeros((grid.nrows, grid.ncols), dtype=object)
|
||||
for i, j in product(range(grid.nrows), range(grid.ncols)):
|
||||
axes[i, j] = fig.add_subplot(grid[i, j])
|
||||
if j == 0:
|
||||
shift_subplot(axes[i, j], dx=snip_col_shift)
|
||||
[hide_axis(ax, 'left') for ax in axes[:, 2:].flatten()]
|
||||
[hide_axis(ax, 'bottom') for ax in axes.flatten()]
|
||||
return axes
|
||||
|
||||
def plot_snippets(axes, time, snippets, ymin=None, ymax=None,
|
||||
def plot_snippets(axes, time, snippets, ymin=None, ymax=None, ypad=0.05,
|
||||
thresh=None, fill_kwargs={}, **kwargs):
|
||||
ymin, ymax = ylimits(snippets, minval=ymin, maxval=ymax, pad=0.05)
|
||||
ymin, ymax = ylimits(snippets, minval=ymin, maxval=ymax, pad=ypad)
|
||||
handles = []
|
||||
for ax, snippet in zip(axes, snippets.T):
|
||||
plot_line(ax, time, snippet, ymin=ymin, ymax=ymax, **kwargs)
|
||||
handles.append(plot_line(ax, time, snippet, ymin=ymin, ymax=ymax, **kwargs))
|
||||
if thresh is not None:
|
||||
ax.fill_between(time, thresh, snippet, where=(snippet > thresh), **fill_kwargs)
|
||||
return None
|
||||
return handles
|
||||
|
||||
def plot_bi_snippets(axes, time, binary, **kwargs):
|
||||
for ax, binary in zip(axes, binary.T):
|
||||
plot_barcode(ax, time, binary[:, None], **kwargs)
|
||||
return None
|
||||
|
||||
def side_distributions(axes, snippets, inset_bounds, thresh, nbins=50,
|
||||
ymin=None, ymax=None, fill_kwargs={}, **kwargs):
|
||||
limits = np.array([snippets.min(), snippets.max()]) * 1.05
|
||||
def side_distributions(axes, snippets, inset_bounds, thresh, nbins=1000,
|
||||
fill_kwargs={}, **kwargs):
|
||||
limits = np.array([snippets.min(), snippets.max()]) * 1.1
|
||||
edges = np.linspace(*limits, nbins + 1)
|
||||
centers = edges[:-1] + (edges[1] - edges[0]) / 2
|
||||
insets = []
|
||||
for ax, snippet in zip(axes, snippets.T):
|
||||
pdf, _ = np.histogram(snippet, edges, density=True)
|
||||
inset = ax.inset_axes(inset_bounds)
|
||||
inset.plot(pdf, centers, **kwargs)
|
||||
inset.fill_betweenx(centers, pdf.min(), pdf, where=(centers > thresh),
|
||||
**fill_kwargs)
|
||||
ylimits(centers, inset, minval=ymin, maxval=ymax, pad=0)
|
||||
inset.fill_betweenx(centers, pdf.min(), pdf, where=(centers > thresh), **fill_kwargs)
|
||||
inset.set_xlim(0, pdf.max())
|
||||
inset.set_ylim(ax.get_ylim())
|
||||
inset.axis('off')
|
||||
return None
|
||||
insets.append(inset)
|
||||
return insets
|
||||
|
||||
|
||||
# GENERAL SETTINGS:
|
||||
with_noise = True
|
||||
target = 'Omocestus_rufipes'
|
||||
search_kwargs = dict(
|
||||
incl=['subset', 'noise'] if with_noise else 'subset',
|
||||
excl=None if with_noise else 'noise',
|
||||
dir='../data/inv/thresh_lp/'
|
||||
)
|
||||
data_paths = search_files(target, **search_kwargs)
|
||||
data_paths = search_files(target, incl='noise', dir='../data/inv/thresh_lp/')
|
||||
stages = ['conv', 'bi', 'feat']
|
||||
load_kwargs = dict(
|
||||
files=stages,
|
||||
keywords=['scales', 'snip', 'measure', 'thresh']
|
||||
)
|
||||
save_path = '../figures/fig_invariance_thresh_lp_single.pdf'
|
||||
if with_noise and save_path is not None:
|
||||
save_path = save_path.replace('.pdf', '_noise.pdf')
|
||||
exclude_zero = True
|
||||
|
||||
# GRAPH SETTINGS:
|
||||
fig_kwargs = dict(
|
||||
@@ -83,19 +81,34 @@ super_grid_kwargs = dict(
|
||||
bottom=0,
|
||||
top=1
|
||||
)
|
||||
input_rows = 1
|
||||
snip_rows = 2
|
||||
subfig_specs = dict(
|
||||
snip=(slice(None), slice(super_grid_kwargs['ncols'] - 1)),
|
||||
input=(slice(input_rows), slice(-1)),
|
||||
snip=[np.array([input_rows, input_rows + snip_rows]), slice(-1)],
|
||||
big=(slice(None), -1),
|
||||
)
|
||||
snip_col_shift = -0.07
|
||||
snip_grid_kwargs = dict(
|
||||
nrows=len(stages) + 1,
|
||||
nrows=len(stages),
|
||||
ncols=None,
|
||||
wspace=0.3,
|
||||
hspace=0,
|
||||
left=0.17,
|
||||
left=0.25,
|
||||
right=0.93,
|
||||
bottom=0.15,
|
||||
top=0.9
|
||||
top=0.95,
|
||||
height_ratios=[2, 1, 1]
|
||||
)
|
||||
input_grid_kwargs = dict(
|
||||
nrows=1,
|
||||
ncols=None,
|
||||
wspace=snip_grid_kwargs['wspace'],
|
||||
hspace=0,
|
||||
left=snip_grid_kwargs['left'],
|
||||
right=snip_grid_kwargs['right'],
|
||||
bottom=0.15,
|
||||
top=0.75,
|
||||
)
|
||||
big_grid_kwargs = dict(
|
||||
nrows=1,
|
||||
@@ -107,12 +120,7 @@ big_grid_kwargs = dict(
|
||||
bottom=0.1,
|
||||
top=0.99
|
||||
)
|
||||
snip_specs = dict(
|
||||
conv=slice(0, -2),
|
||||
bi=-2,
|
||||
feat=-1
|
||||
)
|
||||
inset_bounds = [1.02, 0, 0.2, 1]
|
||||
dist_inset_bounds = [1.02, 0, 0.2, 1]
|
||||
|
||||
# PLOT SETTINGS:
|
||||
fs = dict(
|
||||
@@ -124,29 +132,24 @@ fs = dict(
|
||||
bar=16,
|
||||
)
|
||||
colors = load_colors('../data/stage_colors.npz')
|
||||
color_factors = [0.2, -0.2]
|
||||
shade_factors = [0.2, -0.2]
|
||||
lw = dict(
|
||||
conv=1,
|
||||
inv=1.5,
|
||||
conv=1.5,
|
||||
bi=0.1,
|
||||
feat=3,
|
||||
big=4,
|
||||
)
|
||||
xlabels = dict(
|
||||
snip='time [s]',
|
||||
big='scale $\\alpha$',
|
||||
)
|
||||
ylabels = dict(
|
||||
inv='$x_{\\text{adapt}}$',
|
||||
conv='$c_i$',
|
||||
bi='$b_i$',
|
||||
feat='$f_i$',
|
||||
big='$\\mu_f$',
|
||||
)
|
||||
xlab_snip_kwargs = dict(
|
||||
y=0,
|
||||
fontsize=fs['lab_norm'],
|
||||
ha='center',
|
||||
va='bottom',
|
||||
)
|
||||
xlab_big_kwargs = dict(
|
||||
y=0,
|
||||
fontsize=fs['lab_norm'],
|
||||
@@ -157,7 +160,7 @@ ylab_snip_kwargs = dict(
|
||||
x=0.08,
|
||||
fontsize=fs['lab_tex'],
|
||||
rotation=0,
|
||||
ha='right',
|
||||
ha='center',
|
||||
va='center',
|
||||
)
|
||||
ylab_super_kwargs = dict(
|
||||
@@ -168,14 +171,20 @@ ylab_super_kwargs = dict(
|
||||
)
|
||||
ylab_big_kwargs = dict(
|
||||
x=0,
|
||||
fontsize=fs['lab_norm'],
|
||||
fontsize=fs['lab_tex'],
|
||||
ha='center',
|
||||
va='top',
|
||||
)
|
||||
ypad = dict(
|
||||
inv=0.05,
|
||||
conv=0.05,
|
||||
big=0.075
|
||||
)
|
||||
yloc = dict(
|
||||
conv=100,
|
||||
bi=1,
|
||||
feat=1,
|
||||
inv=(2, 200),
|
||||
conv=(0.02, 2),
|
||||
bi=(1, 1),
|
||||
feat=(1, 1),
|
||||
big=0.2,
|
||||
)
|
||||
title_kwargs = dict(
|
||||
@@ -200,7 +209,6 @@ letter_big_kwargs = dict(
|
||||
fontsize=fs['letter'],
|
||||
)
|
||||
dist_kwargs = dict(
|
||||
nbins=50,
|
||||
c='k',
|
||||
lw=1,
|
||||
)
|
||||
@@ -211,8 +219,8 @@ dist_fill_kwargs = dict(
|
||||
bar_time = 0.1
|
||||
bar_kwargs = dict(
|
||||
dur=bar_time,
|
||||
y0=-0.25,
|
||||
y1=-0.1,
|
||||
y0=-0.5,
|
||||
y1=-0.35,
|
||||
xshift=1,
|
||||
color='k',
|
||||
lw=0,
|
||||
@@ -225,7 +233,16 @@ bar_kwargs = dict(
|
||||
va='center',
|
||||
)
|
||||
)
|
||||
kernel = np.array([
|
||||
leg_kwargs = dict(
|
||||
ncols=2,
|
||||
loc='center',
|
||||
bbox_to_anchor=(0, 0.95, 1, 0.05),
|
||||
frameon=False,
|
||||
fontsize=fs['tit_norm'],
|
||||
handlelength=1.5,
|
||||
columnspacing=1,
|
||||
)
|
||||
kern_specs = np.array([
|
||||
[1, 0.008],
|
||||
[2, 0.004],
|
||||
[3, 0.002],
|
||||
@@ -238,96 +255,138 @@ for data_path in data_paths:
|
||||
print(f'Processing {data_path}')
|
||||
|
||||
# Load invariance data:
|
||||
data, config = load_data(data_path, **load_kwargs)
|
||||
t_full = np.arange(data['snip_conv'].shape[0]) / config['env_rate']
|
||||
noise_data, config = load_data(data_path, **load_kwargs)
|
||||
pure_data, _ = load_data(data_path.replace('noise', 'pure'), **load_kwargs)
|
||||
|
||||
# Unpack shared variables:
|
||||
scales = noise_data['scales']
|
||||
plot_scales = noise_data['example_scales']
|
||||
thresh_rel = noise_data['thresh_rel']
|
||||
thresh_abs = noise_data['thresh_abs']
|
||||
|
||||
# Reduce to kernel subset and crop to zoom frame:
|
||||
t_full = np.arange(noise_data['snip_conv'].shape[0]) / config['env_rate']
|
||||
zoom_abs = zoom_rel * t_full[-1]
|
||||
zoom_inds = (t_full >= zoom_abs[0]) & (t_full <= zoom_abs[1])
|
||||
kern_ind = find_kern_specs(config['k_specs'], kerns=kernel)[0]
|
||||
|
||||
# Reduce to kernel subset and crop time to zoom frame:
|
||||
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_feat'] = data['measure_feat'][:, kern_ind, :]
|
||||
t_full = np.arange(data['snip_conv'].shape[0]) / config['env_rate']
|
||||
kern_ind = find_kern_specs(config['k_specs'], kerns=kern_specs)[0]
|
||||
noise_data['snip_inv'] = noise_data['snip_inv'][zoom_inds, :]
|
||||
noise_data['snip_conv'] = noise_data['snip_conv'][zoom_inds, kern_ind, :]
|
||||
noise_data['snip_bi'] = noise_data['snip_bi'][zoom_inds, kern_ind, :, :]
|
||||
noise_data['snip_feat'] = noise_data['snip_feat'][zoom_inds, kern_ind, :, :]
|
||||
noise_data['measure_feat'] = noise_data['measure_feat'][:, kern_ind, :]
|
||||
pure_data['measure_feat'] = pure_data['measure_feat'][:, kern_ind, :]
|
||||
thresh_abs = thresh_abs[:, kern_ind]
|
||||
t_full = np.arange(noise_data['snip_conv'].shape[0]) / config['env_rate']
|
||||
if exclude_zero:
|
||||
# Reduce to nonzero scales:
|
||||
nonzero_inds = scales > 0
|
||||
scales = scales[nonzero_inds]
|
||||
noise_data['measure_feat'] = noise_data['measure_feat'][nonzero_inds, :]
|
||||
pure_data['measure_feat'] = pure_data['measure_feat'][nonzero_inds, :]
|
||||
|
||||
# Get threshold-specific colors:
|
||||
factors = np.linspace(*color_factors, data['threshs'].size)
|
||||
colors = dict(
|
||||
factors = np.linspace(*shade_factors, thresh_rel.size)
|
||||
shaded = dict(
|
||||
conv=shade_colors(colors['conv'], factors),
|
||||
bi=shade_colors(colors['bi'], factors),
|
||||
feat=shade_colors(colors['feat'], factors),
|
||||
)
|
||||
|
||||
# Adjust grid parameters:
|
||||
super_grid_kwargs['nrows'] = data['threshs'].size
|
||||
snip_grid_kwargs['ncols'] = data['example_scales'].size
|
||||
# Adjust grid parameters to loaded data:
|
||||
super_grid_kwargs['nrows'] = snip_rows * thresh_rel.size + 1
|
||||
input_grid_kwargs['ncols'] = plot_scales.size
|
||||
snip_grid_kwargs['ncols'] = plot_scales.size
|
||||
|
||||
# Prepare overall graph:
|
||||
fig = plt.figure(**fig_kwargs)
|
||||
super_grid = fig.add_gridspec(**super_grid_kwargs)
|
||||
|
||||
# Prepare input snippet axes:
|
||||
input_subfig = fig.add_subfigure(super_grid[subfig_specs['input']])
|
||||
input_axes = add_snip_axes(input_subfig, input_grid_kwargs).ravel()
|
||||
input_axes[0].yaxis.set_major_locator(plt.MultipleLocator(yloc['inv'][0]))
|
||||
input_axes[1].yaxis.set_major_locator(plt.MultipleLocator(yloc['inv'][1]))
|
||||
ylabel(input_axes[0], ylabels['inv'], transform=input_subfig.transSubfigure, **ylab_snip_kwargs)
|
||||
for ax, scale in zip(input_axes, plot_scales):
|
||||
title_subplot(ax, f'$\\alpha={strip_zeros(scale)}$', ref=input_subfig, **title_kwargs)
|
||||
letter_subplot(input_subfig, 'a', **letter_snip_kwargs)
|
||||
|
||||
# Prepare snippet axes:
|
||||
snip_axes = {}
|
||||
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_specs)
|
||||
snip_axes[snip_subfig] = axes
|
||||
super_ylabel(f'{strip_zeros(100 * data["thresh_perc"][i])}%',
|
||||
snip_subfigs, snip_axes = [], []
|
||||
for i in range(thresh_rel.size):
|
||||
subfig_spec = subfig_specs['snip'].copy()
|
||||
subfig_spec[0] = slice(*(subfig_spec[0] + i * snip_rows))
|
||||
snip_subfig = fig.add_subfigure(super_grid[*subfig_spec])
|
||||
axes = add_snip_axes(snip_subfig, snip_grid_kwargs)
|
||||
[hide_axis(ax, 'left') for ax in axes[1:, 1]]
|
||||
super_ylabel(f'$\\Theta={strip_zeros(thresh_rel[i])}\\cdot\\sigma_{{\\eta}}$',
|
||||
snip_subfig, axes[-1, 0], axes[0, 0], **ylab_super_kwargs)
|
||||
for ax, stage in zip(axes[:, 0], stages):
|
||||
ax.yaxis.set_major_locator(plt.MultipleLocator(yloc[stage]))
|
||||
ylabel(ax, ylabels[stage], **ylab_snip_kwargs,
|
||||
transform=snip_subfig.transSubfigure)
|
||||
if i == 0:
|
||||
for ax, scale in zip(axes[0, :], data['example_scales']):
|
||||
title = f'$\\alpha={strip_zeros(scale)}$'
|
||||
title_subplot(ax, title, **title_kwargs, ref=fig)
|
||||
elif i == data['threshs'].size - 1:
|
||||
for (ax1, ax2), stage in zip(axes[:, :2], stages):
|
||||
ax1.yaxis.set_major_locator(plt.MultipleLocator(yloc[stage][0]))
|
||||
ax2.yaxis.set_major_locator(plt.MultipleLocator(yloc[stage][1]))
|
||||
ylabel(ax1, ylabels[stage], transform=snip_subfig.transSubfigure, **ylab_snip_kwargs)
|
||||
# for ax, scale in zip(axes[0, :], plot_scales):
|
||||
# title_subplot(ax, f'$\\alpha={strip_zeros(scale)}$', ref=snip_subfig, **title_kwargs)
|
||||
if i == thresh_rel.size - 1:
|
||||
axes[-1, -1].set_xlim(t_full[0], t_full[-1])
|
||||
time_bar(axes[-1, -1], **bar_kwargs)
|
||||
letter_subplots(snip_axes.keys(), **letter_snip_kwargs)
|
||||
snip_subfigs.append(snip_subfig)
|
||||
snip_axes.append(axes)
|
||||
letter_subplots(snip_subfigs, 'bcd', **letter_snip_kwargs)
|
||||
|
||||
# Prepare analysis axis:
|
||||
big_subfig = fig.add_subfigure(super_grid[subfig_specs['big']])
|
||||
big_grid = big_subfig.add_gridspec(**big_grid_kwargs)
|
||||
big_ax = big_subfig.add_subplot(big_grid[0, 0])
|
||||
xlabel(big_ax, xlabels['big'], **xlab_big_kwargs,
|
||||
transform=big_subfig.transSubfigure)
|
||||
ylabel(big_ax, ylabels['big'], **ylab_big_kwargs,
|
||||
transform=big_subfig.transSubfigure)
|
||||
big_ax.set_xlim(data['scales'].min(), data['scales'].max())
|
||||
big_ax.set_xscale('symlog', linthresh=data['scales'][1], linscale=0.5)
|
||||
ylimits(data['measure_feat'], big_ax, minval=0, pad=0.01)
|
||||
big_ax.set_xlim(scales[0], scales[-1])
|
||||
big_ax.set_xscale('symlog', linthresh=scales[scales > 0][0], linscale=0.5)
|
||||
ylimits(noise_data['measure_feat'], big_ax, minval=0, pad=ypad['big'])
|
||||
big_ax.yaxis.set_major_locator(plt.MultipleLocator(yloc['big']))
|
||||
letter_subplot(big_subfig, 'd', **letter_big_kwargs, ref=list(snip_axes.keys())[0])
|
||||
xlabel(big_ax, xlabels['big'], transform=big_subfig.transSubfigure, **xlab_big_kwargs)
|
||||
ylabel(big_ax, ylabels['big'], transform=big_subfig.transSubfigure, **ylab_big_kwargs)
|
||||
letter_subplot(big_subfig, 'e', **letter_big_kwargs, ref=input_subfig)
|
||||
|
||||
# Plot intensity-adapted snippets:
|
||||
plot_snippets(input_axes, t_full, noise_data['snip_inv'],
|
||||
ypad=ypad['inv'], c=colors['inv'], lw=lw['inv'])
|
||||
ylimits(noise_data['snip_inv'][:, 0], input_axes[0], pad=ypad['inv'])
|
||||
|
||||
# Plot representation snippets per threshold:
|
||||
conv_min, conv_max = ylimits(data['snip_conv'], pad=0.02)
|
||||
for i, (subfig, axes) in enumerate(snip_axes.items()):
|
||||
dist_fill_kwargs['color'] = colors['bi'][i]
|
||||
for i, (subfig, axes) in enumerate(zip(snip_subfigs, snip_axes)):
|
||||
dist_fill_kwargs['color'] = shaded['bi'][i]
|
||||
|
||||
# Plot kernel response snippets:
|
||||
plot_snippets(axes[0, :], t_full, data['snip_conv'][:, :, i],
|
||||
thresh=data['threshs'][i], ymin=conv_min, ymax=conv_max,
|
||||
fill_kwargs=dist_fill_kwargs, c=colors['conv'][i], lw=lw['conv'])
|
||||
plot_snippets(axes[0, :], t_full, noise_data['snip_conv'], thresh=thresh_abs[i],
|
||||
ypad=ypad['conv'], fill_kwargs=dist_fill_kwargs, c=shaded['conv'][i], lw=lw['conv'])
|
||||
ylimits(noise_data['snip_conv'][:, 0], axes[0, 0], pad=ypad['conv'])
|
||||
|
||||
# Plot kernel response distributions:
|
||||
side_distributions(axes[0, :1], noise_data['snip_conv'][:, :1], dist_inset_bounds,
|
||||
thresh_abs[i], nbins=50, fill_kwargs=dist_fill_kwargs, **dist_kwargs)
|
||||
side_distributions(axes[0, 1:], noise_data['snip_conv'][:, 1:], dist_inset_bounds,
|
||||
thresh_abs[i], nbins=50, fill_kwargs=dist_fill_kwargs, **dist_kwargs)
|
||||
|
||||
# Plot binary snippets:
|
||||
plot_bi_snippets(axes[1, :], t_full, data['snip_bi'][:, :, i],
|
||||
color=colors['bi'][i], lw=lw['bi'])
|
||||
plot_bi_snippets(axes[1, :], t_full, noise_data['snip_bi'][:, :, i],
|
||||
color=shaded['bi'][i], lw=lw['bi'])
|
||||
|
||||
# Plot feature snippets:
|
||||
plot_snippets(axes[2, :], t_full, data['snip_feat'][:, :, i],
|
||||
ymin=0, ymax=1, c=colors['feat'][i], lw=lw['feat'])
|
||||
handles = plot_snippets(axes[2, :], t_full, noise_data['snip_feat'][:, :, i],
|
||||
ymin=0, ymax=1, c=shaded['feat'][i], lw=lw['feat'])
|
||||
[set_clip_box(h[0], ax, bounds=[[0, -0.05], [1, 1.05]]) for h, ax in zip(handles, axes[2, :])]
|
||||
|
||||
# Plot kernel response distribution:
|
||||
side_distributions(axes[0, :], data['snip_conv'][:, :, i], inset_bounds,
|
||||
data['threshs'][i], ymin=conv_min, ymax=conv_max,
|
||||
fill_kwargs=dist_fill_kwargs, **dist_kwargs)
|
||||
# Plot pure-song analysis results:
|
||||
handles = big_ax.plot(scales, pure_data['measure_feat'], lw=lw['big'], ls='dotted')
|
||||
[h.set_color(c) for h, c in zip(handles, shaded['feat'])]
|
||||
|
||||
# Plot analysis results:
|
||||
handles = big_ax.plot(data['scales'], data['measure_feat'], lw=lw['big'])
|
||||
[h.set_color(c) for h, c in zip(handles, colors['feat'])]
|
||||
# Plot noise-song analysis results:
|
||||
handles = big_ax.plot(scales, noise_data['measure_feat'], lw=lw['big'])
|
||||
[h.set_color(c) for h, c in zip(handles, shaded['feat'])]
|
||||
|
||||
# Add proxy legend:
|
||||
h1 = big_ax.plot([], [], c='k', lw=lw['big'], label='$\\alpha\\cdot s(t) + \\eta(t)$')[0]
|
||||
h2 = big_ax.plot([], [], c='k', lw=lw['big'], ls='dotted', label='$\\alpha\\cdot s(t)$')[0]
|
||||
big_ax.legend(handles=[h1, h2], **leg_kwargs)
|
||||
|
||||
if save_path is not None:
|
||||
fig.savefig(save_path)
|
||||
|
||||
Reference in New Issue
Block a user