-
Notifications
You must be signed in to change notification settings - Fork 266
Add concatenate functionality for signal objects #836
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 concatenate functionality for signal objects #836
Conversation
|
Hello @JuliaSprenger! Thanks for updating this PR. We checked the lines you've touched for PEP 8 issues, and found:
Comment last updated at 2020-11-09 13:30:19 UTC |
|
Hi julia. |
|
I agree with Samuel that "patch" is not the best name, it implies replacing part of the existing signal (which is already done by the "splice" method. "extend" or "append" would be better. I also think it's confusing to have different behaviour for the two types of signal. I suggest restricting the method for IrregularlySampledSignals to forbid overlap. |
|
Let's go for |
2a0164e to
df5666f
Compare
|
As suggested by @apdavison, overlapping IrregularlySampledSignals can now not be concatenated but raise a ValueError. However, since I believe there might be cases when concatenating such signals might make sense anyway, I introduced a keyword for this to allow merging or overlapping signals if explicitely requested. |
|
Hi @morales-gregorio, could you please check if this implementation fulfils the criteria you were trying to adress in #846 ? |
|
Hi @JuliaSprenger, thanks for this nice function! As far as I understood with this function you cover the concatenation across one axis (time) and the function I wrote in #846 was meant to 'stack' signals across electrodes. Do you prefer to have two separate functions for each axis or just one function? I personally think having it all under the I am happy to incorporate the changes if you want to. Also, let me know if you want a more thorough line-by-line code review, which I am happy to do :) Best, PS I really liked the padding idea :) |
|
@morales-gregorio Thanks for having a look! python-neo/neo/core/basesignal.py Line 231 in 6813416
@morales-gregorio I would be interested if the performance of my implementation can keep up with your version in your use case, since this was the original motivation for your work. If you also require performance improvements for the And yes, it definitely makes sense to also add some of the tests you implemented here. I will have a look at it. |
|
@samuelgarcia @apdavison I would propose to merge this soon if you agree with the API and add potential performance optimizations later on when @morales-gregorio had time to run performance checks on his side. |
|
The failing tests are related to the new h5py version, fixed in #893. |
This parameter allows to raise a ValueError by default when irregularlysampledsignals are overlapping
ed56707 to
904ca1f
Compare
|
This looks good. I have some questions/comments:
|
|
Hi @samuelgarcia. Thanks for the review.
|
|
Perfect. |
|
Once the tests passed, feel free to hit 'merge' :) |
|
merge when ready! |
This PR adds patch methods for AnalogSignals and IrregularlySampledSignals. Patching allows to combine signals along the time axis, so potentially across different Segments. The behaviour for IrregularlySampledSignal and AnalogSignals differs slightly, as for AnalogSignals overlapping sampling points are not possible in contrast to IrregularlySampledSignals, where all samples can just be combined irrespective of temporal overlaps. For AnalogSignals, the prioritized sampled can be specified using the
overwritekeyword.This feature can be for AnalogSignals extended to also handle padding during patching, therefore providing a solution to #820.