Skip to content

Commit

Permalink
Merge pull request #105 from BlueBrain/images-readme
Browse files Browse the repository at this point in the history
use raw version of image in readme to make it fetchable in PyPi
  • Loading branch information
AurelienJaquier authored Jul 16, 2024
2 parents 3f7ef23 + 490bbeb commit a60e9b3
Show file tree
Hide file tree
Showing 9 changed files with 53 additions and 32 deletions.
2 changes: 1 addition & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ Copyright (c) 2020-2022 Blue Brain Project/EPFL
:target: https://pypi.org/project/EModelRunner/
:alt: Latest Release

.. |GUI_screenshot| image:: doc/source/images/GUI_screenshot.png
.. |GUI_screenshot| image:: https://raw.githubusercontent.com/BlueBrain/EModelRunner/main/doc/source/images/GUI_screenshot.png

.. |banner| image:: https://raw.githubusercontent.com/BlueBrain/EModelRunner/main/doc/source/logo/BBP-eModelRunner.jpg

Expand Down
4 changes: 4 additions & 0 deletions doc/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,10 @@
# to be able to put multiple return variables in the docstrings
# napoleon_custom_sections = [("Returns", "params_style")]

suppress_warnings = [
'autosummary.import_cycle',
]


# -- Options for HTML output -------------------------------------------------

Expand Down
3 changes: 1 addition & 2 deletions emodelrunner/create_hoc_tools.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,8 +227,7 @@ def get_step_hoc(self, prot):
if isinstance(step_definitions, dict):
step_definitions = [step_definitions]
for i, step in enumerate(step_definitions):
if i + 1 > self.max_steps:
self.max_steps = i + 1
self.max_steps = max(self.max_steps, i + 1)

