Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61271000
__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
Sun, May 5, 15:01
Size
1 KB
Mime Type
text/x-python
Expires
Tue, May 7, 15:01 (1 d, 23 h)
Engine
blob
Format
Raw Data
Handle
17488325
Attached To
R4670 PySONIC (old)
__init__.py
View Options
# -*- coding: utf-8 -*-
# @Author: Theo Lemaire
# @Email: theo.lemaire@epfl.ch
# @Date: 2017-06-06 13:36:00
# @Last Modified by: Theo Lemaire
# @Last Modified time: 2019-06-13 13:39:38
import
inspect
import
sys
from
.lookups
import
*
from
.template
import
TemplateNeuron
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
hasattr
(
obj
,
'name'
)
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