Skip to content
Open
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: 3 additions & 0 deletions src/neat/trees/phystree.py
Original file line number Diff line number Diff line change
Expand Up @@ -557,6 +557,7 @@ def set_physiology(self, c_m_distr, r_a_distr, g_s_distr=None, node_arg=None):
if g_s_distr is not None
else 0.0
)
assert int(np.sign(g_s)) != -1
node.set_physiology(c_m, r_a, g_s)

@comptree_removal_decorator
Expand Down Expand Up @@ -588,6 +589,7 @@ def set_leak_current(self, g_l_distr, e_l_distr, node_arg=None):
for node in self.convert_node_arg_to_nodes(node_arg):
g_l = self._distr2Float(g_l_distr, node, argname="`g_l_distr`")
e_l = self._distr2Float(e_l_distr, node, argname="`e_l_distr`")
assert int(np.sign(g_l)) != -1
node._add_current("L", g_l, e_l)

@comptree_removal_decorator
Expand Down Expand Up @@ -631,6 +633,7 @@ def add_channel_current(self, channel, g_max_distr, e_rev_distr, node_arg=None):
for node in self.convert_node_arg_to_nodes(node_arg):
g_max = self._distr2Float(g_max_distr, node, argname="`g_max_distr`")
e_rev = self._distr2Float(e_rev_distr, node, argname="`e_rev_distr`")
assert int(np.sign(g_max)) != -1
node._add_current(channel_name, g_max, e_rev)

def get_channels_in_tree(self):
Expand Down
6 changes: 6 additions & 0 deletions tests/test_phystree.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,9 @@ def test_physiology_setting(self):
# as wrong type
with pytest.raises(TypeError):
self.tree.set_leak_current([])
# wrong sign
with pytest.raises(AssertionError):
self.tree.set_leak_current(e_l, g_l)

# gmax as potential as float
e_rev = 100.0
Expand Down Expand Up @@ -233,6 +236,9 @@ def test_physiology_setting(self):
# check if error is thrown if an ionchannel is not give
with pytest.raises(IOError):
self.tree.add_channel_current("test_channel2", g_max, e_rev)
# check if error is thrown if an ionchannel is not give
with pytest.raises(AssertionError):
self.tree.add_channel_current(channel, -10.0, e_rev)

def test_membrane_functions(self):
self.load_tree()
Expand Down
Loading