lucastheis / c2s

A toolbox for inferring spikes from calcium traces.
http://c2s.readthedocs.org
MIT License
23 stars 13 forks source link

Units for predictions #13

Open alexklibisz opened 7 years ago

alexklibisz commented 7 years ago

What are the units for the list of predictions returned from predict function?

For context, I'm trying to apply some methods from Spikefinder to locate spikes in new datasets, and I'm using the TIFFs/ROIs from Neurofinder as a starting point. I've taken the mean of an ROI from one of the Neurofinder datasets and preprocessed it using the preprocess function. When I call predict, the returned predictions have min=0.00098, mean=0.026073, and max=0.329504.

The data looks like this before preprocessing: download 4

The preprocessed data (blue) and the predictions (orange) end up looking like this: download 3

This is very different from the "spike rates" from Spikefinder, which are discrete values between 0 and 5. So I'm curious how I should be interpreting these predictions. Forgive me if this is documented somewhere already, but I haven't been able to find it. Thanks

lucastheis commented 7 years ago

The units could be clearer in the documentation. The predictions are the expected number of spikes in each bin. The expected number of spikes might be low because of the uncertainty in the position of spikes at 100 Hz. If you downsample predictions and spike trains to lower sampling rates, you'll find that the correlations go up and the numbers look more similar.

alexklibisz commented 7 years ago

@lucastheis Thanks for clarifying. If I downsample after making the predictions, would that be different from defining a lower fps in the initial data dictionary and letting c2s do the downsampling?

lucastheis commented 7 years ago

That would be different, yes. The input to the model should to be 100 Hz, because that's what it has been trained on.

alexklibisz commented 7 years ago

Would you recommend using the scipy.signal.resample function for the downsampling?