Skip to content
This repository was archived by the owner on Feb 26, 2025. It is now read-only.

Commit 900d810

Browse files
Merge pull request #176 from BlueBrain/plot-settings
add settings for customisable plots
2 parents ef5819e + f498f1e commit 900d810

3 files changed

Lines changed: 62 additions & 43 deletions

File tree

bluepyemodel/emodel_pipeline/emodel_pipeline.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -262,16 +262,16 @@ def plot(self, only_validated=False, load_from_local=False, seeds=None):
262262
mapper=self.mapper,
263263
seeds=seeds,
264264
figures_dir=pathlib.Path("./figures") / self.access_point.emodel_metadata.emodel,
265-
plot_optimisation_progress=True,
265+
plot_optimisation_progress=pp_settings.plot_optimisation_progress,
266266
optimiser=pp_settings.optimiser,
267-
plot_parameter_evolution=True,
268-
plot_distributions=True,
269-
plot_scores=True,
270-
plot_traces=True,
271-
plot_thumbnail=True,
267+
plot_parameter_evolution=pp_settings.plot_parameter_evolution,
268+
plot_distributions=pp_settings.plot_distributions,
269+
plot_scores=pp_settings.plot_scores,
270+
plot_traces=pp_settings.plot_traces,
271+
plot_thumbnail=pp_settings.plot_thumbnail,
272272
plot_currentscape=pp_settings.plot_currentscape,
273-
plot_dendritic_ISI_CV=True,
274-
plot_dendritic_rheobase=True,
273+
plot_dendritic_ISI_CV=pp_settings.plot_dendritic_ISI_CV,
274+
plot_dendritic_rheobase=pp_settings.plot_dendritic_rheobase,
275275
plot_bAP_EPSP=pp_settings.plot_bAP_EPSP,
276276
plot_IV_curve=pp_settings.plot_IV_curves,
277277
plot_FI_curve_comparison=pp_settings.plot_FI_curve_comparison,

bluepyemodel/emodel_pipeline/emodel_settings.py

Lines changed: 27 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818

1919
import logging
2020

21-
# pylint: disable=too-many-arguments,too-many-locals,too-many-instance-attributes
21+
# pylint: disable=too-many-arguments,too-many-locals,too-many-instance-attributes, unused-argument
2222
# pylint: disable=too-many-statements
2323

