-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add Resampling #289
Add Resampling #289
Conversation
- keep the original sampling rate in the .log On branch resampling Changes to be committed: modified: syncopy/preproc/resampledata.py
- this is pure (yet thin) backend atm, if SciPy's implementation is good enough for our needs this little code might move directly into a cF On branch resampling Changes to be committed: modified: syncopy/preproc/firws.py new file: syncopy/preproc/resampling.py
- also in the backend it is much nicer to work with tapsmofrq directly, hence added dedicated little function returning the needed scipy.signal.windows.dpss parameters is nice to have On branch resampling Changes to be committed: modified: syncopy/shared/input_processors.py modified: syncopy/specest/mtmfft.py
- both trivial downsampling (+FIR) and non-trivial resampling get tested On branch resampling Changes to be committed: modified: syncopy/preproc/compRoutines.py modified: syncopy/preproc/resampling.py modified: syncopy/tests/backend/test_conn.py new file: syncopy/tests/backend/test_resampling.py
- \pm 5% of expected gain as tolerance for the tests On branch resampling Your branch is up to date with 'origin/resampling'. Changes to be committed: modified: syncopy/preproc/firws.py modified: syncopy/preproc/preprocessing.py modified: syncopy/preproc/resampledata.py modified: syncopy/preproc/resampling.py modified: syncopy/tests/backend/test_resampling.py
- this shows superior spectral response, yet needs a normalization tweak :/ - also fixed sampling rate mixup.. (rs_fs, ds_fs) On branch resampling Your branch is up to date with 'origin/resampling'. Changes to be committed: modified: syncopy/tests/backend/test_resampling.py
- this strategy produces very good results, hence we can be more thorough with testing On branch resampling Your branch is up to date with 'origin/resampling'. Changes to be committed: modified: syncopy/tests/backend/test_resampling.py
- homegrown firws + SciPy's resample_poly for resampling - no default anti-aliasing for downsampling as in FT On branch resampling Your branch is up to date with 'origin/resampling'. Changes to be committed: modified: syncopy/preproc/compRoutines.py modified: syncopy/preproc/preprocessing.py modified: syncopy/preproc/resampledata.py
- corrected typo for SciPy's default kaiser fir window (5. and not .5), the ringing is gone yet it is still a quite slow roll off compared with our homegrown firws which remains the frontend default - when designing a fir for an up-fir-down operation, took the effective sampling rate during filtering into accout - refactored backend and cF On branch resampling Your branch is up to date with 'origin/resampling'. Changes to be committed: modified: syncopy/preproc/compRoutines.py modified: syncopy/preproc/resampling.py modified: syncopy/tests/backend/test_resampling.py
- for FT compat On branch resampling Your branch is up to date with 'origin/resampling'. Changes to be committed: modified: syncopy/specest/mtmfft.py
Codecov Report
@@ Coverage Diff @@
## dev #289 +/- ##
==========================================
+ Coverage 68.09% 68.39% +0.29%
==========================================
Files 67 69 +2
Lines 7667 7809 +142
Branches 1588 1614 +26
==========================================
+ Hits 5221 5341 +120
- Misses 2087 2110 +23
+ Partials 359 358 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The backend interface looks very clean and robust. I anticipate some problems with the frontend, though (see comments). However, without tests, it's hard to say. One side-note: the current version of local_spy.py
(here as well as in master
) crashes with a TypeError: only integer scalar arrays can be converted to a scalar index
raised in synth_data.AR2_network
. Not sure if that's just a hiccup in the script or an actual bug.
|
||
# we need to re-calculate the resampling factor | ||
factor = self.cfg['new_samplerate'] / data.samplerate | ||
trafo_trl = lambda trldef: np.ceil(trldef * factor) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As above, I think this might break things.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, so here I did my own on the fly tests and it looked fine.. again let's see in the tests?!
- removed superfluous imports and fixed some docstring typos On branch resampling Changes to be committed: modified: syncopy/preproc/resampledata.py modified: syncopy/preproc/resampling.py modified: syncopy/tests/backend/test_resampling.py
- the ad-hoc collect_trials decorator accepts only *args for the wrapper (nTrials, samplerate) but NOT for the wrapped trial (np.array) producing function.. if that gives too much problems then maybe we have to think of sth else Changes to be committed: modified: syncopy/tests/local_spy.py
I fixed it and wrote a little comment in the commit msg! |
The |
Things added:
Still todo
Author Guidelines
Reviewer Checklist