Hi there — I’m just getting started in the world of computational neuroscience, and this post is about the very first experiment I tried:
Simulating brain waves using Python.
It’s simple, visual, and surprisingly powerful. If you’re also curious about the brain and love working with code, this is the perfect way to dip your toes into the field.
Let me walk you through it.
So… What Are Brain Waves?
Before I saw them in code, “brain waves” felt abstract. But now? They make way more sense.
Your brain is constantly producing electrical signals. When neurons fire rhythmically, they generate wave-like patterns we can measure — these are called neural oscillations or brain waves.
Different frequency bands correspond to different mental states:
| Brain Wave | Frequency (Hz) | Associated State |
|---|---|---|
| Delta | 0.5–4 | Deep sleep 💤 |
| Theta | 4–8 | Creativity, daydreaming 🌙 |
| Alpha | 8–12 | Calm focus 🌤️ |
| Beta | 12–30 | Active thinking 📚 |
| Gamma | 30–100 | Intense focus, learning ⚡ |
My First Brain Simulation in Python
Here’s the code I wrote. It creates simple sine waves that mimic the frequencies of different brain waves:
Make sure you have these installed:
pip install numpy matplotlib
📜 The Code:
import numpy as np
import matplotlib.pyplot as plt
sampling_rate = 1000
sampling_range = np.linspace(0, 1, sampling_rate, endpoint= False)
brain_waves = {
"Delta (0.5-4 Hz)": 2,
"Theta (4-8 Hz)": 6,
"Alpha (8–12 Hz)": 10,
"Beta (12–30 Hz)": 20,
"Gamma (30–100 Hz)": 40
}
plt.figure(figsize=(12,8))
for i, (name, freq) in enumerate(brain_waves.items()):
wave = np.sin(2 * np.pi * freq * sampling_range) # sine wave formula
plt.subplot(len(brain_waves), 1, i + 1)
plt.plot(sampling_range, wave)
plt.title(f"{name} - {freq} Hz")
plt.ylabel("Amplitude")
plt.grid(True)
plt.xlabel("Time (seconds)")
plt.tight_layout()
plt.show()
This script:
- Generates sine waves at specific frequencies
- Plots them to show what Delta, Theta, Alpha, Beta, and Gamma look like
Seeing them visualized like this was a huge “a-ha” moment for me.
Results: What Do Brain Waves Look Like?
And here it is — the result of my very first neuro-code experiment:

Each wave you see above represents a different brain rhythm. From the slow, sleepy Delta to the lightning-fast Gamma, these are the basic building blocks of how our brain communicates.
🔍 A few things that stood out to me:
- Slower waves (Delta, Theta) have longer, stretched-out curves — which makes sense for low-frequency activity like sleep or relaxation.
- Faster waves (Beta, Gamma) are densely packed and much more rapid — just like our thoughts during focused work or problem-solving.
- Seeing them stacked like this made me realize how the brain can operate on multiple channels at once — a symphony of frequencies, each playing its part.
This plot is simple, clean, and artificial — but it’s my first peek into how signal and cognition intertwine.
Why Start Here?
To be honest, I started here because it felt manageable.
But it turned out to be much more than that.
This tiny experiment helped me:
- Understand the basics of neural rhythms without needing real EEG data (yet)
- Visualize how different brain states might look over time
- Think in terms of frequency, which is a big part of how the brain works
No lab, no equipment — just Python and curiosity.
What Comes Next?
Now that I’ve seen the idealized version of these brain waves, here’s what I want to try next:
- Adding noise to simulate real-world signals
- Mixing waves to mimic brain states like sleep or focus
- Playing with spectrograms to visualize frequency changes over time
- Eventually working with real EEG data
This feels like the first brick in what could become a pretty exciting path.
Final Thoughts
This is just the beginning — but a meaningful one.
If you’re a beginner like me, and you’re curious about how to blend neuroscience and code, I highly recommend trying this. It’s simple, visual, and a great way to start thinking like a brain — in signals, rhythms, and patterns.
I’ll keep sharing my experiments as I learn more — the wins, the bugs, the late-night rabbit holes.
Ready to simulate your own brain? Or already a step ahead of me? Let’s connect — I’d love to learn together.