-
Notifications
You must be signed in to change notification settings - Fork 30
/
test_cell_analysis.py
53 lines (43 loc) · 1.88 KB
/
test_cell_analysis.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
#!/usr/bin/env python3
"""
Test cell analysis module
File:
Copyright 2023 NeuroML contributors
"""
import unittest
import pathlib
import neuroml
from pyneuroml.analysis import generate_current_vs_frequency_curve
class TestCellAnalysis(unittest.TestCase):
"""Test cell analysis module"""
def test_cell_analysis(self):
"""Test analyse_point_neuron"""
doc = neuroml.Izhikevich2007Cell.component_factory("NeuroMLDocument",
id="test")
doc.add(
"Izhikevich2007Cell",
id="izh2007RS0",
v0="-60mV",
C="100pF",
k="0.7nS_per_mV",
vr="-60mV",
vt="-40mV",
vpeak="35mV",
a="0.03per_ms",
b="-2nS",
c="-50.0mV",
d="100pA",
)
neuroml.writers.NeuroMLWriter.write(doc, "tests/analysis/test_cell_analysis.cell.nml")
generate_current_vs_frequency_curve("tests/analysis/test_cell_analysis.cell.nml",
"izh2007RS0",
plot_voltage_traces=True,
plot_iv=True,
show_plot_already=False,
save_voltage_traces_to="tests/analysis/test_analysis_traces.png",
save_if_figure_to="tests/analysis/test_analysis_if.png",
save_iv_figure_to="tests/analysis/test_analysis_iv.png"
)
self.assertTrue(pathlib.Path("tests/analysis/test_analysis_traces.png").is_file())
self.assertTrue(pathlib.Path("tests/analysis/test_analysis_if.png").is_file())
self.assertTrue(pathlib.Path("tests/analysis/test_analysis_iv.png").is_file())