Skip to main content
Ctrl+K
brainpy.state documentation - Home brainpy.state documentation - Home

Tutorials

  • Quickstart
    • Installation Guide
    • Overview
    • 5-Minute Tutorial: Getting Started
  • BrainPy-style Modeling Guide
    • Overview
    • Neurons
    • Synapses
    • Projections
  • Examples Gallery

API Reference (Stable)

  • Base Classes
    • Dynamics
    • Neuron
    • Synapse
  • BrainPy-style Neurons
    • IF
    • LIF
    • LIFRef
    • ALIF
    • ExpIF
    • ExpIFRef
    • AdExIF
    • AdExIFRef
    • QuaIF
    • AdQuaIF
    • AdQuaIFRef
    • Gif
    • GifRef
    • Izhikevich
    • IzhikevichRef
    • HH
    • MorrisLecar
    • WangBuzsakiHH
  • BrainPy-style Synapses
    • Expon
    • DualExpon
    • Alpha
    • AMPA
    • GABAa
    • BioNMDA
  • BrainPy-style Projections
    • Projection
    • AlignPostProj
    • DeltaProj
    • CurrentProj
    • align_pre_projection
    • align_post_projection
    • SymmetryGapJunction
    • AsymmetryGapJunction
  • BrainPy-style Synaptic Outputs
    • SynOut
    • COBA
    • CUBA
    • MgBlock
  • BrainPy-style Plasticity
    • STP
    • STD
  • BrainPy-style Readouts
    • LeakyRateReadout
  • BrainPy-style Input Generators
    • SpikeTime
    • PoissonSpike
    • PoissonEncoder
    • PoissonInput
    • poisson_input

Experimental (NEST-Compatible)

  • NEST-Compatible Models — Status & Limitations
  • NEST Base Classes
    • NESTNeuron
    • NESTSynapse
    • NESTPlasticity
    • NESTDevice
  • NEST-Compatible Neuron Models
    • iaf_psc_delta
    • iaf_psc_delta_ps
    • iaf_psc_alpha
    • iaf_psc_alpha_multisynapse
    • iaf_psc_alpha_ps
    • iaf_psc_exp
    • iaf_psc_exp_multisynapse
    • iaf_psc_exp_htum
    • iaf_psc_exp_ps
    • iaf_psc_exp_ps_lossless
    • iaf_cond_alpha
    • iaf_cond_alpha_mc
    • iaf_cond_beta
    • iaf_cond_exp
    • iaf_cond_exp_sfa_rr
    • iaf_bw_2001
    • iaf_bw_2001_exact
    • iaf_chs_2007
    • iaf_chxk_2008
    • iaf_tum_2000
    • aeif_cond_alpha
    • aeif_cond_alpha_astro
    • aeif_cond_alpha_multisynapse
    • aeif_cond_beta_multisynapse
    • aeif_cond_exp
    • aeif_psc_alpha
    • aeif_psc_delta
    • aeif_psc_delta_clopath
    • aeif_psc_exp
    • gif_cond_exp
    • gif_cond_exp_multisynapse
    • gif_pop_psc_exp
    • gif_psc_exp
    • gif_psc_exp_multisynapse
    • mat2_psc_exp
    • amat2_psc_exp
    • glif_cond
    • glif_psc
    • glif_psc_double_alpha
    • hh_psc_alpha
    • hh_psc_alpha_clopath
    • hh_psc_alpha_gap
    • hh_cond_exp_traub
    • hh_cond_beta_gap_traub
    • ht_neuron
    • izhikevich
    • pp_psc_delta
    • pp_cond_exp_mc_urbanczik
    • mcculloch_pitts_neuron
    • ginzburg_neuron
    • erfc_neuron
    • lin_rate_ipn
    • lin_rate_opn
    • tanh_rate_ipn
    • tanh_rate_opn
    • sigmoid_rate_ipn
    • sigmoid_rate_gg_1998_ipn
    • gauss_rate_ipn
    • threshold_lin_rate_ipn
    • threshold_lin_rate_opn
    • rate_neuron_ipn
    • rate_neuron_opn
    • rate_transformer_node
    • siegert_neuron
    • ignore_and_fire
  • NEST-Compatible Synapse Models
    • static_synapse
    • static_synapse_hom_w
    • bernoulli_synapse
    • cont_delay_synapse
    • gap_junction
    • diffusion_connection
    • rate_connection_instantaneous
    • rate_connection_delayed
    • sic_connection
  • NEST-Compatible Plasticity Models
    • tsodyks_synapse
    • tsodyks_synapse_hom
    • tsodyks2_synapse
    • quantal_stp_synapse
    • stdp_synapse
    • stdp_synapse_hom
    • stdp_pl_synapse_hom
    • stdp_facetshw_synapse_hom
    • stdp_nn_pre_centered_synapse
    • stdp_nn_restr_synapse
    • stdp_nn_symm_synapse
    • stdp_triplet_synapse
    • stdp_dopamine_synapse
    • clopath_synapse
    • jonke_synapse
    • urbanczik_synapse
    • vogels_sprekeler_synapse
    • ht_synapse
  • NEST-Compatible Devices
    • dc_generator
    • ac_generator
    • noise_generator
    • step_current_generator
    • step_rate_generator
    • spike_generator
    • spike_train_injector
    • spike_dilutor
    • poisson_generator
    • poisson_generator_ps
    • inhomogeneous_poisson_generator
    • sinusoidal_poisson_generator
    • gamma_sup_generator
    • sinusoidal_gamma_generator
    • mip_generator
    • ppd_sup_generator
    • pulsepacket_generator
    • multimeter
    • spike_recorder
    • weight_recorder
    • correlation_detector
    • correlomatrix_detector
    • correlospinmatrix_detector
    • spin_detector
    • volume_transmitter

