baccuslab / pyret

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

Bug fix in linear response method. #97

Closed bnaecker closed 6 years ago

bnaecker commented 6 years ago

This set of commits fixes a few bugs.

  1. filtertools.sta did not count a set of frames more than once if more than one spike occurred in the corresponding time bin. That is, a frame with 1 spike and a frame with 1000 spikes have the same weight in the STA. Now each set of frames is weighted by the number of spikes in the bin.

  2. filtertools.linear_response was incorrect. It both ignored the initial (but still valid) portion of the response of the filter, and took a reverse-correlation, and not a linear filter as the docs claimed. This was solved by padding the stimulus with zeros before slicing, and then flipping the slices along the time axis.

The commit also simplifies tests for the filtertools module, using impulses as the stimuli, which are much easier to reason about and see errors in. It also clarifies the docs for a few things, and updates the quickstart to account for all these changes.

codecov-io commented 6 years ago

Codecov Report

Merging #97 into master will decrease coverage by 0.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #97      +/-   ##
==========================================
- Coverage   95.35%   95.34%   -0.02%     
==========================================
  Files           8        8              
  Lines         560      558       -2     
==========================================
- Hits          534      532       -2     
  Misses         26       26
Impacted Files Coverage Δ
pyret/stimulustools.py 100% <ø> (ø) :arrow_up:
pyret/filtertools.py 98.58% <100%> (+0.03%) :arrow_up:
pyret/metadata.py 100% <100%> (ø) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Δ = absolute <relative> (impact), ø = not affected, ? = missing data Powered by Codecov. Last update 5bd9b74...35e1ceb. Read the comment docs.