Skip to content

Commit 59ad18c

Browse files
authored
[dyn] add reduce models, HH-type models and channels (#408)
[dyn] add reduce models, HH-type models and channels
2 parents d5e7655 + 4482756 commit 59ad18c

File tree

25 files changed

+3011
-58
lines changed

25 files changed

+3011
-58
lines changed

brainpy/_src/__init__.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +0,0 @@
1-
# -*- coding: utf-8 -*-

brainpy/_src/channels/__init__.py

Lines changed: 0 additions & 25 deletions
This file was deleted.

brainpy/_src/dyn/_docs.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
has_ref_var: bool. Whether has the refractory variable. Default is ``False``.
1919
'''.strip()
2020

21+
if_doc = '''
22+
V_rest: float, ArrayType, callable. Resting membrane potential.
23+
R: float, ArrayType, callable. Membrane resistance.
24+
tau: float, ArrayType, callable. Membrane time constant.
25+
V_initializer: ArrayType, callable. The initializer of membrane potential.
26+
'''.strip()
27+
2128
lif_doc = '''
2229
V_rest: float, ArrayType, callable. Resting membrane potential.
2330
V_reset: float, ArrayType, callable. Reset potential after spike.

brainpy/_src/dyn/base.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ def __init__(
2828
keep_size: bool = False,
2929
mode: bm.Mode = None,
3030
name: str = None,
31+
method: str = 'exp_auto'
3132
):
3233
super().__init__(size=size,
3334
mode=mode,
@@ -37,6 +38,9 @@ def __init__(
3738
# axis names for parallelization
3839
self.sharding = sharding
3940

41+
# integration method
42+
self.method = method
43+
4044
# the before- / after-updates used for computing
4145
self.before_updates: Dict[str, Callable] = bm.node_dict()
4246
self.after_updates: Dict[str, Callable] = bm.node_dict()
@@ -109,21 +113,21 @@ def __init__(
109113
keep_size: bool = False,
110114
mode: Optional[bm.Mode] = None,
111115
name: Optional[str] = None,
116+
method: str = 'exp_auto',
112117

113118
spk_fun: Callable = bm.surrogate.InvSquareGrad(),
114119
spk_type: Any = None,
115120
detach_spk: bool = False,
116-
method: str = 'exp_auto',
117121
):
118122
super().__init__(size=size,
119123
mode=mode,
120124
keep_size=keep_size,
121125
name=name,
122-
sharding=sharding)
126+
sharding=sharding,
127+
method=method)
123128

124129
self.spk_fun = is_callable(spk_fun)
125130
self.detach_spk = detach_spk
126-
self.method = method
127131
self._spk_type = spk_type
128132

129133
@property
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# -*- coding: utf-8 -*-
2+
3+
"""
4+
5+
Access through ``brainpy.channels``.
6+
"""
7+
8+
from . import base, Ca, IH, K, Na, KCa, leaky
9+
10+
__all__ = []
11+
__all__ += base.__all__
12+
__all__ += K.__all__
13+
__all__ += Na.__all__
14+
__all__ += Ca.__all__
15+
__all__ += IH.__all__
16+
__all__ += KCa.__all__
17+
__all__ += leaky.__all__
18+
19+
from .base import *
20+
from .K import *
21+
from .Na import *
22+
from .IH import *
23+
from .Ca import *
24+
from .KCa import *
25+
from .leaky import *

0 commit comments

Comments
 (0)