Skip to content

Commit a08bcd7

Browse files
committed
Update import paths in _inputs.py: change references from brainpy to brainpy.state for consistency
1 parent 95ec203 commit a08bcd7

File tree

2 files changed

+113
-8
lines changed

2 files changed

+113
-8
lines changed

brainpy/state/_inputs.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ class PoissonEncoder(brainstate.nn.Dynamics):
173173
>>> import numpy as np
174174
>>>
175175
>>> # Create a Poisson encoder for 10 neurons
176-
>>> encoder = brainpy.PoissonEncoder(10)
176+
>>> encoder = brainpy.state.PoissonEncoder(10)
177177
>>>
178178
>>> # Generate spikes with varying firing rates
179179
>>> rates = np.array([10, 20, 30, 40, 50, 60, 70, 80, 90, 100]) * u.Hz
@@ -186,7 +186,7 @@ class PoissonEncoder(brainstate.nn.Dynamics):
186186
>>> spike_train = encoder.update(firing_rates)
187187
>>>
188188
>>> # Feed the spikes into a spiking neural network
189-
>>> neuron_layer = brainpy.LIF(10)
189+
>>> neuron_layer = brainpy.state.LIF(10)
190190
>>> neuron_layer.init_state(batch_size=1)
191191
>>> output_spikes = neuron_layer.update(spike_train)
192192
@@ -278,11 +278,11 @@ class PoissonInput(brainstate.nn.Module):
278278
>>> import numpy as np
279279
>>>
280280
>>> # Create a neuron group with membrane potential
281-
>>> neuron = brainpy.LIF(100)
281+
>>> neuron = brainpy.state.LIF(100)
282282
>>> neuron.init_state(batch_size=1)
283283
>>>
284284
>>> # Add Poisson input to all neurons
285-
>>> poisson_in = brainpy.PoissonInput(
285+
>>> poisson_in = brainpy.state.PoissonInput(
286286
... target=neuron.V,
287287
... indices=None,
288288
... num_input=200,
@@ -292,7 +292,7 @@ class PoissonInput(brainstate.nn.Module):
292292
>>>
293293
>>> # Add Poisson input only to specific neurons
294294
>>> indices = np.array([0, 10, 20, 30])
295-
>>> specific_input = brainpy.PoissonInput(
295+
>>> specific_input = brainpy.state.PoissonInput(
296296
... target=neuron.V,
297297
... indices=indices,
298298
... num_input=50,
@@ -421,7 +421,7 @@ def poisson_input(
421421
>>> V = brainstate.HiddenState(np.zeros(100) * u.mV)
422422
>>>
423423
>>> # Add Poisson input to all neurons at 50 Hz
424-
>>> brainpy.poisson_input(
424+
>>> brainpy.state.poisson_input(
425425
... freq=50 * u.Hz,
426426
... num_input=200,
427427
... weight=0.1 * u.mV,
@@ -430,7 +430,7 @@ def poisson_input(
430430
>>>
431431
>>> # Apply Poisson input only to a subset of neurons
432432
>>> indices = np.array([0, 10, 20, 30])
433-
>>> brainpy.poisson_input(
433+
>>> brainpy.state.poisson_input(
434434
... freq=100 * u.Hz,
435435
... num_input=50,
436436
... weight=0.2 * u.mV,
@@ -441,7 +441,7 @@ def poisson_input(
441441
>>> # Apply input with refractory mask
442442
>>> refractory = np.zeros(100, dtype=bool)
443443
>>> refractory[40:60] = True # neurons 40-59 are in refractory period
444-
>>> brainpy.poisson_input(
444+
>>> brainpy.state.poisson_input(
445445
... freq=75 * u.Hz,
446446
... num_input=100,
447447
... weight=0.15 * u.mV,

changelog.md

Lines changed: 105 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,110 @@
11
# Changelog
22

3+
## Version 2.7.1
4+
5+
**Release Date:** October 2025
6+
7+
This is a feature release that introduces new neuron and synapse models in the state-based API (`brainpy.state`) and enhances the Dynamics base class with improved input handling.
8+
9+
### Major Changes
10+
11+
#### New Neuron Models (brainpy.state)
12+
- **LIF (Leaky Integrate-and-Fire) Variants**: Added comprehensive set of LIF neuron models
13+
- `LIF`: Basic LIF neuron with exponential synaptic input
14+
- `LifRef`: LIF with refractory period
15+
- `ExpIF`: Exponential Integrate-and-Fire neuron
16+
- `ExpIFRef`: ExpIF with refractory period
17+
- `AdExIF`: Adaptive Exponential Integrate-and-Fire neuron
18+
- `AdExIFRef`: AdExIF with refractory period
19+
- `QuaIF`: Quadratic Integrate-and-Fire neuron
20+
- `QuaIFRef`: QuaIF with refractory period
21+
- `AdQuaIF`: Adaptive Quadratic Integrate-and-Fire neuron
22+
- `AdQuaIFRef`: AdQuaIF with refractory period
23+
- `GifRef`: Generalized Integrate-and-Fire with refractory period
24+
25+
- **Izhikevich Neuron Models**: Added new Izhikevich neuron implementations
26+
- `Izhikevich`: Basic Izhikevich neuron model
27+
- `IzhikevichRef`: Izhikevich with refractory period
28+
29+
- **Hodgkin-Huxley Model**: Added classic biophysical neuron model
30+
- `HH`: Classic Hodgkin-Huxley model with Na+ and K+ channels
31+
32+
#### New Synapse Models (brainpy.state)
33+
- **BioNMDA**: Biological NMDA receptor with second-order kinetics
34+
- Implements two-state cascade dynamics (x and g variables)
35+
- Slower rise time compared to AMPA (biologically realistic)
36+
- Comprehensive documentation with mathematical formulation
37+
38+
### Features
39+
40+
#### Model Implementation
41+
- All new models use the brainstate ecosystem (HiddenState, ShortTermState, LongTermState)
42+
- Proper unit support with brainunit integration
43+
- Exponential Euler integration for numerical stability
44+
- Batch processing support across all models
45+
- Consistent API design following BrainPy v2.7+ architecture
46+
47+
#### Dynamics Class Enhancements
48+
- Enhanced input handling capabilities in the Dynamics base class
49+
- Added new properties for better state management
50+
- Improved integration with brainstate framework
51+
- Refactored to use public methods instead of private counterparts for clarity
52+
53+
#### Documentation
54+
- Added comprehensive Examples sections to all neuron classes in `_lif.py`
55+
- Each example includes:
56+
- Import statements for required modules
57+
- Basic usage with parameter specifications
58+
- State initialization examples
59+
- Update and spike generation examples
60+
- Network integration with `brainstate.nn.Sequential`
61+
- Notes highlighting key features
62+
- All 13 neuron classes in `_lif.py` now have complete documentation
63+
- Simplified documentation paths by removing 'core-concepts' and 'quickstart' prefixes in index.rst
64+
65+
### Bug Fixes
66+
- Fixed import paths in `_base.py`: changed references from brainstate to brainpy for consistency (057b872d)
67+
- Fixed test suite issues (95ec2037)
68+
- Fixed test suite for proper unit handling in synapse models
69+
70+
### Code Quality
71+
- Refactored module assignments to `brainpy.state` for consistency across files (06b2bf4d)
72+
- Refactored method calls in `_base.py`: replaced private methods with public counterparts (210426ab)
73+
74+
### Testing
75+
- Added comprehensive test suites for all new neuron models
76+
- Added AMPA and GABAa synapse tests
77+
- Added tests for Izhikevich neuron variants
78+
- Added tests for Hodgkin-Huxley model
79+
- All tests passing with proper unit handling
80+
81+
### Files Modified
82+
- `brainpy/__init__.py`: Updated version to 2.7.1
83+
- `brainpy/state/_base.py`: Enhanced Dynamics class with improved input handling (447 lines added)
84+
- `brainpy/state/_lif.py`: Added extensive LIF neuron variants (1862 lines total)
85+
- `brainpy/state/_izhikevich.py`: New file with Izhikevich models (407 lines)
86+
- `brainpy/state/_hh.py`: New file with Hodgkin-Huxley model (666 lines)
87+
- `brainpy/state/_synapse.py`: Added BioNMDA model (158 lines)
88+
- `brainpy/state/_projection.py`: Updated for consistency (43 lines modified)
89+
- `brainpy/state/__init__.py`: Updated exports for new models
90+
- Test files added: `_lif_test.py`, `_izhikevich_test.py`, `_hh_test.py`, `_synapse_test.py`, `_base_test.py`
91+
- Documentation updates in `docs_state/index.rst`
92+
93+
### Removed
94+
- Removed outdated documentation notebooks from `docs_state/`:
95+
- `checkpointing-en.ipynb` and `checkpointing-zh.ipynb`
96+
- `snn_simulation-en.ipynb` and `snn_simulation-zh.ipynb`
97+
- `snn_training-en.ipynb` and `snn_training-zh.ipynb`
98+
99+
### Notes
100+
- This release significantly expands the `brainpy.state` module with biologically realistic neuron and synapse models
101+
- All new models are fully compatible with the brainstate ecosystem
102+
- Enhanced documentation provides clear usage examples for all models
103+
- The Dynamics class refactoring improves the foundation for future state-based model development
104+
105+
106+
107+
3108
## Version 3.0.1
4109

5110
**Release Date:** October 2025

0 commit comments

Comments
 (0)