baccuslab/pyret

simplifying filtertools

Closed this issue ยท 1 comments

nirum commented

In filtertools, we have three functions (getsta, getstc, getste) that are 90% the exact same. I'm thinking that we can reduce these into a single function that selects out the spike-triggered stimuli and into an iterable sequence and then collapsing the sequence down as necessary for the STA and STC, or returning the whole sequence for the STE.

nirum commented

๐Ÿ’ฅ got rid of 275 lines of code.

Now, filtertools.getste returns an iterator (via itertools.imap) that iterates over each spike-triggered stimulus slice.

Then, filtertools.getsta and filtertools.getstc simply use the built-in reduce function to collapse the iterator into either the STA or STC matrix.

I tested this with toy data in an ipython shell, and it seems to work well. This still needs to be tested with stimuli stored as hdf5 arrays, but I think this method should solve Issue #48 as well.

๐Ÿ˜„ ๐Ÿ‘ ๐ŸŽ‰