2424
logger = logging.getLogger(__name__)
@@ -60,7 +60,6 @@ def __init__(
6060
use_stagnation_criterion=True,
6161
validation_function="max_score",
6262
validation_threshold=5.0,
63-
plot_optimisation=True,
6463
use_ProbAMPANMDA_EMS=False,
6564
compile_mechanisms=False,
6665
n_model=3,
@@ -71,8 +70,16 @@ def __init__(
7170
name_rmp_protocol=None,
7271
validation_protocols=None,
7372
name_gene_map=None,
74-
plot_currentscape=True,
73+
plot_optimisation=True,
74+
plot_optimisation_progress=True,
7575
plot_parameter_evolution=True,
76+
plot_distributions=True,
77+
plot_scores=True,
78+
plot_traces=True,
79+
plot_thumbnail=True,
80+
plot_currentscape=True,
81+
plot_dendritic_ISI_CV=True,
82+
plot_dendritic_rheobase=True,
7683
plot_bAP_EPSP=False,
7784
plot_IV_curves=False,
7885
plot_FI_curve_comparison=False,
@@ -235,8 +242,6 @@ def __init__(
235242
Nexus access_point and the IC-selector.
236243
n_model (int): minimum number of models to pass validation to consider the e-model
237244
building task done. Only used by the Luigi workflow.
238-
plot_optimisation (bool): should the e-models scores and traces be plotted. Only used
239-
by the Luigi workflow.
240245
use_ProbAMPANMDA_EMS (bool): True to link ProbAMPANMDA_EMS in EMC on nexus,
241246
and download ProbAMPANMDA from nexus along with other mechanisms.
242247
compile_mechanisms (bool): should the mod files be copied in the local
@@ -260,10 +265,18 @@ def __init__(
260265
validation_protocols (list of str): name of the protocols to be used for validation
261266
only. E.g. ``["APWaveform_300"]``. These protocols will not be used during
262267
optimisation.
263-
plot_currentscape (bool): during the plotting, should the currentscapes be
264-
plotted for the recordings.
268+
plot_optimisation (bool): legacy parameter, is not used anymore.
269+
plot_optimisation_progress (bool): True to plot the optimisation progress
270+
from checkpoint.
265271
plot_parameter_evolution (bool): during the plotting, should the evolution of the
266272
parameters be plotted.
273+
plot_distributions (bool): True to plot the parameters distributions.
274+
plot_scores (bool): True to plot the scores
275+
plot_traces (bool): True to plot the traces
276+
plot_thumbnail (bool): True to plot a trace that can be used as thumbnail
277+
plot_currentscape (bool): during the plotting, should the currentscapes be
278+
plotted for the recordings.
279+
plot_dendritic_rheobase (bool): True to plot dendritic rheobase (if present)
267280
plot_bAP_EPSP (bool): during the plotting, should ready-to-use back-propagating AP
268281
and EPSP protocols be run and plotted.
269282
Should be True only for pyramidal cells,
@@ -419,7 +432,13 @@ def __init__(
419432
self.name_gene_map = name_gene_map
420433

421434
# Settings specific to the analysis (figure plotting)
422-
self.plot_optimisation = plot_optimisation
435+
self.plot_optimisation_progress = plot_optimisation_progress
436+
self.plot_distributions = plot_distributions
437+
self.plot_scores = plot_scores
438+
self.plot_traces = plot_traces
439+
self.plot_thumbnail = plot_thumbnail
440+
self.plot_dendritic_ISI_CV = plot_dendritic_ISI_CV
441+
self.plot_dendritic_rheobase = plot_dendritic_rheobase
423442
self.plot_currentscape = plot_currentscape
424443
self.currentscape_config = currentscape_config
425444
self.plot_parameter_evolution = plot_parameter_evolution

bluepyemodel/tasks/emodel_creation/optimisation.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -530,8 +530,11 @@ class Validation(WorkflowTaskRequiringMechanisms, IPyParallelTask):
530530
def requires(self):
531531
""" """
532532

533-
plot_optimisation = self.access_point.pipeline_settings.plot_optimisation
534533
compile_mechanisms = self.access_point.pipeline_settings.compile_mechanisms
534+
plot_parameter_evolution = self.access_point.pipeline_settings.plot_parameter_evolution
535+
plot_distributions = self.access_point.pipeline_settings.plot_distributions
536+
plot_traces = self.access_point.pipeline_settings.plot_traces
537+
plot_scores = self.access_point.pipeline_settings.plot_scores
535538

536539
to_run = [
537540
StoreBestModels(
@@ -558,7 +561,7 @@ def requires(self):
558561
)
559562
)
560563

561-
if plot_optimisation:
564+
if any((plot_parameter_evolution, plot_distributions, plot_scores, plot_traces)):
562565
to_run.append(
563566
PlotModels(
564567
emodel=self.emodel,
@@ -1096,21 +1099,6 @@ def requires(self):
10961099
)
10971100
]
10981101

1099-
plot_optimisation = self.access_point.pipeline_settings.plot_optimisation
1100-
1101-
if plot_optimisation:
1102-
to_run.append(
1103-
PlotValidatedDistributions(
1104-
emodel=self.emodel,
1105-
etype=self.etype,
1106-
ttype=self.ttype,
1107-
mtype=self.mtype,
1108-
species=self.species,
1109-
brain_region=self.brain_region,
1110-
iteration_tag=self.iteration_tag,
1111-
)
1112-
)
1113-
11141102
return to_run
11151103

11161104

@@ -1249,7 +1237,13 @@ def requires(self):
12491237
def run(self):
12501238
""" """
12511239

1252-
plot_optimisation = self.access_point.pipeline_settings.plot_optimisation
1240+
plot_parameter_evolution = self.access_point.pipeline_settings.plot_parameter_evolution
1241+
plot_distributions = self.access_point.pipeline_settings.plot_distributions
1242+
plot_traces = self.access_point.pipeline_settings.plot_traces
1243+
plot_scores = self.access_point.pipeline_settings.plot_scores
1244+
plot_thumbnail = self.access_point.pipeline_settings.plot_thumbnail
1245+
plot_dendritic_ISI_CV = self.access_point.pipeline_settings.plot_dendritic_ISI_CV
1246+
plot_dendritic_rheobase = self.access_point.pipeline_settings.plot_dendritic_rheobase
12531247
plot_currentscape = self.access_point.pipeline_settings.plot_currentscape
12541248
plot_bAP_EPSP = self.access_point.pipeline_settings.plot_bAP_EPSP
12551249
plot_IV_curves = self.access_point.pipeline_settings.plot_IV_curves
@@ -1271,13 +1265,13 @@ def run(self):
12711265
figures_dir=Path("./figures") / self.emodel,
12721266
# False because already done in PlotOptimisation task
12731267
plot_optimisation_progress=False,
1274-
plot_parameter_evolution=plot_optimisation,
1275-
plot_distributions=plot_optimisation,
1276-
plot_traces=plot_optimisation,
1277-
plot_scores=plot_optimisation,
1278-
plot_thumbnail=plot_optimisation,
1279-
plot_dendritic_ISI_CV=plot_optimisation,
1280-
plot_dendritic_rheobase=plot_optimisation,
1268+
plot_parameter_evolution=plot_parameter_evolution,
1269+
plot_distributions=plot_distributions,
1270+
plot_traces=plot_traces,
1271+
plot_scores=plot_scores,
1272+
plot_thumbnail=plot_thumbnail,
1273+
plot_dendritic_ISI_CV=plot_dendritic_ISI_CV,
1274+
plot_dendritic_rheobase=plot_dendritic_rheobase,
12811275
plot_currentscape=plot_currentscape,
12821276
plot_bAP_EPSP=plot_bAP_EPSP,
12831277
plot_IV_curve=plot_IV_curves,
@@ -1299,30 +1293,36 @@ def output(self):
12991293
""" """
13001294

13011295
batch_size = self.access_point.pipeline_settings.optimisation_batch_size
1302-
plot_optimisation = self.access_point.pipeline_settings.plot_optimisation
1296+
plot_parameter_evolution = self.access_point.pipeline_settings.plot_parameter_evolution
1297+
plot_distributions = self.access_point.pipeline_settings.plot_distributions
1298+
plot_traces = self.access_point.pipeline_settings.plot_traces
1299+
plot_scores = self.access_point.pipeline_settings.plot_scores
13031300

13041301
outputs = []
1305-
if plot_optimisation:
1302+
if plot_parameter_evolution:
13061303
# parameter evolution
13071304
for seed in range(self.seed, self.seed + batch_size):
13081305
fname = self.access_point.emodel_metadata.as_string(seed=seed)
13091306
fname += "__evo_parameter_density.pdf"
13101307
fpath = Path("./figures") / self.emodel / "parameter_evolution" / fname
13111308
outputs.append(luigi.LocalTarget(fpath))
13121309

1310+
if plot_distributions:
13131311
# distribution
13141312
fname = self.access_point.emodel_metadata.as_string()
13151313
fname += "__parameters_distribution.pdf"
13161314
fpath = Path("./figures") / self.emodel / "distributions" / "all" / fname
13171315
outputs.append(luigi.LocalTarget(fpath))
13181316

1317+
if plot_scores:
13191318
# scores
13201319
for seed in range(self.seed, self.seed + batch_size):
13211320
fname = self.access_point.emodel_metadata.as_string(seed)
13221321
fname += "__scores.pdf"
13231322
fpath = Path("./figures") / self.emodel / "scores" / "all" / fname
13241323
outputs.append(luigi.LocalTarget(fpath))
13251324

1325+
if plot_traces:
13261326
# traces
13271327
for seed in range(self.seed, self.seed + batch_size):
13281328
fname = self.access_point.emodel_metadata.as_string(seed)

0 commit comments

Comments
 (0)