Project

  • Changelog
  • .rst

Examples Gallery

Contents

  • Classical Network Models
  • Oscillations and Rhythms
    • Gamma Oscillation Mechanisms (Susin & Destexhe 2021)
  • Spiking Neural Network Training

Examples Gallery#

Welcome to the brainpy.state examples gallery! Here you’ll find complete, runnable examples demonstrating various aspects of computational neuroscience modeling.

All examples are available in the examples/ directory of the brainpy.state repository.

Classical Network Models#

These examples reproduce influential models from the computational neuroscience literature.

E-I Balanced Networks

Implements the classic excitatory-inhibitory balanced network showing chaotic dynamics.

  • 80% excitatory, 20% inhibitory neurons

  • Random sparse connectivity

  • Balanced excitation and inhibition

  • Asynchronous irregular firing

https://github.com/chaobrain/brainpy.state/tree/main/examples/102_EI_net_1996.py
COBA Network (2005)

Conductance-based synaptic integration in balanced networks.

  • Conductance-based synapses (COBA)

  • Reversal potentials

  • More biologically realistic

  • Stable asynchronous activity

https://github.com/chaobrain/brainpy.state/tree/main/examples/103_COBA_2005.py
CUBA Network (2005)

Current-based synaptic integration (simpler, faster variant).

  • Current-based synapses (CUBA)

  • Faster computation

  • Widely used for large-scale simulations

https://github.com/chaobrain/brainpy.state/tree/main/examples/104_CUBA_2005.py
COBA with Hodgkin-Huxley Neurons (2007)

More detailed neuron model with sodium and potassium channels.

  • Hodgkin-Huxley neuron dynamics

  • Action potential generation

  • Biophysically detailed

  • Computationally intensive

https://github.com/chaobrain/brainpy.state/tree/main/examples/106_COBA_HH_2007.py

Oscillations and Rhythms#

Gamma Oscillation (1996)

Interneuron network generating gamma oscillations (30-80 Hz).

  • Interneuron-based gamma

  • Inhibition-based synchrony

  • Physiologically relevant frequency

  • Network oscillations

https://github.com/chaobrain/brainpy.state/tree/main/examples/107_gamma_oscillation_1996.py
Synfire Chains (199x)

Demonstrates reliable spike sequence propagation.

  • Feedforward architecture

  • Reliable spike timing

  • Wave propagation

  • Temporal coding

https://github.com/chaobrain/brainpy.state/tree/main/examples/108_synfire_chains_199.py
Fast Global Oscillation

High-frequency oscillations (>100 Hz) in inhibitory networks.

  • Very fast oscillations

  • Gap junction coupling

  • Inhibitory synchrony

  • Pathological rhythms

https://github.com/chaobrain/brainpy.state/tree/main/examples/109_fast_global_oscillation.py

Gamma Oscillation Mechanisms (Susin & Destexhe 2021)#

Series of models exploring different gamma generation mechanisms:

Asynchronous Irregular (AI)

AI state: No oscillations, irregular firing

  • Background activity state

  • Asynchronous firing

  • No clear rhythm

https://github.com/chaobrain/brainpy.state/tree/main/examples/110_Susin_Destexhe_2021_gamma_oscillation_AI.py
CHING Mechanism

Coherent High-frequency INhibition-based Gamma

  • Coherent inhibition

  • High-frequency gamma

  • Interneuron synchrony

https://github.com/chaobrain/brainpy.state/tree/main/examples/111_Susin_Destexhe_2021_gamma_oscillation_CHING.py
ING Mechanism

Inhibition-based Gamma

  • Pure inhibitory network

  • Gamma through inhibition

  • Fast synaptic kinetics

https://github.com/chaobrain/brainpy.state/tree/main/examples/112_Susin_Destexhe_2021_gamma_oscillation_ING.py
PING Mechanism

Pyramidal-Interneuron Gamma

  • E-I loop generates gamma

  • Most common mechanism

  • Excitatory-inhibitory interaction

https://github.com/chaobrain/brainpy.state/tree/main/examples/113_Susin_Destexhe_2021_gamma_oscillation_PING.py

Spiking Neural Network Training#

Supervised Learning with Surrogate Gradients

Trains a simple spiking network using surrogate gradients.

  • Surrogate gradient method

  • LIF neuron training

  • Simple classification task

  • Gradient-based learning

https://github.com/chaobrain/brainpy.state/tree/main/examples/200_surrogate_grad_lif.py
Fashion-MNIST Classification

Trains a spiking network on Fashion-MNIST dataset.

  • Fashion-MNIST dataset

  • Multi-layer SNN

  • Spike-based processing

  • Real-world classification

https://github.com/chaobrain/brainpy.state/tree/main/examples/201_surrogate_grad_lif_fashion_mnist.py
MNIST with Readout Layer

Uses readout layer for classification.

  • MNIST handwritten digits

  • Specialized readout layer

  • Spike counting

  • Classification from spike rates

https://github.com/chaobrain/brainpy.state/tree/main/examples/202_mnist_lif_readout.py

previous

Projections

next

Base Classes

Contents
  • Classical Network Models
  • Oscillations and Rhythms
    • Gamma Oscillation Mechanisms (Susin & Destexhe 2021)
  • Spiking Neural Network Training

By BrainX Team

© Copyright 2020-, brainpy.state.

Last updated on May 13, 2026.