Code from Fleming & Jewell et al. (2021). https://journals.plos.org/plosone/article?id=10.1371/journal.pone.0252345
Full paper dataset is available at figshare: https://doi.org/10.6084/m9.figshare.14627238.v1
Inspired and built off of the preprocessing toolkits of Theis et al (2016). Three main steps:
- Remove linear trends from the data
- Upsample data by a constant factor
- Normalize the data by percentiles
... plus a few additional formatting tools.
Preprocessing is applied to in vitro and in vivo imaging data (via data_preprocessing.py) prior to further analysis. See Examples 1 and 2 in the Demo Notebok (demo.ipynb).
Assuming that the underlying calcium concentration decays exponentially between spikes, that is c_t = decay_rate * c_{t-1}, we use the true spike times to estimate the decay_rate.
Decay rate estimation is performed on in vitro data consisting of simultaneously recorded imaging data and spike times (via estimate_decay_rates.py). See Example 1 in the Demo Notebook (demo.ipynb).
Given a target firing rate and decay we estimate spikes so that the average estimated firing rate is close to the target firing rate.
Spike estimation is performed on in vitro and in vivo imaging data (via estimate_spikes.py). See Examples 1 and 2 in the Demo Notebook (demo.ipynb).
A target firing rate (in Hz) and decay rate must be inputted by the user to perform spike estimation. We provide recommended median decay rates for GCaMP6f and GCaMP6m for in vivo data, since decay rates are not directly observed in vivo (see recommended_decay_rates.rtf). Note that these recommended decay rates are for spike estimation on 60 Hz data. Imaging data can be upsampled in the preprocessing step. If estimating spikes at a final sampling rate other than 60 Hz, the decay rate must be adjusted (see note in recommended_decay_rates.txt).