Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TST: some basic tests for default cell type
- Loading branch information
Showing
2 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
import pytest | ||
|
||
import matplotlib | ||
from neuron import h | ||
|
||
from hnn_core.cells_default import pyramidal, basket | ||
|
||
from hnn_core.network_builder import load_custom_mechanisms | ||
from hnn_core.cells_default import pyramidal, basket | ||
|
||
|
||
def test_cells_default(): | ||
"""Test default cell objects.""" | ||
load_custom_mechanisms() | ||
|
||
with pytest.raises(ValueError, match='Unknown pyramidal cell type'): | ||
l5p = pyramidal(pos=(0, 0, 0), cell_name='blah') | ||
|
||
l5p = pyramidal(pos=(0, 0, 0), cell_name='L5Pyr') | ||
assert len(l5p.sections) == 9 | ||
assert 'apical_2' in l5p.sections | ||
|
||
# smoke test to check if cell can be used in simulation | ||
h.load_file("stdrun.hoc") | ||
h.tstop = 40 | ||
h.dt = 0.025 | ||
h.celsius = 37 | ||
|
||
vsoma = l5p.rec_v.record(l5p.sections['soma'](0.5)._ref_v) | ||
times = h.Vector().record(h._ref_t) | ||
|
||
stim = h.IClamp(l5p.sections['soma'](0.5)) | ||
stim.delay = 5 | ||
stim.dur = 5. | ||
stim.amp = 2. | ||
|
||
h.finitialize() | ||
h.fcurrent() | ||
h.run() | ||
|
||
times = times.to_python() | ||
vsoma = vsoma.to_python() | ||
assert len(times) == len(vsoma) | ||
|
||
with pytest.raises(ValueError, match='Unknown basket cell type'): | ||
l5p = basket(pos=(0, 0, 0), cell_name='blah') |