Skip to content

Commit 4174f1a

Browse files
committed
Merge branch 'master' of https://github.com/brainpy/BrainPy
2 parents e8b2938 + dfb6a69 commit 4174f1a

20 files changed

+4235
-252
lines changed

brainpy/dyn/neurons/lif.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -857,6 +857,10 @@ class ExpIF(ExpIFLTC):
857857
conductance-based synaptic drive." Physical Review E 76, no. 2 (2007): 021919.
858858
.. [5] https://en.wikipedia.org/wiki/Exponential_integrate-and-fire
859859
860+
.. seealso::
861+
862+
:class:`brainpy.state.ExpIF` provides the state-based formulation of this neuron.
863+
860864
**Examples**
861865
862866
There is a simple usage example::
@@ -978,6 +982,10 @@ class ExpIFRefLTC(ExpIFLTC):
978982
conductance-based synaptic drive." Physical Review E 76, no. 2 (2007): 021919.
979983
.. [5] https://en.wikipedia.org/wiki/Exponential_integrate-and-fire
980984
985+
.. seealso::
986+
987+
:class:`brainpy.state.ExpIFRef` provides the state-based formulation of this neuron.
988+
981989
**Examples**
982990
983991
There is a simple usage example::
@@ -1319,6 +1327,10 @@ class AdExIFLTC(GradNeuDyn):
13191327
inputs." Journal of Neuroscience 23.37 (2003): 11628-11640.
13201328
.. [2] http://www.scholarpedia.org/article/Adaptive_exponential_integrate-and-fire_model
13211329
1330+
.. seealso::
1331+
1332+
:class:`brainpy.state.AdExIF` provides the state-based formulation of this model.
1333+
13221334
**Examples**
13231335
13241336
An example usage:

brainpy/state/__init__.py

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,12 @@
1818
from ._base import __all__ as base_all
1919
from ._exponential import *
2020
from ._exponential import __all__ as exp_all
21+
from ._hh import *
22+
from ._hh import __all__ as hh_all
2123
from ._inputs import *
2224
from ._inputs import __all__ as inputs_all
25+
from ._izhikevich import *
26+
from ._izhikevich import __all__ as izh_all
2327
from ._lif import *
2428
from ._lif import __all__ as neuron_all
2529
from ._projection import *
@@ -34,13 +38,8 @@
3438
from ._synaptic_projection import __all__ as synproj_all
3539
from ._synouts import *
3640
from ._synouts import __all__ as synout_all
37-
from .. import mixin
3841

39-
__main__ = ['version2', 'mixin'] + inputs_all + neuron_all + readout_all + stp_all + synapse_all
42+
__main__ = inputs_all + neuron_all + izh_all + hh_all + readout_all + stp_all + synapse_all
4043
__main__ = __main__ + synout_all + base_all + exp_all + proj_all + synproj_all
41-
del inputs_all, neuron_all, readout_all, stp_all, synapse_all, synout_all, base_all
44+
del inputs_all, neuron_all, izh_all, hh_all, readout_all, stp_all, synapse_all, synout_all, base_all
4245
del exp_all, proj_all, synproj_all
43-
44-
if __name__ == '__main__':
45-
mixin
46-

brainpy/state/_base.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ def _input_label_repr(name: str, label: Optional[str] = None):
4040

4141

4242
class Dynamics(brainstate.nn.Dynamics):
43+
__module__ = 'brainpy.state'
44+
4345
def __init__(self, in_size: Size, name: Optional[str] = None):
4446
# initialize
4547
super().__init__(name=name, in_size=in_size)
@@ -401,8 +403,8 @@ def align_pre(self, dyn: Union[ParamDescriber[T], T]) -> T:
401403
Examples
402404
--------
403405
>>> import brainstate
404-
>>> n1 = brainstate.nn.LIF(10)
405-
>>> n1.align_pre(brainstate.nn.Expon.desc(n1.varshape)) # n2 will run after n1
406+
>>> n1 = brainpy.state.LIF(10)
407+
>>> n1.align_pre(brainpy.state.Expon.desc(n1.varshape)) # n2 will run after n1
406408
"""
407409
if isinstance(dyn, Dynamics):
408410
self.add_after_update(id(dyn), dyn)
@@ -425,7 +427,7 @@ class Neuron(Dynamics):
425427
Base class for all spiking neuron models.
426428
427429
This abstract class serves as the foundation for implementing various spiking neuron
428-
models in the BrainPy framework. It extends the ``brainstate.nn.Dynamics`` class and
430+
models in the BrainPy framework. It extends the ``brainpy.state.Dynamics`` class and
429431
provides common functionality for spike generation, membrane potential dynamics, and
430432
surrogate gradient handling required for training spiking neural networks.
431433
@@ -595,7 +597,7 @@ class Neuron(Dynamics):
595597
.. [3] Gerstner, W., Kistler, W. M., Naud, R., & Paninski, L. (2014). Neuronal dynamics:
596598
From single neurons to networks and models of cognition. Cambridge University Press.
597599
"""
598-
__module__ = 'brainpy'
600+
__module__ = 'brainpy.state'
599601

600602
def __init__(
601603
self,
@@ -849,4 +851,4 @@ class Synapse(Dynamics):
849851
.. [3] Gerstner, W., Kistler, W. M., Naud, R., & Paninski, L. (2014). Neuronal dynamics:
850852
From single neurons to networks and models of cognition. Cambridge University Press.
851853
"""
852-
__module__ = 'brainpy'
854+
__module__ = 'brainpy.state'

brainpy/state/_base_test.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ def test_neuron_soft_vs_hard_reset(self):
148148
def test_neuron_module_attribute(self):
149149
"""Test __module__ attribute is correctly set."""
150150
neuron = Neuron(in_size=self.in_size)
151-
self.assertEqual(neuron.__module__, 'brainpy')
151+
self.assertEqual(neuron.__module__, 'brainpy.state')
152152

153153

154154
class TestSynapseBaseClass(unittest.TestCase):
@@ -247,7 +247,7 @@ def update(self, x=None):
247247
def test_synapse_module_attribute(self):
248248
"""Test __module__ attribute is correctly set."""
249249
synapse = Synapse(in_size=self.in_size)
250-
self.assertEqual(synapse.__module__, 'brainpy')
250+
self.assertEqual(synapse.__module__, 'brainpy.state')
251251

252252
def test_synapse_varshape_attribute(self):
253253
"""Test varshape attribute is correctly set."""

brainpy/state/_exponential.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class Expon(Synapse, AlignPost):
7171
where synaptic variables are aligned with post-synaptic neurons, enabling event-driven
7272
computation and more efficient handling of sparse connectivity patterns.
7373
"""
74-
__module__ = 'brainpy'
74+
__module__ = 'brainpy.state'
7575

7676
def __init__(
7777
self,
@@ -156,7 +156,7 @@ class DualExpon(Synapse, AlignPost):
156156
where synaptic variables are aligned with post-synaptic neurons, enabling event-driven
157157
computation and more efficient handling of sparse connectivity patterns.
158158
"""
159-
__module__ = 'brainpy'
159+
__module__ = 'brainpy.state'
160160

161161
def __init__(
162162
self,

0 commit comments

Comments
 (0)