baccuslab / pyret

Python tools for analysis of neurophysiology data
https://pyret.readthedocs.io/en/master/
MIT License
36 stars 8 forks source link

Version 0.4.0 #64

Closed nirum closed 8 years ago

nirum commented 8 years ago

Listing updates that I want to include in a 0.4.0 release. :beer:

Containers

:package: Adds a containers module that contains two classes, and Experiment and a Filter class, for managing stimuli and spikes (Experiment) and spike-triggered averages (Filter).

Example usage:

>>> ex = Experiment(stimulus, stimulus_time, spikes, dt)
>>> sta_cell0 = ex.sta(0, history)
>>> sta_cell0.plot()

New ellipse and contour fitting code

bnaecker commented 8 years ago

Everything looks fine, but I have a question about the new filtertools.resample method. SciPy's resample is a Fourier-based method, which means it really will not work well on things like spike trains (binned or not). There will be a ton of high-frequency ringing. Run this and see:

from scipy import signal
t = np.arange(1000)
sig = np.zeros(t.size)
sig[np.random.rand(sig.size) > 0.98] = 1
sig_res, t_res = signal.resample(sig, 2 * sig.size, t=t)
plt.plot(t, sig)
plt.plot(t_res, sig_res)

If we only plan to use this on stimuli or smoothed spike trains, then it's fine. We just need to bin spikes using resampled time bins, rather than resampling the binned spikes.

nirum commented 8 years ago

Oh yes! good point. I meant for the resample method to only be used on filters, which is why it is in filtertools. I'll add a note in the docstring mentioning that it is to be used for filters and not spike trains

bnaecker commented 8 years ago

Cool, sounds good. I'm on board with the list otherwise.

nirum commented 8 years ago

Ok I'll update the docs and merge