Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix: Fix example #65

Draft
wants to merge 3 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
2 changes: 1 addition & 1 deletion tests/data/config/recipes.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"morphology": "simple.asc",
"params": "config/parameters.json",
"features": "config/features.json",
"morph_modifiers": [],
"morph_modifiers": "",
"pipeline_settings": {
"efel_settings":{
"strict_stiminterval": true,
Expand Down
4 changes: 2 additions & 2 deletions tests/test_access_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def test_get_recipes(access_point):
"morphology": "simple.asc",
"params": "config/parameters.json",
"features": "config/features.json",
"morph_modifiers": [],
"morph_modifiers": "",
"pipeline_settings": {
"efel_settings": {
"strict_stiminterval": True,
Expand All @@ -65,7 +65,7 @@ def test_get_settings(access_point):
"name_rmp_protocol": "IV_0",
"name_Rin_protocol": "IV_-20",
"test": 0,
"morph_modifiers": [],
"morph_modifiers": "",
}


Expand Down
Loading