Neural dynamics studies how the activity of neurons and neural networks evolves over time. It focuses on the mathematical and computational description of spiking behavior, membrane potentials, oscillations, synchronization, attractor states, and learning through synaptic plasticity. Typical approaches include differential-equation-based neuron models, spiking neural networks, and dynamical-systems analysis. Neural dynamics forms a central part of computational neuroscience, providing theoretical tools to understand how neural circuits generate computation, memory, and behavior.
This repository provides a collection of educational Python scripts that explore core concepts in neural dynamics. The focus is on interpretable models and simulations such as integrate-and-fire neurons, spiking neural networks, and plasticity rules. The goal is to offer concise, well-documented examples that support learning, experimentation, and theoretical exploration, rather than large-scale machine-learning frameworks. The scripts are intended for everyone who want to build intuition for dynamical processes in neural systems and reproduce classic results from theoretical neuroscience.
Each script in this repository is accompanied by a detailed blog post that explains the underlying concepts, mathematical formulations, and implementation details. The blog posts provide context and guidance to help you to understand the significance of each simulation and how it relates to broader topics in computational neuroscience.
All referenced Python scripts listed below can be found in the tutorials/ directory of this repository.
This is a collection of tutorials showing how to use the NEST Simulator. Each tutorial is usually based on the corresponding original tutorial from the NEST Simulator documentation, but modified and expanded to include more explanations and additional examples.
- NEST simulator – A powerful tool for simulating large-scale spiking neural networks (overview article)
- Step-by-step NEST single neuron simulation
- ⟶
single_neuron_simulation.py
- ⟶
- Connection concepts in NEST (overview article)
- Izhikevich SNN simulated with NEST
- ⟶
izhikevich_snn.py
- ⟶
- Oscillatory population dynamics of GIF neurons simulated with NEST
- ⟶
gif_neuron_model_with_oscillations.py
- ⟶
- Brunel network: A comprehensive framework for studying neural network dynamics
- ⟶
brunel_network.py
- ⟶
- Example of a neuron driven by an inhibitory and excitatory neuron population
- ⟶
neuron_with_population_inputs.py
- ⟶
- What are alpha-shaped post-synaptic currents?
- ⟶
alpha_function.py
- ⟶
- Frequency-current (f-I) curves
- ⟶
fi_curve.py
- ⟶
- Olfactory processing via spike-time based computation
- ⟶
spike_synchronization_through_oscillation.py
- ⟶
- Exponential (EIF) and adaptive exponential Integrate-and-Fire (AdEx) model
- ⟶
aeif_neuron.py - ⟶
aeif_neuron_multple_rices_and_decays.py
- ⟶
- Campbell and Siegert approximation for estimating the firing rate of a neuron
- ⟶
campbell_siegert_approximation.py
- ⟶
- Bienenstock-Cooper-Munro (BCM) rule
- ⟶
bcm_rule.py - ⟶
bcm_rule_with_decay_term.py
- ⟶
- On the role of gap junctions
- ⟶
two_neurons_with_gap_junctions.py
- ⟶
- On the role of gap junctions in neural modelling: Network example
- ⟶
gap_junctions_network_example.py
- ⟶
- Rate models as a tool for studying collective neural activity
- Incorporating structural plasticity in neural network models
- ⟶
structural_plasticity.py
- ⟶
The following scripts are not based on the NEST Simulator, but rather implement models and simulations from scratch using standard Python libraries such as NumPy and Matplotlib (but not limited to them).
- Building a neural network from scratch using NumPy
- ⟶ not part of this repository, but you can find it here.
- Understanding Hebbian learning in Hopfield networks
- ⟶ not part of this repository, but you can find it here.
- Integrate and Fire Model: A simple neuronal model.
- ⟶ not part of this repository, but you can find it here.
- Rössler attractor
- ⟶ not part of this repository, but you can find it here.
- Using phase plane analysis to understand dynamical systems
- ⟶ not part of this repository, but you can find it here.
- Nullclines and fixed points of the Rössler attractor
- ⟶ not part of this repository, but you can find it here.
- Van der Pol oscillator
- ⟶ not part of this repository, but you can find it here.
- FitzHugh-Nagumo model
- ⟶ not part of this repository, but you can find it here.
- Hodgkin-Huxley model
- ⟶ not part of this repository, but you can find it here.
- Izhikevich model
- ⟶ not part of this repository, but you can find it here.
- Simulating spiking neural networks with Izhikevich neurons
- ⟶ not part of this repository, but you can find it here.
For reproducibility:
conda create -n nest -y python=3.11 mamba
conda activate nest
mamba install -y ipykernel matplotlib numpy pandas nest-simulatorEach script can be run directly using the Python environment described above. In particular, they are written in such a way, that they can be interactively executed cell-by-cell, e.g., in VS Code's interactive window. You can also place them in a Jupyter notebook for step-by-step execution.
This repository is licensed under the GNU General Public License v3.0 (GPLv3). See the LICENSE file for details.
If you use code from this repository for your own research, teaching material, or derived software, please consider citing the Zenodo archive associated with this repository. Proper citation helps acknowledge the original source, provides context for the implemented physical models and numerical assumptions, and supports reproducibility.
When appropriate, citing the specific blog post that discusses the underlying concepts and numerical methods in detail is encouraged in addition to the repository itself.
If you use substantial parts of the code in an academic publication, a reference to both the repository and the associated blog article is recommended.
Here is the suggested citation format for the repository:
@software{musacchio_neural_dynamics_2026,
author = {Musacchio, Fabrizio},
title = {Neural Dynamics: A collection of educational Python scripts},
year = {2026},
publisher = {Zenodo},
doi = {10.5281/zenodo.18449732},
url = {https://doi.org/10.5281/zenodo.18449732}
}Thank you for considering proper citation practices.
For questions or suggestions, please open an issue on GitHub or contact the author via email: Fabrizio Musacchio
