Added loads of units in nearly all graphs.
Overhauled fig_invariance_full.pdf. Added some legends, somewhere.
This commit is contained in:
@@ -4,23 +4,21 @@ 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 misc_functions import get_saturation
|
||||
from color_functions import load_colors
|
||||
from plot_functions import hide_axis, ylimits, xlabel, ylabel, title_subplot,\
|
||||
plot_line, plot_barcode, strip_zeros, time_bar,\
|
||||
from plot_functions import hide_axis, reorder_by_sd, ylimits, super_xlabel, ylabel, title_subplot,\
|
||||
plot_line, strip_zeros, time_bar, assign_colors,\
|
||||
letter_subplot, letter_subplots
|
||||
from IPython import embed
|
||||
|
||||
def plot_snippets(axes, time, snippets, ymin=None, ymax=None, **kwargs):
|
||||
ymin, ymax = ylimits(snippets, minval=ymin, maxval=ymax, pad=0.05)
|
||||
handles = []
|
||||
for i, ax in enumerate(axes):
|
||||
plot_line(ax, time, snippets[:, ..., i], ymin=ymin, ymax=ymax, **kwargs)
|
||||
return None
|
||||
|
||||
def plot_bi_snippets(axes, time, snippets, **kwargs):
|
||||
for i, ax in enumerate(axes):
|
||||
plot_barcode(ax, time, snippets[:, ..., i], **kwargs)
|
||||
return None
|
||||
handles.append(plot_line(ax, time, snippets[:, ..., i],
|
||||
ymin=ymin, ymax=ymax, **kwargs))
|
||||
return handles
|
||||
|
||||
def plot_curves(ax, scales, measures, fill_kwargs={}, **kwargs):
|
||||
if measures.ndim == 1:
|
||||
@@ -33,10 +31,19 @@ def plot_curves(ax, scales, measures, fill_kwargs={}, **kwargs):
|
||||
ax.fill_between(scales, *spread_measure, **fill_kwargs)
|
||||
return median_measure
|
||||
|
||||
def show_saturation(ax, scales, measures, high=0.95, **kwargs):
|
||||
high_ind = get_saturation(measures, high=high)[1]
|
||||
return ax.plot(scales[high_ind], 0, transform=ax.get_xaxis_transform(),
|
||||
marker='o', ms=10, zorder=6, clip_on=False, **kwargs)
|
||||
def exclude_zero_scale(data, stages):
|
||||
inds = data['scales'] > 0
|
||||
data['scales'] = data['scales'][inds]
|
||||
for stage in stages:
|
||||
data[f'mean_{stage}'] = data[f'mean_{stage}'][inds, ...]
|
||||
return data
|
||||
|
||||
def reduce_kernel_set(data, inds, keyword, stages=['conv', 'feat']):
|
||||
for stage in stages:
|
||||
key = f'{keyword}_{stage}'
|
||||
data[key] = data[key][:, inds, ...]
|
||||
return data
|
||||
|
||||
|
||||
# GENERAL SETTINGS:
|
||||
target_species = [
|
||||
@@ -57,19 +64,34 @@ example_file = {
|
||||
'Omocestus_rufipes': 'Omocestus_rufipes_DJN_32-40s724ms-48s779ms',
|
||||
'Pseudochorthippus_parallelus': 'Pseudochorthippus_parallelus_GBC_88-6s678ms-9s32.3ms'
|
||||
}[target_species]
|
||||
data_paths = search_files(target_species, dir='../data/inv/full/condensed/')
|
||||
snip_paths = search_files(example_file, dir='../data/inv/full/')
|
||||
ref_path = '../data/inv/full/ref_measures.npz'
|
||||
save_path = '../figures/fig_invariance_full.pdf'
|
||||
stages = ['filt', 'env', 'log', 'inv', 'conv', 'feat']
|
||||
load_kwargs = dict(
|
||||
files=stages,
|
||||
keywords=['scales', 'snip', 'measure']
|
||||
)
|
||||
raw_path = search_files(target_species, incl='unnormed', dir='../data/inv/full/condensed/')[0]
|
||||
base_path = search_files(target_species, incl='base', dir='../data/inv/full/condensed/')[0]
|
||||
range_path = search_files(target_species, incl='range', dir='../data/inv/full/condensed/')[0]
|
||||
snip_path = search_files(example_file, dir='../data/inv/full/')[0]
|
||||
save_path = '../figures/fig_invariance_full.pdf'
|
||||
|
||||
# ANALYSIS SETTINGS:
|
||||
exclude_zero = True
|
||||
|
||||
# SUBSET SETTINGS:
|
||||
types = np.array([1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9, 10, -10])
|
||||
sigmas = np.array([0.001, 0.002, 0.004, 0.008, 0.016, 0.032])
|
||||
# types = [1, -1, 2, -2, 3, -3, 4, -4, 5, -5, 6, -6, 7, -7, 8, -8, 9, -9, 10, -10]
|
||||
# sigmas = [0.001, 0.002, 0.004, 0.008, 0.016, 0.032]
|
||||
kernels = np.array([
|
||||
[1, 0.002],
|
||||
[-1, 0.002],
|
||||
[2, 0.004],
|
||||
[-2, 0.004],
|
||||
[3, 0.032],
|
||||
[-3, 0.032]
|
||||
])
|
||||
kernels = None
|
||||
|
||||
# GRAPH SETTINGS:
|
||||
fig_kwargs = dict(
|
||||
figsize=(32/2.54, 20/2.54),
|
||||
figsize=(32/2.54, 32/2.54),
|
||||
)
|
||||
super_grid_kwargs = dict(
|
||||
nrows=2,
|
||||
@@ -91,20 +113,20 @@ snip_grid_kwargs = dict(
|
||||
ncols=None,
|
||||
wspace=0.1,
|
||||
hspace=0.4,
|
||||
left=0.08,
|
||||
right=0.95,
|
||||
left=0.11,
|
||||
right=0.98,
|
||||
bottom=0.08,
|
||||
top=0.95
|
||||
)
|
||||
big_grid_kwargs = dict(
|
||||
nrows=1,
|
||||
ncols=3,
|
||||
wspace=0.2,
|
||||
wspace=0.4,
|
||||
hspace=0,
|
||||
left=snip_grid_kwargs['left'],
|
||||
right=0.96,
|
||||
bottom=0.2,
|
||||
top=0.95
|
||||
right=snip_grid_kwargs['right'],
|
||||
bottom=0.13,
|
||||
top=0.98
|
||||
)
|
||||
|
||||
# PLOT SETTINGS:
|
||||
@@ -117,15 +139,17 @@ fs = dict(
|
||||
bar=16,
|
||||
)
|
||||
colors = load_colors('../data/stage_colors.npz')
|
||||
conv_colors = load_colors('../data/conv_colors_all.npz')
|
||||
feat_colors = load_colors('../data/feat_colors_all.npz')
|
||||
lw = dict(
|
||||
filt=0.25,
|
||||
env=0.25,
|
||||
log=0.25,
|
||||
inv=0.25,
|
||||
conv=0.25,
|
||||
bi=0,
|
||||
feat=1,
|
||||
big=3
|
||||
big=3,
|
||||
plateau=1.5,
|
||||
)
|
||||
xlabels = dict(
|
||||
big='scale $\\alpha$',
|
||||
@@ -134,11 +158,10 @@ ylabels = dict(
|
||||
filt='$x_{\\text{filt}}$',
|
||||
env='$x_{\\text{env}}$',
|
||||
log='$x_{\\text{db}}$',
|
||||
inv='$x_{\\text{inv}}$',
|
||||
inv='$x_{\\text{adapt}}$',
|
||||
conv='$c_i$',
|
||||
bi='$b_i$',
|
||||
feat='$f_i$',
|
||||
big=['intensity', 'rel. intensity', 'norm. intensity']
|
||||
big=['measure', 'rel. measure', 'norm. measure']
|
||||
)
|
||||
xlab_big_kwargs = dict(
|
||||
y=0,
|
||||
@@ -154,7 +177,7 @@ ylab_snip_kwargs = dict(
|
||||
va='center'
|
||||
)
|
||||
ylab_big_kwargs = dict(
|
||||
x=-0.12,
|
||||
x=-0.2,
|
||||
fontsize=fs['lab_norm'],
|
||||
ha='center',
|
||||
va='bottom',
|
||||
@@ -164,7 +187,7 @@ yloc = dict(
|
||||
env=1000,
|
||||
log=50,
|
||||
inv=20,
|
||||
conv=2,
|
||||
conv=1,
|
||||
feat=1,
|
||||
)
|
||||
title_kwargs = dict(
|
||||
@@ -205,122 +228,199 @@ bar_kwargs = dict(
|
||||
va='center',
|
||||
)
|
||||
)
|
||||
|
||||
# PREPARATION:
|
||||
ref_data = dict(np.load(ref_path))
|
||||
plateau_settings = dict(
|
||||
low=0.05,
|
||||
high=0.95,
|
||||
first=True,
|
||||
last=True,
|
||||
condense=None,
|
||||
)
|
||||
plateau_line_kwargs = dict(
|
||||
lw=lw['plateau'],
|
||||
ls='--',
|
||||
zorder=1,
|
||||
)
|
||||
plateau_dot_kwargs = dict(
|
||||
marker='o',
|
||||
markersize=8,
|
||||
markeredgewidth=1,
|
||||
clip_on=False,
|
||||
)
|
||||
|
||||
# EXECUTION:
|
||||
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_filt'].shape[0]) / config['rate']
|
||||
# Load raw (unnormed) invariance data:
|
||||
data, config = load_data(raw_path, files='scales', keywords='mean')
|
||||
if exclude_zero:
|
||||
data = exclude_zero_scale(data, stages)
|
||||
scales = data['scales']
|
||||
|
||||
# Adjust grid parameters:
|
||||
snip_grid_kwargs['ncols'] = data['example_scales'].size
|
||||
# Load snippet data:
|
||||
snip, _ = load_data(snip_path, files='example_scales', keywords='snip')
|
||||
t_full = np.arange(snip['snip_filt'].shape[0]) / config['rate']
|
||||
snip_scales = snip['example_scales']
|
||||
|
||||
# Prepare overall graph:
|
||||
fig = plt.figure(**fig_kwargs)
|
||||
super_grid = fig.add_gridspec(**super_grid_kwargs)
|
||||
# Optional kernel subset:
|
||||
reduce_kernels = False
|
||||
if any(var is not None for var in [kernels, types, sigmas]):
|
||||
kern_inds = find_kern_specs(config['k_specs'], kernels, types, sigmas)
|
||||
data = reduce_kernel_set(data, kern_inds, keyword='mean')
|
||||
snip = reduce_kernel_set(snip, kern_inds, keyword='snip')
|
||||
config['k_specs'] = config['k_specs'][kern_inds, :]
|
||||
config['kernels'] = config['kernels'][:, kern_inds]
|
||||
reduce_kernels = True
|
||||
|
||||
# Prepare stage-specific snippet axes:
|
||||
snip_subfig = fig.add_subfigure(super_grid[subfig_specs['snip']])
|
||||
snip_grid = snip_subfig.add_gridspec(**snip_grid_kwargs)
|
||||
snip_axes = np.zeros((snip_grid.nrows, snip_grid.ncols), dtype=object)
|
||||
for i, j in product(range(snip_grid.nrows), range(snip_grid.ncols)):
|
||||
ax = snip_subfig.add_subplot(snip_grid[i, j])
|
||||
ax.set_xlim(t_full[0], t_full[-1])
|
||||
ax.yaxis.set_major_locator(plt.MultipleLocator(yloc[stages[i]]))
|
||||
hide_axis(ax, 'bottom')
|
||||
if i == 0:
|
||||
title = title_subplot(ax, f'$\\alpha={strip_zeros(data["example_scales"][j])}$',
|
||||
ref=snip_subfig, **title_kwargs)
|
||||
if j == 0:
|
||||
ylabel(ax, ylabels[stages[i]], **ylab_snip_kwargs, transform=snip_subfig.transSubfigure)
|
||||
else:
|
||||
hide_axis(ax, 'left')
|
||||
snip_axes[i, j] = ax
|
||||
time_bar(snip_axes[-1, -1], **bar_kwargs)
|
||||
letter_subplot(snip_subfig, 'a', ref=title, **letter_snip_kwargs)
|
||||
# Adjust grid parameters:
|
||||
snip_grid_kwargs['ncols'] = snip_scales.size
|
||||
|
||||
# Prepare analysis axes:
|
||||
big_subfig = fig.add_subfigure(super_grid[subfig_specs['big']])
|
||||
big_grid = big_subfig.add_gridspec(**big_grid_kwargs)
|
||||
big_axes = np.zeros((big_grid.ncols,), dtype=object)
|
||||
for i in range(big_grid.ncols):
|
||||
ax = big_subfig.add_subplot(big_grid[0, i])
|
||||
ax.set_xlim(data['scales'][0], data['scales'][-1])
|
||||
ax.set_xscale('symlog', linthresh=data['scales'][1], linscale=0.5)
|
||||
ax.set_yscale('symlog', linthresh=0.01, linscale=0.1)
|
||||
xlabel(ax, xlabels['big'], transform=big_subfig, **xlab_big_kwargs)
|
||||
ylabel(ax, ylabels['big'][i], **ylab_big_kwargs)
|
||||
big_axes[i] = ax
|
||||
letter_subplots(big_axes, 'bc', **letter_big_kwargs)
|
||||
plt.show()
|
||||
# Prepare overall graph:
|
||||
fig = plt.figure(**fig_kwargs)
|
||||
super_grid = fig.add_gridspec(**super_grid_kwargs)
|
||||
|
||||
# # Plot filtered snippets:
|
||||
# plot_snippets(snip_axes[0, :], t_full, data['snip_filt'],
|
||||
# c=colors['filt'], lw=lw['filt'])
|
||||
# Prepare stage-specific snippet axes:
|
||||
snip_subfig = fig.add_subfigure(super_grid[subfig_specs['snip']])
|
||||
snip_grid = snip_subfig.add_gridspec(**snip_grid_kwargs)
|
||||
snip_axes = np.zeros((snip_grid.nrows, snip_grid.ncols), dtype=object)
|
||||
for i, j in product(range(snip_grid.nrows), range(snip_grid.ncols)):
|
||||
ax = snip_subfig.add_subplot(snip_grid[i, j])
|
||||
ax.set_xlim(t_full[0], t_full[-1])
|
||||
ax.yaxis.set_major_locator(plt.MultipleLocator(yloc[stages[i]]))
|
||||
hide_axis(ax, 'bottom')
|
||||
if i == 0:
|
||||
title = title_subplot(ax, f'$\\alpha={strip_zeros(snip_scales[j])}$',
|
||||
ref=snip_subfig, **title_kwargs)
|
||||
if j == 0:
|
||||
ylabel(ax, ylabels[stages[i]], **ylab_snip_kwargs, transform=snip_subfig.transSubfigure)
|
||||
else:
|
||||
hide_axis(ax, 'left')
|
||||
snip_axes[i, j] = ax
|
||||
time_bar(snip_axes[-1, -1], **bar_kwargs)
|
||||
letter_subplot(snip_subfig, 'a', ref=title, **letter_snip_kwargs)
|
||||
|
||||
# # Plot envelope snippets:
|
||||
# plot_snippets(snip_axes[1, :], t_full, data['snip_env'],
|
||||
# ymin=0, c=colors['env'], lw=lw['env'])
|
||||
# Prepare analysis axes:
|
||||
big_subfig = fig.add_subfigure(super_grid[subfig_specs['big']])
|
||||
big_grid = big_subfig.add_gridspec(**big_grid_kwargs)
|
||||
big_axes = np.zeros((big_grid.ncols,), dtype=object)
|
||||
for i in range(big_grid.ncols):
|
||||
ax = big_subfig.add_subplot(big_grid[0, i])
|
||||
ax.set_xlim(scales[0], scales[-1])
|
||||
ax.set_xscale('symlog', linthresh=scales[1], linscale=0.5)
|
||||
ax.set_yscale('symlog', linthresh=0.01, linscale=0.1)
|
||||
ylabel(ax, ylabels['big'][i], **ylab_big_kwargs)
|
||||
if i < (big_grid.ncols - 1):
|
||||
ax.set_ylim(scales[0], scales[-1])
|
||||
else:
|
||||
ax.set_ylim(0, 1)
|
||||
big_axes[i] = ax
|
||||
super_xlabel(xlabels['big'], big_subfig, big_axes[0], big_axes[-1], **xlab_big_kwargs)
|
||||
letter_subplots(big_axes, 'bcd', **letter_big_kwargs)
|
||||
|
||||
# # Plot logarithmic snippets:
|
||||
# plot_snippets(snip_axes[2, :], t_full, data['snip_log'],
|
||||
# c=colors['log'], lw=lw['log'])
|
||||
if True:
|
||||
# Plot filtered snippets:
|
||||
plot_snippets(snip_axes[0, :], t_full, snip['snip_filt'],
|
||||
c=colors['filt'], lw=lw['filt'])
|
||||
|
||||
# # Plot invariant snippets:
|
||||
# plot_snippets(snip_axes[3, :], t_full, data['snip_inv'],
|
||||
# c=colors['inv'], lw=lw['inv'])
|
||||
# Plot envelope snippets:
|
||||
plot_snippets(snip_axes[1, :], t_full, snip['snip_env'],
|
||||
ymin=0, c=colors['env'], lw=lw['env'])
|
||||
|
||||
# # Plot kernel response snippets:
|
||||
# plot_snippets(snip_axes[4, :], t_full, data['snip_conv'],
|
||||
# c=colors['conv'], lw=lw['conv'])
|
||||
# Plot logarithmic snippets:
|
||||
plot_snippets(snip_axes[2, :], t_full, snip['snip_log'],
|
||||
c=colors['log'], lw=lw['log'])
|
||||
|
||||
# # Plot feature snippets:
|
||||
# plot_snippets(snip_axes[5, :], t_full, data['snip_feat'],
|
||||
# ymin=0, ymax=1, c=colors['feat'], lw=lw['feat'])
|
||||
# Plot invariant snippets:
|
||||
plot_snippets(snip_axes[3, :], t_full, snip['snip_inv'],
|
||||
c=colors['inv'], lw=lw['inv'])
|
||||
|
||||
# Analysis results:
|
||||
scales_rel = data['scales'] - data['scales'][0]
|
||||
scales_rel /= scales_rel[-1]
|
||||
for stage in stages:
|
||||
measure = data[f'measure_{stage}']
|
||||
# Plot kernel response snippets:
|
||||
all_handles = plot_snippets(snip_axes[4, :], t_full, snip['snip_conv'],
|
||||
c=colors['conv'], lw=lw['conv'])
|
||||
for i, handles in enumerate(all_handles):
|
||||
assign_colors(handles, config['k_specs'][:, 0], conv_colors)
|
||||
reorder_by_sd(handles, snip['snip_conv'][..., i])
|
||||
|
||||
# Plot unmodified intensity measures:
|
||||
curve = plot_curves(big_axes[0], data['scales'], measure, c=colors[stage], lw=lw['big'],
|
||||
fill_kwargs=dict(color=colors[stage], alpha=0.25))
|
||||
if stage in ['log', 'inv', 'conv', 'feat']:
|
||||
show_saturation(big_axes[0], data['scales'], curve, c=colors[stage])
|
||||
# Plot feature snippets:
|
||||
all_handles = plot_snippets(snip_axes[5, :], t_full, snip['snip_feat'],
|
||||
ymin=0, ymax=1, c=colors['feat'], lw=lw['feat'])
|
||||
for i, handles in enumerate(all_handles):
|
||||
assign_colors(handles, config['k_specs'][:, 0], feat_colors)
|
||||
reorder_by_sd(handles, snip['snip_feat'][..., i])
|
||||
del snip
|
||||
|
||||
# # Relate to pure-noise reference:
|
||||
# norm_measure = measure / ref_data[stage]
|
||||
# Remember saturation points:
|
||||
crit_inds, crit_scales = {}, {}
|
||||
|
||||
# # Plot noise-related intensity measures:
|
||||
# big_axes[1].plot(data['scales'], norm_measure, c=colors[stage], lw=lw['big'])
|
||||
# Unnormed measures:
|
||||
for stage in stages:
|
||||
# Plot average intensity measure across recordings:
|
||||
curve = plot_curves(big_axes[0], scales, data[f'mean_{stage}'].mean(axis=-1),
|
||||
c=colors[stage], lw=lw['big'],
|
||||
fill_kwargs=dict(color=colors[stage], alpha=0.25))
|
||||
# Indicate saturation point:
|
||||
if stage in ['log', 'inv', 'conv', 'feat']:
|
||||
ind = get_saturation(curve, **plateau_settings)[1]
|
||||
scale = scales[ind]
|
||||
big_axes[0].plot(scale, 0, c='w', alpha=1, zorder=5.5, **plateau_dot_kwargs,
|
||||
transform=big_axes[0].get_xaxis_transform())
|
||||
big_axes[0].plot(scale, 0, mfc=colors[stage], mec='k', alpha=0.75, zorder=6, **plateau_dot_kwargs,
|
||||
transform=big_axes[0].get_xaxis_transform())
|
||||
big_axes[0].vlines(scale, big_axes[0].get_ylim()[0], curve[ind],
|
||||
color=colors[stage], **plateau_line_kwargs)
|
||||
# Log saturation point:
|
||||
crit_inds[stage] = ind
|
||||
crit_scales[stage] = scale
|
||||
del data
|
||||
|
||||
# Normalize measure to [0, 1]:
|
||||
min_measure = measure.min(axis=0)
|
||||
max_measure = measure.max(axis=0)
|
||||
norm_measure = (measure - min_measure) / (max_measure - min_measure)
|
||||
# Noise baseline-related measures:
|
||||
data, _ = load_data(base_path, files='scales', keywords='mean')
|
||||
if exclude_zero:
|
||||
data = exclude_zero_scale(data, stages)
|
||||
if reduce_kernels:
|
||||
data = reduce_kernel_set(data, kern_inds, keyword='mean')
|
||||
for stage in stages:
|
||||
# Plot average intensity measure across recordings:
|
||||
curve = plot_curves(big_axes[1], scales, data[f'mean_{stage}'].mean(axis=-1),
|
||||
c=colors[stage], lw=lw['big'],
|
||||
fill_kwargs=dict(color=colors[stage], alpha=0.25))
|
||||
# Indicate saturation point:
|
||||
if stage in ['log', 'inv', 'conv', 'feat']:
|
||||
ind, scale = crit_inds[stage], crit_scales[stage]
|
||||
big_axes[1].plot(scale, 0, c='w', alpha=1, zorder=5.5, **plateau_dot_kwargs,
|
||||
transform=big_axes[1].get_xaxis_transform())
|
||||
big_axes[1].plot(scale, 0, mfc=colors[stage], mec='k', alpha=0.75, zorder=6, **plateau_dot_kwargs,
|
||||
transform=big_axes[1].get_xaxis_transform())
|
||||
big_axes[1].vlines(scale, big_axes[1].get_ylim()[0], curve[ind],
|
||||
color=colors[stage], **plateau_line_kwargs)
|
||||
del data
|
||||
|
||||
# Plot normalized intensity measures:
|
||||
curve = plot_curves(big_axes[1], data['scales'], norm_measure, c=colors[stage], lw=lw['big'],
|
||||
fill_kwargs=dict(color=colors[stage], alpha=0.25))
|
||||
if stage in ['log', 'inv', 'conv', 'feat']:
|
||||
show_saturation(big_axes[1], data['scales'], curve, c=colors[stage])
|
||||
# Min-max normalized measures:
|
||||
data, _ = load_data(range_path, files='scales', keywords='mean')
|
||||
if exclude_zero:
|
||||
data = exclude_zero_scale(data, stages)
|
||||
if reduce_kernels:
|
||||
data = reduce_kernel_set(data, kern_inds, keyword='mean')
|
||||
for stage in ['log', 'inv', 'conv', 'feat']:
|
||||
# Plot average intensity measure across recordings:
|
||||
curve = plot_curves(big_axes[2], scales, data[f'mean_{stage}'].mean(axis=-1),
|
||||
c=colors[stage], lw=lw['big'],
|
||||
fill_kwargs=dict(color=colors[stage], alpha=0.25))
|
||||
|
||||
# # Plot over relative scales:
|
||||
# plot_curves(big_axes[2], scales_rel, norm_measure, c=colors[stage], lw=lw['big'],
|
||||
# fill_kwargs=dict(color=colors[stage], alpha=0.25))
|
||||
# scales_rel = curve - curve.min()
|
||||
# scales_rel /= scales_rel.max()
|
||||
# Indicate saturation point:
|
||||
if stage in ['log', 'inv', 'conv', 'feat']:
|
||||
ind, scale = crit_inds[stage], crit_scales[stage]
|
||||
big_axes[2].plot(scale, 0, c='w', alpha=1, zorder=5.5, **plateau_dot_kwargs,
|
||||
transform=big_axes[2].get_xaxis_transform())
|
||||
big_axes[2].plot(scale, 0, mfc=colors[stage], mec='k', alpha=0.75, zorder=6, **plateau_dot_kwargs,
|
||||
transform=big_axes[2].get_xaxis_transform())
|
||||
big_axes[2].vlines(scale, big_axes[2].get_ylim()[0], curve[ind],
|
||||
color=colors[stage], **plateau_line_kwargs)
|
||||
del data
|
||||
|
||||
if save_path is not None:
|
||||
fig.savefig(save_path)
|
||||
plt.show()
|
||||
# Save graph:
|
||||
if save_path is not None:
|
||||
file_name = save_path.replace('.pdf', f'_{target_species}.pdf')
|
||||
fig.savefig(file_name)
|
||||
plt.show()
|
||||
|
||||
print('Done.')
|
||||
embed()
|
||||
|
||||
Reference in New Issue
Block a user