Commit dfb6a69
update state neuron and synapse (#794)
* Update version to 2.7.1 and refactor Dynamics class: enhance input handling and add new properties
* Update version to 2.7.1 and refactor Dynamics class: enhance input handling and add new properties
* Add state version implementations for neuron and synapse models
This commit implements state versions of several neuron and synapse models
using the brainstate framework, following BrainPy v2.7+ architecture.
Neuron Models Added:
- LIF (Leaky Integrate-and-Fire) neurons with multiple variants:
* LIF: Basic LIF neuron with exponential synaptic input
* LifRef: LIF with refractory period
* ExpIF: Exponential Integrate-and-Fire
* ExpIFRef: ExpIF with refractory period
* AdExIF: Adaptive Exponential Integrate-and-Fire
* AdExIFRef: AdExIF with refractory period
* QuaIF: Quadratic Integrate-and-Fire
* QuaIFRef: QuaIF with refractory period
* AdQuaIF: Adaptive Quadratic Integrate-and-Fire
* AdQuaIFRef: AdQuaIF with refractory period
* GifRef: Generalized Integrate-and-Fire with refractory
- Izhikevich neuron model with variants:
* Izhikevich: Basic Izhikevich neuron
* IzhikevichRef: With refractory period
- Hodgkin-Huxley (HH) neuron model:
* HH: Classic Hodgkin-Huxley model with Na+ and K+ channels
Synapse Models Added:
- BioNMDA: Biological NMDA receptor with second-order kinetics
* Implements two-state cascade dynamics (x and g variables)
* Slower rise time compared to AMPA (biologically realistic)
* Comprehensive documentation with mathematical formulation
Testing:
- Comprehensive test suites added for all models
- AMPA and GABAa synapse tests added
- All tests passing with proper unit handling
Key Features:
- Uses brainstate ecosystem (HiddenState, ShortTermState, LongTermState)
- Proper unit support with brainunit
- Exponential Euler integration for numerical stability
- Batch processing support
- Consistent API design across all models
Files Modified:
- brainpy/state/_lif.py: Added LIF variants
- brainpy/state/_izhikevich.py: Added Izhikevich variants (new file)
- brainpy/state/_hh.py: Added HH model (new file)
- brainpy/state/_synapse.py: Added BioNMDA model
- brainpy/state/_synapse_test.py: Added comprehensive tests
- brainpy/state/_lif_test.py: Added LIF tests
- brainpy/state/__init__.py: Updated exports
- brainpy/dyn/neurons/lif.py: Minor documentation updates
* Add Examples sections to neuron classes in _lif.py
Added comprehensive Examples sections to 5 neuron classes that were
missing them:
- QuaIF: Quadratic Integrate-and-Fire neuron
- AdQuaIF: Adaptive Quadratic Integrate-and-Fire neuron
- AdQuaIFRef: AdQuaIF with refractory period
- Gif: Generalized Integrate-and-Fire neuron
- GifRef: Gif with refractory period
Each Examples section includes:
- Import statements for required modules
- Basic usage with parameter specifications
- State initialization examples
- Update and spike generation examples
- Network integration with brainstate.nn.Sequential
- Additional Notes highlighting key features
All 13 neuron classes in _lif.py now have complete documentation
with Examples sections following consistent format and style.
* Refactor module assignments to 'brainpy.state' for consistency across files
* Update import paths in _base.py: change references from brainstate to brainpy for consistency
* fix tests
* Update import paths in _inputs.py: change references from brainpy to brainpy.state for consistency
---------
Co-authored-by: Chaoming Wang <adaduo@outlook.com>
Co-authored-by: Chaoming Wang <chao.brain@qq.com>1 parent cd22e00 commit dfb6a69
File tree
20 files changed
+4239
-256
lines changed- brainpy
- dyn/neurons
- state
20 files changed
+4239
-256
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
857 | 857 | | |
858 | 858 | | |
859 | 859 | | |
| 860 | + | |
| 861 | + | |
| 862 | + | |
| 863 | + | |
860 | 864 | | |
861 | 865 | | |
862 | 866 | | |
| |||
978 | 982 | | |
979 | 983 | | |
980 | 984 | | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
981 | 989 | | |
982 | 990 | | |
983 | 991 | | |
| |||
1319 | 1327 | | |
1320 | 1328 | | |
1321 | 1329 | | |
| 1330 | + | |
| 1331 | + | |
| 1332 | + | |
| 1333 | + | |
1322 | 1334 | | |
1323 | 1335 | | |
1324 | 1336 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
| 22 | + | |
21 | 23 | | |
22 | 24 | | |
| 25 | + | |
| 26 | + | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
| |||
34 | 38 | | |
35 | 39 | | |
36 | 40 | | |
37 | | - | |
38 | 41 | | |
39 | | - | |
| 42 | + | |
40 | 43 | | |
41 | | - | |
| 44 | + | |
42 | 45 | | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
40 | 40 | | |
41 | 41 | | |
42 | 42 | | |
| 43 | + | |
| 44 | + | |
43 | 45 | | |
44 | 46 | | |
45 | 47 | | |
| |||
401 | 403 | | |
402 | 404 | | |
403 | 405 | | |
404 | | - | |
405 | | - | |
| 406 | + | |
| 407 | + | |
406 | 408 | | |
407 | 409 | | |
408 | | - | |
| 410 | + | |
409 | 411 | | |
410 | 412 | | |
411 | 413 | | |
412 | 414 | | |
413 | | - | |
414 | | - | |
| 415 | + | |
| 416 | + | |
415 | 417 | | |
416 | 418 | | |
417 | 419 | | |
418 | | - | |
| 420 | + | |
419 | 421 | | |
420 | 422 | | |
421 | 423 | | |
| |||
425 | 427 | | |
426 | 428 | | |
427 | 429 | | |
428 | | - | |
| 430 | + | |
429 | 431 | | |
430 | 432 | | |
431 | 433 | | |
| |||
595 | 597 | | |
596 | 598 | | |
597 | 599 | | |
598 | | - | |
| 600 | + | |
599 | 601 | | |
600 | 602 | | |
601 | 603 | | |
| |||
849 | 851 | | |
850 | 852 | | |
851 | 853 | | |
852 | | - | |
| 854 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
148 | 148 | | |
149 | 149 | | |
150 | 150 | | |
151 | | - | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| |||
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
250 | | - | |
| 250 | + | |
251 | 251 | | |
252 | 252 | | |
253 | 253 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
71 | 71 | | |
72 | 72 | | |
73 | 73 | | |
74 | | - | |
| 74 | + | |
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
| |||
156 | 156 | | |
157 | 157 | | |
158 | 158 | | |
159 | | - | |
| 159 | + | |
160 | 160 | | |
161 | 161 | | |
162 | 162 | | |
| |||
0 commit comments