copying to personal repo

This commit is contained in:
Alan
2022-06-19 13:45:53 -05:00
commit bf2ffa7315
287 changed files with 54032 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2e60518d0332cd475f67e13e8f85e23b1b60dda4f252620b495bdfbc5dab43fe
size 7826

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:f0814086d71479adab9326978620e1af0ed153fdfc2c6f4fa0d2213c0b80131b
size 7729

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:5dbd4717983175a81d362bd01015cb28baa145d78c6c460dd7ec6456f9f46e72
size 8103

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:34fbddf52a61283bd29622fe87e1fc8afc6f46160cdce3f0cdd581f89bfeba35
size 7963

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:de245b95e0b1f66680ed1f79bc31739bce36aed9edd044d02b6effbd645e948e
size 8160

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0f7c79982ffa921ba17690de6b31ff27be75936acde0fa72b5d52e0e4abc54da
size 5506

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:de64e933070f7c216d8f632cb56ee32b346bba282c24f453f818c686439b772a
size 8710

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:0e713ac67a7211e4d78c846bd8bdda4b738c49d5c50fb61c1974f12d45341937
size 9506

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e86a6fb8651d0ed0a33e30273d49b8358436bf169899ee9d2bcda454f450225e
size 7747

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:8ebe0523b9260f3b9a87fc6e535f38cb8f0b5840aea056fe8764943883782db7
size 16581

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:a2536a5ca43d2f46fa6e6bf786d520ac12815b742896a3272a227660a91fc2c1
size 7863

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:fa5ddc40011269d7e4d00d70ac3053bd4d2d88293db5f8d6f9ae8225c3ed1bdc
size 8182

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:2990652711db28fa846886f1399faecb4d4680fd8014cbc006636c215248263d
size 14815

View File

@@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:9f50fb610552b181dfd0130245ee41bcbe745d4fc856abfe7f5ad180e84773a5
size 13267

View File

