Skip to content

Commit 5b324eb

Browse files
committed
Refactor neural network classes and update progress bar parameters for simulations
1 parent da2f4ac commit 5b324eb

11 files changed

+90
-20
lines changed

docs_classic/index.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,14 @@ Learn more
123123

124124
----
125125

126+
See also the ecosystem
127+
^^^^^^^^^^^^^^^^^^^^^^
128+
129+
``brainpy`` is one part of our `brain simulation ecosystem <https://brainmodeling.readthedocs.io/>`_.
130+
131+
132+
----
133+
126134

127135

128136
.. toctree::

docs_state/core-concepts/index.rst

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,40 @@
11
Core Concepts
22
=============
33

4+
This section provides an in-depth exploration of the fundamental concepts underlying ``brainpy.state``.
5+
Understanding these core principles will help you build more sophisticated and efficient neural network
6+
models.
7+
8+
``brainpy.state`` introduces a State-based programming paradigm that simplifies the development of
9+
spiking neural networks while improving performance and scalability. The concepts covered here form
10+
the foundation for all neural modeling work in this framework.
11+
12+
13+
Overview
14+
--------
15+
16+
The core concepts of ``brainpy.state`` include:
17+
18+
- **Architecture**: The overall structure and design principles of State-based neural networks, including how components interact and compose together
19+
- **Neurons**: Building blocks for neural computation, including different neuron models and their state representations
20+
- **Synapses**: Connections between neurons that transmit signals and implement learning rules
21+
- **Projections**: Network-level structures that organize and manage connections between populations of neurons
22+
- **State Management**: The powerful state handling system that enables efficient simulation and flexible model composition
23+
24+
25+
Why these concepts matter
26+
--------------------------
27+
28+
Mastering these core concepts will enable you to:
29+
30+
- Design complex neural networks with clean, maintainable code
31+
- Leverage the State-based paradigm for improved performance
32+
- Understand how to compose neurons, synapses, and projections effectively
33+
- Manage model state efficiently during simulation
34+
- Seamlessly integrate with the BrainX ecosystem
35+
36+
Each concept builds upon the previous ones, so we recommend reading them in order if you're new to ``brainpy.state``.
37+
438

539
.. toctree::
640
:hidden:

docs_state/examples/gallery.rst

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -434,15 +434,13 @@ Additional Resources
434434
**Core Concepts**
435435
For architectural understanding, see :doc:`../core-concepts/architecture`
436436

437-
**Migration Guide**
438-
For updating from 2.x, see :doc:`../migration/migration-guide`
439437

440438
Browse All Examples
441439
-------------------
442440

443441
View all examples on GitHub:
444442

445-
`BrainPy Examples (Version 3.0) <https://github.com/brainpy/BrainPy/tree/master/examples_state>`_
443+
`BrainPy-State Examples <https://github.com/brainpy/BrainPy/tree/master/examples_state>`_
446444

447445
For more extensive examples and notebooks:
448446

docs_state/index.rst

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -93,13 +93,6 @@ Learn more
9393
:class-card: sd-text-black sd-bg-light
9494
:link: apis.html
9595

96-
.. grid-item::
97-
:columns: 6 6 6 4
98-
99-
.. card:: :material-regular:`swap_horiz;2em` Migration from 2.x
100-
:class-card: sd-text-black sd-bg-light
101-
:link: migration/migration-guide.html
102-
10396
.. grid-item::
10497
:columns: 6 6 6 4
10598

docs_state/quickstart/index.rst

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,34 @@
11
Quickstart
22
==========
33

