Skip to content

Commit

Permalink
MAINT: monkeypatch Exp2Syn
Browse files Browse the repository at this point in the history
  • Loading branch information
jasmainak committed Aug 26, 2020
1 parent 4ca7f42 commit f5c8911
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
12 changes: 6 additions & 6 deletions hnn_core/basket.py
Expand Up @@ -50,13 +50,13 @@ def __set_props(self, cell_name, pos):
# creation of synapses
def _synapse_create(self):
# creates synapses onto this cell
self.synapses['soma_ampa'] = self.syn_create(0.5, e=0., tau1=0.5,
tau2=5.)
self.synapses['soma_gabaa'] = self.syn_create(0.5, e=-80, tau1=0.5,
tau2=5.)
self.synapses['soma_ampa'] = self.syn_create(
self.soma(0.5), e=0., tau1=0.5, tau2=5.)
self.synapses['soma_gabaa'] = self.syn_create(
self.soma(0.5), e=-80, tau1=0.5, tau2=5.)
# this is a pretty fast NMDA, no?
self.synapses['soma_nmda'] = self.syn_create(0.5, e=0., tau1=1.,
tau2=20.)
self.synapses['soma_nmda'] = self.syn_create(
self.soma(0.5), e=0., tau1=1., tau2=20.)

# this function might make more sense as a method of net?
# par: receive from external inputs
Expand Down
5 changes: 4 additions & 1 deletion hnn_core/cell.py
Expand Up @@ -4,7 +4,7 @@
# Sam Neymotin <samnemo@gmail.com>

import numpy as np
from neuron import h
from neuron import h, nrn

# global variables, should be node-independent
h("dp_total_L2 = 0.")
Expand Down Expand Up @@ -324,6 +324,9 @@ def syn_create(self, secloc, e, tau1, tau2):
syn : instance of h.Exp2Syn
A two state kinetic scheme synapse.
"""
if not isinstance(secloc, nrn.Segment):
raise TypeError(f'secloc must be instance of'
f'nrn.Segment. Got {type(secloc)}')
syn = h.Exp2Syn(secloc)
syn.e = e
syn.tau1 = tau1
Expand Down
10 changes: 9 additions & 1 deletion hnn_core/tests/test_cell.py
@@ -1,10 +1,12 @@
import pytest

import matplotlib
import os.path as op

import hnn_core
from hnn_core import read_params, Network
from hnn_core.neuron import NeuronNetwork
from hnn_core.cell import _ArtificialCell
from hnn_core.cell import _ArtificialCell, _Cell

matplotlib.use('agg')

Expand All @@ -19,6 +21,12 @@ def test_cell():
with NeuronNetwork(net) as neuron_net:
neuron_net.cells[0].plot_voltage()

soma_props = {"L": 22.1, "diam": 23.4, "cm": 0.6195, "Ra": 200.0,
"pos": (0., 0., 0.), 'name': 'test_cell'}
cell = _Cell(gid=1, soma_props=soma_props)
with pytest.raises(TypeError, match='secloc must be instance of'):
cell.syn_create(0.5, e=0., tau1=0.5, tau2=5.)


def test_artificial_cell():
"""Test artificial cell object."""
Expand Down

0 comments on commit f5c8911

Please sign in to comment.