@@ -0,0 +1,227 @@
import os, pickle, pprint
import numpy as np
import neuron
import cnmodel
import cnmodel.cells as cells
from cnmodel.util import UserTester, reset
from cnmodel.protocols import IVCurve
"""
Cell-type tests
"""
def test_bushy():
reset(raiseError=False)
cell = cells.Bushy.create(species="guineapig", modelType="II")
CellTester("bushy_guineapig-typeII", cell)
def test_bushy21():
reset(raiseError=False)
cell = cells.Bushy.create(species="guineapig", modelType="II-I")
CellTester("bushy_guineapig-typeII-I", cell)
def test_bushy_mouse():
reset(raiseError=False)
cell = cells.Bushy.create(species="mouse", modelType="II")
CellTester("bushy-mouse-typeII", cell)
def test_tstellate():
reset(raiseError=False)
cell = cells.TStellate.create(species="guineapig", modelType="I-c")
CellTester("tstellate_guineapig-typeI-c", cell)
def test_tstellate_mouse():
reset(raiseError=False)
cell = cells.TStellate.create(species="mouse", modelType="I-c")
CellTester("tstellate_mouse-typeI-c", cell)
def test_tstellatet():
reset(raiseError=False)
cell = cells.TStellate.create(species="guineapig", modelType="I-t")
CellTester("tstellate_guineapig-typeI-t", cell)
# not implemented yet
# def test_tstellatet_mouse():
# reset(raiseError=False)
# cell = cells.TStellate.create(species='mouse', modelType='I-t')
# CellTester('tstellate_mouse-typeI-t', cell)
def test_dstellate():
reset(raiseError=False)
cell = cells.DStellate.create(species="guineapig", modelType="I-II")
CellTester("dstellate_guineapig-typeI-II", cell)
def test_dstellate_mouse():
reset(raiseError=False)
cell = cells.DStellate.create(species="mouse", modelType="I-II")
CellTester("dstellate_mouse-typeI-II", cell)
def test_octopus():
reset(raiseError=False)
cell = cells.Octopus.create(species="guineapig", modelType="II-o")
CellTester("octopus_guineapig-typeII-o", cell)
def test_pyramidal():
reset(raiseError=False)
cell = cells.Pyramidal.create(species="rat", modelType="I")
CellTester("pyramidal_rat_I", cell)
def test_tuberculoventral():
reset(raiseError=False)
cell = cells.Tuberculoventral.create(species="mouse", modelType="TVmouse")
CellTester("tuberculoventral_mouse_I", cell)
def test_cartwheel():
reset(raiseError=False)
cell = cells.Cartwheel.create(species="mouse", modelType="I")
CellTester("cartwheel_rat_I", cell)
def test_sgc_basal_middle():
reset(raiseError=False)
cell = cells.SGC.create(species="mouse", modelType="bm")
CellTester("SGC_rat_bm", cell)
def test_sgc_apical():
reset(raiseError=False)
cell = cells.SGC.create(species="mouse", modelType="a")
CellTester("SGC_rat_a", cell)
#
# Supporting functions
#
class CellTester(UserTester):
data_dir = "cell_data"
def run_test(self, cell):
# run I/V test on cell
V0 = cell.find_i0(showinfo=True)
rmrintau = cell.compute_rmrintau(auto_initialize=False, vrange=None)
iv = IVCurve()
self.iv = iv
iv.run(cell.i_test_range, cell)
if self.audit:
iv.show(cell)
info = dict(
temp=iv.temp,
icmd=iv.current_cmd,
spikes=iv.spike_times(),
rmp=iv.rest_vm(),
rm_taum=iv.input_resistance_tau(),
vpeak=iv.peak_vm(),
vss=iv.steady_vm(),
rmrintau=rmrintau,
)
return info
def assert_test_info(self, *args, **kwds):
try:
super(CellTester, self).assert_test_info(*args, **kwds)
finally:
if hasattr(self, "iv") and hasattr(self.iv, "win"):
self.iv.win.hide()
# def result_file(key):
# """
# Return a file name to be used for storing / retrieving test results
# given *key*.
# """
# path = os.path.dirname(__file__)
# return os.path.join(path, 'cell_data', key + '.pk')
# def load_cell_info(key):
# """
# Load prior test results for *key*.
# If there are no prior results, return None.
# """
# fn = result_file(key)
# if os.path.isfile(fn):
# return pickle.load(open(fn, 'rb'))
# return None
# def save_cell_info(info, key):
# """
# Store test results for *key*.
# """
# fn = result_file(key)
# dirname = os.path.dirname(fn)
# if not os.path.isdir(dirname):
# os.mkdir(dirname)
# pickle.dump(info, open(fn, 'wb'))
# The following is superseeded by the built in unit tests.
# def CellTester(key):
# """
# Test *cell* and raise exception if the results do not match prior
# data.
# """
# audit = cnmodel.AUDIT_TESTS
## run I/V test on cell
# iv = IVCurve()
# iv.run(cell.i_test_range, cell)
# iv.show(cell)
# try:
# info = dict(
# icmd=iv.current_cmd,
# spikes=iv.spike_times(),
# rmp=iv.rest_vm(),
# rm=iv.input_resistance(),
# vpeak=iv.peak_vm(),
# vss=iv.steady_vm(),
# )
# expect = load_cell_info(key)
# if expect is not None:
## Check test structures are the same
# assert len(info) == len(expect)
# for k in info:
# assert k in expect
## Check data matches
# for k in info:
# if isinstance(info[k], list):
# assert len(info[k]) == len(expect[k])
# for i in range(len(info[k])):
# assert np.allclose(info[k][i], expect[k][i])
# else:
# assert np.allclose(info[k], expect[k])
# else:
# if not audit:
# raise Exception("No prior test results for cell type '%s'. "
# "Run test.py --audit store new test data." % key)
# print "\n=== New test results for %s: ===\n" % key
# pprint.pprint(info)
# print "Store new test results? [y/n]",
# yn = raw_input()
# if yn.lower().startswith('y'):
# save_cell_info(info, key)
# else:
# raise Exception("Rejected test results for '%s'" % key)
# finally:
# iv.win.hide()