4+
Welcome to the quickstart guide for ``brainpy.state``! This section will help you get up and running
5+
with the State-based programming paradigm for building and simulating spiking neural networks.
6+
7+
Whether you're new to BrainPy or transitioning from ``brainpy.dyn``, this guide provides everything
8+
you need to start building neural models with the improved State-based approach.
9+
10+
11+
What you'll learn
12+
-----------------
13+
14+
This quickstart guide covers:
15+
16+
- **Installation**: How to install BrainPy with the appropriate backend (CPU, GPU, TPU) for your needs
17+
- **5-Minute Tutorial**: A hands-on introduction to building your first neural network with ``brainpy.state``
18+
- **Core Concepts**: Understanding the fundamental concepts of State-based programming and how it differs from traditional approaches
19+
20+
21+
Getting started
22+
---------------
23+
24+
If you're new to ``brainpy.state``, we recommend following these steps:
25+
26+
1. Start with :doc:`installation` to set up your environment
27+
2. Follow the :doc:`5min-tutorial` to build your first model
28+
3. Review :doc:`concepts-overview` to understand the underlying principles
29+
30+
For experienced users, you can jump directly to the concepts overview or explore the tutorials and examples sections.
31+
432

533
.. toctree::
634
:hidden:

examples_state/107_gamma_oscillation_1996.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ def update(self, t):
139139
# simulation
140140
with brainstate.environ.context(dt=0.01 * u.ms):
141141
times = u.math.arange(0. * u.ms, 500. * u.ms, brainstate.environ.get_dt())
142-
spikes, vs = brainstate.transform.for_loop(net.update, times, pbar=brainstate.transform.ProgressBar(10))
142+
spikes, vs = brainstate.transform.for_loop(net.update, times, pbar=100)
143143

144144
# visualization
145145
fig, gs = braintools.visualize.get_figure(1, 2, 4, 4)

examples_state/110_Susin_Destexhe_2021_gamma_oscillation_AI.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ def simulate_adex_neurons():
7373
plt.show()
7474

7575

76-
class AINet(brainstate.nn.DynamicsGroup):
76+
class AINet(brainstate.nn.Module):
7777
def __init__(self):
7878
super().__init__()
7979

@@ -164,8 +164,7 @@ def simulate_ai_net():
164164
# simulation
165165
times = u.math.arange(0. * u.ms, duration, brainstate.environ.get_dt())
166166
indices = u.math.arange(0, len(times))
167-
returns = brainstate.transform.for_loop(net.update, indices, times, varied_rates,
168-
pbar=brainstate.transform.ProgressBar(100))
167+
returns = brainstate.transform.for_loop(net.update, indices, times, varied_rates, pbar=4000)
169168

170169
# # spike raster plot
171170
# spikes = returns['FS.spike']

examples_state/111_Susin_Destexhe_2021_gamma_oscillation_CHING.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
)
3232

3333

34-
class CHINGNet(brainstate.nn.DynamicsGroup):
34+
class CHINGNet(brainstate.nn.Module):
3535
def __init__(self):
3636
super().__init__()
3737

examples_state/112_Susin_Destexhe_2021_gamma_oscillation_ING.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
)
3333

3434

35-
class INGNet(brainstate.nn.DynamicsGroup):
35+
class INGNet(brainstate.nn.Module):
3636
def __init__(self):
3737
super().__init__()
3838

@@ -178,8 +178,7 @@ def simulate_ing_net():
178178
# simulation
179179
times = u.math.arange(0. * u.ms, duration, brainstate.environ.get_dt())
180180
indices = u.math.arange(0, len(times))
181-
returns = brainstate.transform.for_loop(net.update, indices, times, varied_rates,
182-
pbar=brainstate.transform.ProgressBar(100))
181+
returns = brainstate.transform.for_loop(net.update, indices, times, varied_rates, pbar=1000)
183182

184183
# visualization
185184
visualize_simulation_results(

examples_state/113_Susin_Destexhe_2021_gamma_oscillation_PING.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
)
3333

3434

35-
class PINGNet(brainstate.nn.DynamicsGroup):
35+
class PINGNet(brainstate.nn.Module):
3636
def __init__(self):
3737
super().__init__()
3838

0 commit comments

Comments
 (0)