Skip to content

Commit

Permalink
Fix: Fix example
Browse files Browse the repository at this point in the history
  • Loading branch information
arnaudon committed Nov 6, 2024
1 parent 88bf381 commit 7251a9c
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 18 deletions.
33 changes: 17 additions & 16 deletions emodel_generalisation/model/evaluation.py
Original file line number Diff line number Diff line change
Expand Up @@ -240,22 +240,23 @@ def _define_morphology(
Returns:
bluepyopt.ephys.morphologies.NrnFileMorphology: a morphology object
"""
if not morph_modifiers or morph_modifiers is None:
morph_modifiers = [modifiers.replace_axon_with_taper]
logger.debug("No morphology modifiers provided, replace_axon_with_taper will be used.")
else:
if isinstance(morph_modifiers, str):
morph_modifiers = [morph_modifiers]
for i, morph_modifier in enumerate(morph_modifiers):
if isinstance(morph_modifier, list):
modifier_module = importlib.import_module(morph_modifier[0])
morph_modifiers[i] = getattr(modifier_module, morph_modifier[1])
elif isinstance(morph_modifier, str):
morph_modifiers[i] = getattr(modifiers, morph_modifier)
elif not callable(morph_modifier):
raise TypeError(
"A morph modifier is not callable nor a string nor a list of two str"
)
if morph_modifiers != []:
if not morph_modifiers or morph_modifiers is None:
morph_modifiers = [modifiers.replace_axon_with_taper]
logger.debug("No morphology modifiers provided, replace_axon_with_taper will be used.")
else:
if isinstance(morph_modifiers, str):
morph_modifiers = [morph_modifiers]
for i, morph_modifier in enumerate(morph_modifiers):
if isinstance(morph_modifier, list):
modifier_module = importlib.import_module(morph_modifier[0])
morph_modifiers[i] = getattr(modifier_module, morph_modifier[1])
elif isinstance(morph_modifier, str):
morph_modifiers[i] = getattr(modifiers, morph_modifier)
elif not callable(morph_modifier):
raise TypeError(
"A morph modifier is not callable nor a string nor a list of two str"
)
return NrnFileMorphology(
morphology_path=model_configuration.morphology.path,
do_replace_axon=False,
Expand Down
2 changes: 1 addition & 1 deletion examples/mcmc/mcmc_singlecomp/plot_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import matplotlib.pyplot as plt

from emodel_generalisation.information import plot_corner
from emodel_generalisation.mcmc import plot_corner
from emodel_generalisation.mcmc import load_chains
from emodel_generalisation.mcmc import plot_cost
from emodel_generalisation.mcmc import plot_cost_convergence
Expand Down
2 changes: 1 addition & 1 deletion examples/mcmc/mcmc_singlecomp/run.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
"""Run MCMC on a simple single compartment model."""
from emodel_generalisation.mcmc import run_several_chains
from emodel_generalisation.parallel import init_parallel_factory
from bluepyparallel import init_parallel_factory

if __name__ == "__main__":
parallel_factory = init_parallel_factory("multiprocessing")
Expand Down

0 comments on commit 7251a9c

Please sign in to comment.