Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F85147759
__init__.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Fri, Sep 27, 02:45
Size
1 KB
Mime Type
text/x-python
Expires
Sun, Sep 29, 02:45 (2 d)
Engine
blob
Format
Raw Data
Handle
21134934
Attached To
R4670 PySONIC (old)
__init__.py
View Options
#!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Theo Lemaire
# @Date: 2017-06-06 13:36:00
# @Email: theo.lemaire@epfl.ch
# @Last Modified by: Theo Lemaire
# @Last Modified time: 2019-06-06 15:02:07
import
inspect
import
sys
from
.cortical
import
CorticalRS
,
CorticalFS
,
CorticalLTS
,
CorticalIB
from
.thalamic
import
ThalamicRE
,
ThalamoCortical
from
.leech
import
LeechTouch
,
LeechPressure
,
LeechRetzius
from
.stn
import
OtsukaSTN
from
.fh
import
FrankenhaeuserHuxley
def
getNeuronsDict
():
''' Construct a dictionary of all the implemented point neuron classes, indexed by name. '''
current_module
=
sys
.
modules
[
__name__
]
neurons_dict
=
{}
for
_
,
obj
in
inspect
.
getmembers
(
current_module
):
if
inspect
.
isclass
(
obj
)
and
isinstance
(
obj
.
name
,
str
):
neurons_dict
[
obj
.
name
]
=
obj
return
neurons_dict
def
getPointNeuron
(
name
):
''' Return a point-neuron instance corresponding to a given name. '''
neuron_classes
=
getNeuronsDict
()
try
:
return
neuron_classes
[
name
]()
except
KeyError
:
raise
ValueError
(
'"{}" neuron not found. Implemented neurons are: {}'
.
format
(
name
,
', '
.
join
(
list
(
neuron_classes
.
keys
()))))
Event Timeline
Log In to Comment