-
Notifications
You must be signed in to change notification settings - Fork 264
[WIP] Make AnalogSignal and waveform dimensions more consistent #457
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
Conversation
to match dimension order of AnalogSignals previous dimension order was (spike,channel,time)
|
Hello @JuliaSprenger! Thanks for updating the PR.
Comment last updated on March 06, 2018 at 08:59 Hours UTC |
|
As numpy and scipy are by default row-major (the last dimension is what changes the fastest; their functions default to operating on Here is a gist that demonstrates this. In this case there was only a 2x speedup by operating on the last axis instead of the first and I'm sure I've encountered situations where the difference was greater than that. |
|
@cboulay The decision to have time on axis 0 was made very early in the history of Neo, motivated by an EEG use case, if I remember correctly. I would be in favour of changing this at some point, but it would be a big change, and would break all downstream code built on Neo. I would be inclined to do this for Neo 2.0 (Neo 1.0 is planned for later this year, maybe next year). |
|
Changing the waveform axes is also an API break, isn't it? But I understand that changing the AnalogSignal dimensions is a 'bigger break' than the waveforms, because fewer applications use the waveforms. Alternatively, you can keep the axis ordering as is but change to 'F' ordering in the memory layout. This would keep the API the same but you'd get the speedup benefit now. |
|
I am really in favor of keeping time as dim 0 because this the natural data order for any recording system of a multi channel signal. If you want to walk through really big files of long recordings having channels as first dim is just not possible. Of course when you you do a by channel computation you will get better performence if channel is dim 0 because each channel is compact in memory. For instance in tridesclous and ephyviewer I really need a chunk in time access very fastly. I guess that many of us will need that. In that case the time = dim 0 wins. Furthermore the rawio level expose data as time (time, channel) because they amost always are (time, channel) inside the file so a swap in memory would lead to bad performence at the reading time. I think if someone really need (channel, time) in memory layout. We can do something like this: In this example anasig_t have internally in memory a reverse stride but keep time dim = 0. |
|
I am OK with this PR. Could you run the cricle-ci run again to tests what need to be change in all IOs ? |
|
Hi Julia. Pro:
But:
In my mind rawio is more focus on performence that consistency. I practice, if I am not wrong, it is not a big problem because np.moveaxis only change strides and do not make a full memory transpose (this would be very bad for performences). Could you check a change of perf with this moveaxis ? |
|
Hi Samuel, |
|
OK. But we need to keep in mind that (sample, channel, spike_num) order penalize memory acces because if I want to plot one waveforms for one spike all sample will be spreed over the memory block. With high spike count it could affect the speed. Anyway, lets go heahed and we will se if performence are not good. |
* and fixing duplicate correction within baserawio
|
Circle tests are passing, only travis with python 3.4 is from time to time failing, but the reason seems not to be related to my changes. Restarting Travis helped. I reformatted to get rid of the majority of pep8 complaints, but the remaining ones are to be fixed in more io specific PR and not here. |
|
@JuliaSprenger : do you still plan this for neo 0.7 or can we postone to 0.8 ? |
|
@samuelgarcia @apdavison I think this PR won't be merged any more as we should first agree on a solution concept in #829. |
This PR changes the order of the dimensions for waveforms from (spike, channel, time) to (time,spike,channel) in order to be consistent with neo AnalogSignal dimensions (time, channel).
Neo Core and corresponding tests were updated, updates in the IO are still missing.