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 no spike case when expected #57

Merged
merged 4 commits into from
Oct 14, 2024
Merged
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
3 changes: 1 addition & 2 deletions emodel_generalisation/bluecellulab_evaluator.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ def calculate_rmp_and_rin(cell, config):

if features["spike_count"] > 0:
logger.warning("SPIKES! %s, %s", rmp, rin)
return 0.0, -1.0
return 0.0, 0.0
return rmp, rin


Expand Down Expand Up @@ -281,7 +281,6 @@ def evaluate_currents(
new_columns = [["resting_potential", 0.0], ["input_resistance", 0.0]]
if not only_rin:
new_columns += [["holding_current", 0.0], ["threshold_current", 0.0]]

return evaluate(
morphs_combos_df,
_isolated_current_evaluation,
Expand Down
5 changes: 4 additions & 1 deletion emodel_generalisation/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,10 +572,13 @@ def assign(input_node_path, population_name, output_node_path, config_path, loca
recipe = access_point.recipes[emodel]
emodel_mappings[recipe["region"]][recipe["etype"]][recipe["mtype"]] = emodel

regions = list(emodel_mappings.keys())

def assign_emodel(row):
"""Get emodel name to use in pandas .apply."""
try:
return "hoc:" + emodel_mappings[row["region"]][row["etype"]][row["mtype"]]
region = [r for r in regions if r in row["region"]][0]
return "hoc:" + emodel_mappings[region][row["etype"]][row["mtype"]]
except KeyError:
return "hoc:no_emodel"

Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,12 +201,12 @@ def test_adapt(cli_runner, tmpdir):
)
npt.assert_allclose(
df["@dynamics:input_resistance"].to_list(),
[-1.0, -1.0], # we get spikes at rest
[0.0, 0.0], # we get spikes at rest
rtol=1e-5,
)
npt.assert_allclose(
df["@dynamics:holding_current"].to_list(),
[-0.064316, -0.081205],
[-0.064313, -0.081205],
rtol=1e-5,
)
npt.assert_allclose(
Expand Down
Loading