if step["amp"] is None:
amp = f"{step['thresh_perc'] / 100.} * threshold_current"
Expand Down
22 changes: 13 additions & 9 deletions emodelrunner/factsheets/ion_channel_mechanisms.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,26 @@ def get_channel_and_equations(
elif len(split_name) == 2:
biophys = split_name[0]
channel = split_name[1]
else:
raise ValueError(
f"Could not extract channel and parameter name from name {name}"
)

# type
if "dist" in param_config:
if param_config["dist"] == "exp":
type_ = "exponential"
value = exp_fun.format(distance="x", value=value)
latex, plot = edit_dist_func(value)
elif param_config["dist"] == "decay":
if param_config["dist"] == "decay":
type_ = "decay"
value = decay_fun.format(distance="x", value=value, constant=decay_cst)
latex, plot = edit_dist_func(value)
else:
logger.warning(
"dist is set to %s. Expected 'exp' or 'decay'. Set type to exponential anyway.",
param_config["dist"],
)
type_ = "exponential"
value = exp_fun.format(distance="x", value=value)
latex, plot = edit_dist_func(value)
if param_config["dist"] != "exp":
logger.warning(
"dist is set to %s. Expected 'exp' or 'decay'. Set type to exponential anyway.",
param_config["dist"],
)
else:
type_ = "uniform"
latex = value
Expand Down
11 changes: 10 additions & 1 deletion emodelrunner/protocols/thalamus_protocols.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,7 +311,6 @@ def run(self, cell_model, param_values, sim, rmp=None):
rin_noholding = self.rin_efeature_dep.calculate_feature(
rin_noholding_response
)

elif self.name.endswith("_hyp"):
rin_noholding_protocol = self.create_rin_protocol_hyp(holdi=0)
rin_noholding_response = rin_noholding_protocol.run(
Expand All @@ -320,6 +319,8 @@ def run(self, cell_model, param_values, sim, rmp=None):
rin_noholding = self.rin_efeature_hyp.calculate_feature(
rin_noholding_response
)
else:
raise ValueError("Rin protocol should end with either '_dep' or '_hyp'.")

logger.info("Rin without holdi is %s", rin_noholding)

Expand Down Expand Up @@ -512,6 +513,10 @@ def voltage_base(self, current, cell_model, param_values, sim=None):
)

voltage_base = feature.calculate_feature(response)

else:
raise ValueError("Rin protocol should end with either '_dep' or '_hyp'.")

return voltage_base

def generate_current(self, threshold_current=None, holding_current=None, dt=0.1):
Expand Down Expand Up @@ -709,6 +714,10 @@ def detect_spike(
exp_mean=1,
exp_std=0.1,
)
else:
raise ValueError(
"Threshold detection protocol should end with either '_dep' or '_hyp'."
)

spike_count = feature.calculate_feature(response)
logger.debug("%s spikes with I = %s", spike_count, step_current)
Expand Down
2 changes: 1 addition & 1 deletion emodelrunner/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def main(config_path):
config_path (str): path to config file
The config file should have '.ini' suffix
"""
# pylint: disable=too-many-locals
# pylint: disable=too-many-locals, possibly-used-before-assignment
config = load_config(config_path=config_path)

cell = create_cell_using_config(config)
Expand Down
5 changes: 5 additions & 0 deletions emodelrunner/synapses/mechanism.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ def get_cell_section_for_synapse(synapse, icell):
section = icell.apic[synapse["sectionlist_index"]]
elif synapse["sectionlist_id"] == 3:
section = icell.axon[synapse["sectionlist_index"]]
else:
raise ValueError(
f"Unrecognized sectionlist_id: {synapse['sectionlist_id']}. "
"Should be 0, 1,, 2 or 3."
)

return section

Expand Down
8 changes: 4 additions & 4 deletions tests/unit_tests/data/hippocampus_morphometrics.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
},
{
"name": "average diameter, all",
"value": 0.539696595209174,
"value": 0.5396965962874053,
"unit": "\u00b5m"
},
{
Expand Down Expand Up @@ -93,7 +93,7 @@
},
{
"name": "average diameter, axon",
"value": 0.39878087863997674,
"value": 0.3987808603270087,
"unit": "\u00b5m"
},
{
Expand Down Expand Up @@ -153,7 +153,7 @@
},
{
"name": "average diameter, apical",
"value": 0.922797184065503,
"value": 0.9227971437728758,
"unit": "\u00b5m"
},
{
Expand Down Expand Up @@ -213,7 +213,7 @@
},
{
"name": "average diameter, basal",
"value": 0.678468805386857,
"value": 0.6784688144013714,
"unit": "\u00b5m"
},
{
Expand Down
28 changes: 14 additions & 14 deletions tests/unit_tests/test_morphology_features.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ def test_thalamus_morphology_factsheet_builder():

def test_average_diameter():
"""Test average diameter feature."""
morphology = nm.load_neuron(test_morph)
morphology = nm.load_morphology(test_morph)
feature = morphology_features.AverageDiameter(
morphology, "basal_dendrite", NeuriteType.basal_dendrite
)
Expand All @@ -90,7 +90,7 @@ def test_average_diameter():

def test_total_length():
"""Test total length morphology feature."""
morphology = nm.load_neuron(test_morph)
morphology = nm.load_morphology(test_morph)
feature = morphology_features.TotalLength(morphology, "axon", NeuriteType.axon)
feature_dict = feature.to_dict()
assert feature_dict["name"] == "total length, axon"
Expand All @@ -100,7 +100,7 @@ def test_total_length():

def test_total_height():
"""Test total height feature."""
morphology = nm.load_neuron(test_morph)
morphology = nm.load_morphology(test_morph)
feature = morphology_features.TotalHeight(morphology, "axon", NeuriteType.axon)
feature_dict = feature.to_dict()
assert feature_dict["name"] == "total height, axon"
Expand All @@ -110,7 +110,7 @@ def test_total_height():

def test_total_width():
"""Test total width feature."""
morphology = nm.load_neuron(test_morph)
morphology = nm.load_morphology(test_morph)
feature = morphology_features.TotalWidth(morphology, "axon", NeuriteType.axon)
feature_dict = feature.to_dict()
assert feature_dict["name"] == "total width, axon"
Expand All @@ -120,7 +120,7 @@ def test_total_width():

def test_total_depth():
"""Test total depth feature."""
morphology = nm.load_neuron(test_morph)
morphology = nm.load_morphology(test_morph)
feature = morphology_features.TotalDepth(morphology, "axon", NeuriteType.axon)
feature_dict = feature.to_dict()
assert feature_dict["name"] == "total depth, axon"
Expand All @@ -130,7 +130,7 @@ def test_total_depth():

def test_total_area():
"""Test the total area feature."""
morphology = nm.load_neuron(test_morph)
morphology = nm.load_morphology(test_morph)
feature = morphology_features.TotalArea(morphology, "axon", NeuriteType.axon)
feature_dict = feature.to_dict()
assert feature_dict["name"] == "total area, axon"
Expand All @@ -140,7 +140,7 @@ def test_total_area():

def test_total_volume():
"""Test the total volume feature."""
morphology = nm.load_neuron(test_morph)
morphology = nm.load_morphology(test_morph)
feature = morphology_features.TotalVolume(morphology, "axon", NeuriteType.axon)
feature_dict = feature.to_dict()
assert feature_dict["name"] == "total volume, axon"
Expand All @@ -150,7 +150,7 @@ def test_total_volume():

def test_number_of_sections():
"""Test number of sections feature."""
morphology = nm.load_neuron(test_morph)
morphology = nm.load_morphology(test_morph)
feature = morphology_features.NumberOfSections(
morphology, "basal_dendrite", NeuriteType.basal_dendrite
)
Expand All @@ -162,7 +162,7 @@ def test_number_of_sections():

def test_mean_neurite_volumes():
"""Test neurite volumes feature."""
morphology = nm.load_neuron(test_morph)
morphology = nm.load_morphology(test_morph)
feature = morphology_features.MeanNeuriteVolumes(
morphology, "axon", NeuriteType.axon
)
Expand All @@ -174,7 +174,7 @@ def test_mean_neurite_volumes():

def test_max_branch_order():
"""Test max branch order feature."""
morphology = nm.load_neuron(test_morph)
morphology = nm.load_morphology(test_morph)
feature = morphology_features.MaxBranchOrder(
morphology, "apical_dendrite", NeuriteType.apical_dendrite
)
Expand All @@ -186,7 +186,7 @@ def test_max_branch_order():

def test_max_section_length():
"""Test max section length feature."""
morphology = nm.load_neuron(test_morph)
morphology = nm.load_morphology(test_morph)
feature = morphology_features.MaxSectionLength(
morphology, "basal_dendrite", NeuriteType.basal_dendrite
)
Expand All @@ -198,7 +198,7 @@ def test_max_section_length():

def test_soma_diameter():
"""Test the some diameter feature."""
morphology = nm.load_neuron(test_morph)
morphology = nm.load_morphology(test_morph)
feature = morphology_features.SomaDiamater(morphology)
feature_dict = feature.to_dict()
assert feature_dict["name"] == "soma diameter"
Expand All @@ -208,7 +208,7 @@ def test_soma_diameter():

def test_soma_surface_area():
"""Test the soma surface area feature."""
morphology = nm.load_neuron(test_morph)
morphology = nm.load_morphology(test_morph)
feature = morphology_features.SomaSurfaceArea(morphology)
feature_dict = feature.to_dict()
assert feature_dict["name"] == "soma surface area"
Expand All @@ -218,7 +218,7 @@ def test_soma_surface_area():

def test_soma_volume():
"""Test the soma volume feature."""
morphology = nm.load_neuron(test_morph)
morphology = nm.load_morphology(test_morph)
feature = morphology_features.SomaVolume(morphology)
feature_dict = feature.to_dict()
assert feature_dict["name"] == "soma volume"
Expand Down

0 comments on commit a60e9b3

Please sign in to comment.