bluepyemodel.emodel_pipeline.plotting¶
Functions related to the plotting of the e-models.
Functions
|
Returns a x and y arrays, y being a exponential fit for EPSP feature. |
|
Plot the current / frequency curve for the model |
|
Returns a x and y arrays, y being a exponential decay fit for bAP feature. |
|
Returns EPSP attenuation and corresponding distances. |
|
Plot the currentscapes for all protocols. |
|
Plots a accross dendrites and compare it with experimental data. |
|
Calls dendritic_feature_plot for all features corresponding to feature_name. |
|
Create plots of the evolution of the density of parameters in the population as the optimisation progresses. |
|
Create plots related to a BluePyOpt optimisation |
|
Plot the distribution of the parameters across several models |
|
Plots recordings as voltage vs time and in phase space. |
|
Plot EPSP attenuation across dendrites. |
|
Plots FI (current vs frequency) curves with simulated and experimental values. |
|
Plots IV curves of peak voltage and voltage_deflection with simulated and experimental values. |
|
Plot back-propagating action potential. |
|
Plot the traces, scores and parameter distributions for all the models |
|
Plot SineSpec with current trace, voltage trace and impedance. |
|
Compare traces between experiments and models. |
|
Plot the current trace on top of the voltage trace |
|
Runs and plots ready-to-use EPSP protocol for apical and basal dendrites. |
|
Runs and plots ready-to-use bAP protocol for apical and basal dendrites. |
|
Run a custom SineSpec protocol, and plot its trace and impedance feature. |
|
Plot the scores of a model |
|
Plot the trace figure to use as thumbnail. |
|
Plot the traces of a model |
|
Return the title for the traces figure |
- EPSP_fit(feature, distances, values, npoints=20)¶
Returns a x and y arrays, y being a exponential fit for EPSP feature.
- Parameters:
feature (DendFitFeature) – EPSP feature
distances (list) – distances of the recordings
values (list) – EPSP values
npoints (int) – number of items in the returned ndarrays
- FI_curve(model, responses, evaluator, delay=100, length_step=1000, delta_current=0.01, max_offset_current=0.2, figures_dir='./figures', write_fig=True)¶
Plot the current / frequency curve for the model
- bAP_fit(feature, distances, values, npoints=20)¶
Returns a x and y arrays, y being a exponential decay fit for bAP feature.
- Parameters:
feature (DendFitFeature) – bAP feature
distances (list) – distances of the recordings
values (list) – bAP values
npoints (int) – number of items in the returned ndarrays
- compute_attenuation(dendrec_feature, somarec_feature, responses)¶
Returns EPSP attenuation and corresponding distances.
- Parameters:
dendrec_feature (DendFitFeature) – feature with recordings in the dendrite
somarec_feature (DendFitFeature) – feature with recordings in the soma
responses (dict) – responses to feed to the features
- currentscape(responses=None, output_dir=None, config=None, metadata_str='', figures_dir='./figures', emodel='')¶
Plot the currentscapes for all protocols.
- Parameters:
responses (dict) – dict containing the current and voltage responses.
output_dur (str) – path to the output dir containing the voltage and current responses. Will not be used if responses is set.
config (dict) – currentscape config. See currentscape package for more info.
metadata_str (str) – Metadata of the model as a string. Used in the files naming.
figures_dir (str) – path to the directory where to put the figures.
emodel (str) – name of the emodel
iteration_tag (str) – githash
seed (int) – random seed number
- dendritic_feature_plot(model, responses, feature, feature_name, figures_dir='./figures', write_fig=True)¶
Plots a accross dendrites and compare it with experimental data.
- Parameters:
model (bluepyopt.ephys.CellModel) – cell model
responses (dict) – responses of the cell model
feature (DendFitFeature) – feature to plot
feature_name (str) – which feature to plot. Can be either ‘ISI_CV’ or ‘rheobase’.
figures_dir (str or Path) – Where to save the figures.
write_fig (bool) – whether to save the figure
Returns a figure and its single axe.
- dendritic_feature_plots(mo, feature_name, dest_leaf, figures_dir='./figures')¶
Calls dendritic_feature_plot for all features corresponding to feature_name.
- evolution_parameters_density(evaluator, checkpoint_paths, metadata, figures_dir='./figures', write_fig=True)¶
Create plots of the evolution of the density of parameters in the population as the optimisation progresses. Create one plot per checkpoint plus one plot with all checkpoints.
WARNING: This plotting function assumes that all the checkpoint files come from the same run and have the same parameters with the same bounds, therefore, that they come from the same evaluator. Do not use otherwise.
- Parameters:
evaluator (CellEvaluator) – evaluator used to evaluate the individuals.
checkpoint_paths (list of str) – list of paths to the checkpoints .pkl.
metadata (EModelMetadata) – metadata of the emodel.
figures_dir (str) – path to the directory where the figures will be saved.
write_fig (bool) – whether to write the figures to disk.
- optimisation(optimiser, emodel, iteration, seed, checkpoint_path='./checkpoint.pkl', figures_dir='./figures', write_fig=True)¶
Create plots related to a BluePyOpt optimisation
- parameters_distribution(models, lbounds, ubounds, figures_dir='./figures', write_fig=True)¶
Plot the distribution of the parameters across several models
- phase_plot(emodels, figures_dir, prot_names, amplitude, amp_window, relative_amp=True, custom_bluepyefe_cells_pklpath=None, write_fig=True)¶
Plots recordings as voltage vs time and in phase space.
- Parameters:
emodels (list) – list of EModels
figures_dir (str or Path) – output directory for the figure to be saved on
prot_names (list of str) – the names of the protocols to select for plotting
amplitude (float) – amplitude of the protocol to select. Only exactly this amplitude will be selected for model. An amplitude window is used for experimental trace selection
amp_window (float) – amplitude window around amplitude for experimental recording selection Is not used for model trace selection
relative_amp (bool) – Are amplitde and amp_window in relative amplitude (True) or in absolute amplitude (False).
custom_bluepyefe_cells_pklpath (str) – file path to the cells.pkl output of BluePyEfe. If None, will use usual file path used in BluePyEfe, so this is to be set only to use a file at an unexpected path.
write_fig (bool) – whether to save the figure
- plot_EPSP(model, responses, apical_apicrec_feat, apical_somarec_feat, basal_basalrec_feat, basal_somarec_feat, figures_dir='./figures', write_fig=True)¶
Plot EPSP attenuation across dendrites.
- Parameters:
model (bluepyopt.ephys.CellModel) – cell model
responses (dict) – responses of the cell model
apical_apicrec_feat (DendFitFeature) – EPSP feature with apical stim and apical recs,
apical_somarec_feat (DendFitFeature) – EPSP feature with apical stim and soma recs,
basal_basalrec_feat (DendFitFeature) – EPSP feature with basal stim and basal recs,
basal_somarec_feat (DendFitFeature) – EPSP feature with basal stim and soma recs,
figures_dir (str or Path) – directory where to save the figures
write_fig (bool) – whether to save the figure
- plot_FI_curves_comparison(evaluator, emodels, access_point, seeds, mapper, figures_dir, prot_name, custom_bluepyefe_cells_pklpath=None, write_fig=True, n_bin=5)¶
Plots FI (current vs frequency) curves with simulated and experimental values. Only works for threshold-based protocols. Expects mean_frequency to be available in extracted and simulated data.
- Parameters:
evaluator (CellEvaluator) – cell evaluator
emodels (list) – list of EModels
access_point (DataAccessPoint) – data access point
seeds (list) – if not None, filter emodels to keep only the ones with these seeds.
mapper (map) – used to parallelize the evaluation of the individual in the population.
figures_dir (str or Path) – output directory for the figure to be saved on
prot_name (str) – name of the protocol to use for the FI curve
custom_bluepyefe_cells_pklpath (str) – file path to the cells.pkl output of BluePyEfe. If None, will use usual file path used in BluePyEfe, so this is to be set only to use a file at an unexpected path.
write_fig (bool) – whether to save the figure
n_bin (int) – number of bins to use
- plot_IV_curves(evaluator, emodels, access_point, figures_dir, efel_settings, mapper, seeds, prot_name='iv', custom_bluepyefe_cells_pklpath=None, write_fig=True, n_bin=5)¶
Plots IV curves of peak voltage and voltage_deflection with simulated and experimental values. Only works for threshold-based protocols.
- Parameters:
evaluator (CellEvaluator) – cell evaluator
emodels (list) – list of EModels
access_point (DataAccessPoint) – data access point
figures_dir (str or Path) – output directory for the figure to be saved on
efel_settings (dict) – eFEL settings in the form {setting_name: setting_value}.
mapper (map) – used to parallelize the evaluation of the individual in the population.
seeds (list) – if not None, filter emodels to keep only the ones with these seeds.
prot_name (str) – Only recordings from this protocol will be used.
custom_bluepyefe_cells_pklpath (str) – file path to the cells.pkl output of BluePyEfe. If None, will use usual file path used in BluePyEfe, so this is to be set only to use a file at an unexpected path.
write_fig (bool) – whether to save the figure
n_bin (int) – number of bins to use
- plot_bAP(model, responses, apical_feature, basal_feature, figures_dir='./figures', write_fig=True)¶
Plot back-propagating action potential.
- Parameters:
model (bluepyopt.ephys.CellModel) – cell model
responses (dict) – responses of the cell model
apical_feature (DendFitFeature) – bAP feature with apical recs,
basal_feature (DendFitFeature) – bAP feature with basal recs,
figures_dir (str or Path) – directory where to save the figures
write_fig (bool) – whether to save the figure
- plot_models(access_point, mapper, seeds=None, figures_dir='./figures', plot_optimisation_progress=True, optimiser=None, plot_parameter_evolution=True, plot_distributions=True, plot_scores=True, plot_traces=True, plot_thumbnail=True, plot_currentscape=False, plot_fi_curve=False, plot_dendritic_ISI_CV=True, plot_dendritic_rheobase=True, plot_bAP_EPSP=False, plot_IV_curve=False, plot_FI_curve_comparison=False, plot_phase_plot=False, plot_traces_comparison=False, run_plot_custom_sinspec=False, IV_curve_prot_name='iv', FI_curve_prot_name='idrest', phase_plot_settings=None, sinespec_settings=None, custom_bluepyefe_cells_pklpath=None, custom_bluepyefe_protocols_pklpath=None, only_validated=False, save_recordings=False, load_from_local=False, cell_evaluator=None)¶
- Plot the traces, scores and parameter distributions for all the models
matching the emodels name.
- Parameters:
access_point (DataAccessPoint) – data access point.
mapper (map) – used to parallelize the evaluation of the individual in the population.
seeds (list) – if not None, filter emodels to keep only the ones with these seeds.
figures_dir (str) – path of the directory in which the figures should be saved.
plot_optimisation_progress (bool) – True to plot the optimisation progress from checkpoint
optimiser (str) – name of the algorithm used for optimisation, can be “IBEA”, “SO-CMA” or “MO-CMA”. Is used in optimisation progress plotting.
plot_parameter_evolution (bool) – True to plot parameter evolution
plot_distributions (bool) – True to plot the parameters distributions
plot_scores (bool) – True to plot the scores
plot_traces (bool) – True to plot the traces
plot_thumbnail (bool) – True to plot a trace used as thumbnail
plot_currentscape (bool) – True to plot the currentscapes
plot_fi_curve (bool) – True to plot the current / frequency curve
plot_dendritic_ISI_CV (bool) – True to plot dendritic ISI CV (if present)
plot_dendritic_rheobase (bool) – True to plot dendritic rheobase (if present)
plot_bAP_EPSP (bool) – True to plot bAP and EPSP protocol. Only use this on model having apical dendrites.
plot_IV_curve (bool) – True to plot IV curves for peak voltage and voltage_deflection. Expects threshold-based sub-threshold IV protocol.
plot_FI_curve_comparison (bool) – True to plot FI curve with experimental and simulated data. Expects threshold-based protocols.
plot_phase_plot (bool) – True to plot phase plot with experimental and simulated data. Can be threshold-based or non threshold-based.
plot_traces_comparison (bool) – True to plot a new figure with simulated traces on top of experimental traces.
run_plot_custom_sinspec (bool) – True to run a SineSpec protocol, and plot its voltage and current trace, along with its impedance.
IV_curve_prot_name (str) – which protocol to use to plot_IV_curves.
FI_curve_prot_name (str) – which protocol to use to plot FI_curve comparison. The protocol must have the mean_frequency feature associated to it.
phase_plot_settings (dict) –
settings for the phase plot. Should contain the following keys: “prot_names” (list of str): the names of the protocols to select for phase plot “amplitude” (float): amplitude of the protocol to select.
Only exactly this amplitude will be selected for model. An amplitude window is used for experimental trace selection
- ”amp_window” (float): amplitude window around amplitude
for experimental recording selection. Is not used for model trace selection
”relative_amp” (bool): Are amplitde and amp_window in relative amplitude (True) or in absolute amplitude (False).
sinespec_settings (dict) – contains amplitude settings for the SineSpec protocol, with keys ‘amp’ and ‘threshold_based’. ‘amp’ should be in percentage of threshold if ‘threshold_based’ is True, e.g. 150, or in nA if ‘threshold_based’ if false, e.g. 0.1.
custom_bluepyefe_cells_pklpath (str) – file path to the cells.pkl output of BluePyEfe. If None, will use usual file path used in BluePyEfe, so this is to be set only to use a file at an unexpected path.
custom_bluepyefe_protocols_pklpath (str) – file path to the protocols.pkl output of BluePyEfe. If None, will use usual file path used in BluePyEfe, so this is to be set only to use a file at an unexpected path.
only_validated (bool) – True to only plot validated models
save_recordings (bool) – Whether to save the responses data under a folder named recordings. Responses can then be loaded using load_from_local instead of being re-run.
load_from_local (bool) – True to load responses from locally saved recordings. Responses are saved locally when save_recordings is True.
cell_evaluator (CellEvaluator) – cell evaluator used to compute the responses.
- Returns:
list of emodels.
- Return type:
emodels (list)
- plot_sinespec(model, responses, sinespec_settings, efel_settings, figures_dir='./figures', write_fig=True)¶
Plot SineSpec with current trace, voltage trace and impedance.
- plot_trace_comparison(emodels, figures_dir, custom_bluepyefe_protocols_pklpath=None, write_fig=True)¶
Compare traces between experiments and models.
- Parameters:
emodels (list) – list of EModels
figures_dir (str or Path) – output directory for the figure to be saved on
custom_bluepyefe_protocols_pklpath (str) – file path to the protocols.pkl output of BluePyEfe. If None, will use usual file path used in BluePyEfe, so this is to be set only to use a file at an unexpected path.
write_fig (bool) – whether to save the figure
- plot_traces_current(ax, time, current)¶
Plot the current trace on top of the voltage trace
- run_and_plot_EPSP(original_cell_evaluator, access_point, mapper, seeds, save_recordings, load_from_local, only_validated=False, figures_dir='./figures')¶
Runs and plots ready-to-use EPSP protocol for apical and basal dendrites.
- Parameters:
original_cell_evaluator (CellEvaluator) – original cell evaluator. A copy will be modified and then used to compute the responses.
access_point (DataAccessPoint) – data access point.
mapper (map) – used to parallelize the evaluation of the individual in the population.
seeds (list) – if not None, filter emodels to keep only the ones with these seeds.
save_recordings (bool) – Whether to save the responses data under a folder named recordings. Responses can then be loaded using load_from_local instead of being re-run.
load_from_local (bool) – True to load responses from locally saved recordings. Responses are saved locally when save_recordings is True.
only_validated (bool) – True to only plot validated models
figures_dir (str) – path of the directory in which the figures should be saved.
- run_and_plot_bAP(original_cell_evaluator, access_point, mapper, seeds, save_recordings, load_from_local, only_validated=False, figures_dir='./figures')¶
Runs and plots ready-to-use bAP protocol for apical and basal dendrites.
- Parameters:
original_cell_evaluator (CellEvaluator) – original cell evaluator. A copy will be modified and then used to compute the responses.
access_point (DataAccessPoint) – data access point.
mapper (map) – used to parallelize the evaluation of the individual in the population.
seeds (list) – if not None, filter emodels to keep only the ones with these seeds.
save_recordings (bool) – Whether to save the responses data under a folder named recordings. Responses can then be loaded using load_from_local instead of being re-run.
load_from_local (bool) – True to load responses from locally saved recordings. Responses are saved locally when save_recordings is True.
only_validated (bool) – True to only plot validated models
figures_dir (str) – path of the directory in which the figures should be saved.
- run_and_plot_custom_sinespec(evaluator, sinespec_settings, efel_settings, access_point, mapper, seeds, save_recordings, load_from_local, figures_dir='./figures')¶
Run a custom SineSpec protocol, and plot its trace and impedance feature.
- Parameters:
evaluator (CellEvaluator) – cell evaluator
sinespec_settings (dict) – contains amplitude settings for the SineSpec protocol, with keys ‘amp’ and ‘threshold_based’. ‘amp’ should be in percentage of threshold if ‘threshold_based’ is True, e.g. 150, or in nA if ‘threshold_based’ if false, e.g. 0.1.
efel_settings (dict) – eFEL settings in the form {setting_name: setting_value}
access_point (DataAccessPoint) – data access point
mapper (map) – used to parallelize the evaluation of the individual in the population
seeds (list) – if not None, filter emodels to keep only the ones with these seeds
save_recordings (bool) – Whether to save the responses data under a folder named recordings. Responses can then be loaded using load_from_local instead of being re-run.
load_from_local (bool) – True to load responses from locally saved recordings. Responses are saved locally when save_recordings is True.
only_validated (bool) – True to only plot validated models
figures_dir (str) – path of the directory in which the figures should be saved
- scores(model, figures_dir='./figures', write_fig=True)¶
Plot the scores of a model
- thumbnail(model, responses, recording_names, figures_dir='./figures', write_fig=True, dpi=300, thumbnail_rec=None)¶
Plot the trace figure to use as thumbnail.
- traces(model, responses, recording_names, stimuli={}, figures_dir='./figures', write_fig=True)¶
Plot the traces of a model
- traces_title(model, threshold=None, holding=None, rmp=None, rin=None)¶
Return the title for the traces figure