Closed nirum closed 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.
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
Cool, sounds good. I'm on board with the list otherwise.
Ok I'll update the docs and merge
Listing updates that I want to include in a 0.4.0 release. :beer:
Containers
:package: Adds a
containers
module that contains two classes, andExperiment
and aFilter
class, for managing stimuli and spikes (Experiment
) and spike-triggered averages (Filter
).Example usage:
New ellipse and contour fitting code
pyret.filtertools.get_ellipse
- gets the ellipse parameters (centroid, widths, and rotation angle) from a 2D image of the spatial RF profilepyret.filtertools.rfsize
- returns the lengths of each axis of the ellipse (rough measure of the size of the RF), given a spatial RF and a spatial sampling ratepyret.filtertools.get_contours
- wrapper forscikit-image.measure.find_contours
pyret.filtertools.get_regionprops
- wrapper forscikit-image.measure.regionprops
pyret.visualizations.ellipse
- plots an elliptical contour of an ellipse fit to the given 2D spatial RF profilepyret.filtertools.normalize_spatial
- a helper utility for normalizing a given 2D spatial receptive field by mean subtracting and flipping the sign such that the RF is an 'on' feature (useful for fitting 2D gaussians to the spatial RF)Breaking changes
filtertools.resample
, which given a 1-D or 2-D array and a scaling factor (n), resamples the filter to have n times the sampling rate of the original filter (based onscipy.signal.resample
)rolling_window
totime_axis=0
, to be consistent with the rest of pyret (after the flipped dimensions switch)prinangles
function (does not really belong in thefiltertools
module, or even in pyret at all)pyret.plotsta
function