https://github.com/bryanlimy/spikes2calcium
A simple Python tool to convert spike trains to calcium fluorescence-like traces.
https://github.com/bryanlimy/spikes2calcium
calcium-imaging spike-trains
Last synced: about 2 months ago
JSON representation
A simple Python tool to convert spike trains to calcium fluorescence-like traces.
- Host: GitHub
- URL: https://github.com/bryanlimy/spikes2calcium
- Owner: bryanlimy
- License: mit
- Created: 2022-05-19T15:23:04.000Z (about 3 years ago)
- Default Branch: main
- Last Pushed: 2022-05-30T10:39:25.000Z (about 3 years ago)
- Last Synced: 2025-02-09T23:19:21.450Z (4 months ago)
- Topics: calcium-imaging, spike-trains
- Language: Python
- Homepage:
- Size: 288 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## spikes2calcium
A simple Python tool to convert spike trains to calcium fluorescence-like traces.---
### Files
- [`spikes2calcium.py`](spikes2calcium.py) - the main function to convert spike trains to calcium-like traces using the method described in [Grewe et. al. 2010](https://www.nature.com/articles/nmeth.1453) (codebase in MATLAB: [github.com/HelmchenLab/CalciumSim](https://github.com/HelmchenLab/CalciumSim)).
- [`utils.py`](utils.py) - includes plotting code and spike train generation code for the demo.---
### Usage
```
import utils
from spikes2calcium import spikes2calcium# generate spike trains from Poisson distribution
DURATION = 20 # duration of the simulation in s
NUM_NEURONS = 16 # number of neurons to simulate
FRAME_RATE = 24.0 # frame rate of the simulation
FIRING_RATE = 2.0 # firing rate in Hzspike_trains = utils.generate_spike_trains(firing_rate=FIRING_RATE,
duration=DURATION,
num_neuorns=NUM_NEURONS,
frame_rate=FRAME_RATE)# convolve spike trains to calcium-like traces
traces = spikes2calcium(spike_trains=spike_trains, frame_rate=FRAME_RATE)# plot the first 4 neurons
utils.plot_traces(traces=traces,
spike_trains=spike_trains,
frame_rate=FRAME_RATE,
filename='plots/traces.png',
show=False,
close=True)
```### Example
---
### Installation
- Package required: `numpy`, `matplotlib`