mne-hcp icon indicating copy to clipboard operation
mne-hcp copied to clipboard

Sorting events with np.sort

Open wronk opened this issue 7 years ago • 3 comments

In the plot_reproduce_erf.py tutorial, there's a line where the events are sorted as follows:

events = np.sort(events, 0)

Is this intended? It seems like this would break the relationship between event time stamps (in 0-th column) and the event IDs (in 2nd column) -- calling the np.sort function in this way will only sort the 0th column while leaving all other columns the same.

Example:

In [47]: temp
Out[47]: 
array([[6, 1],
       [5, 2],
       [4, 3]])

In [48]: np.sort(temp, 0)
Out[48]: 
array([[4, 1],
       [5, 2],        
       [6, 3]])

wronk avatar Apr 20 '17 23:04 wronk

It's a bug/misnomer/slip I think.

On Thu, Apr 20, 2017 at 7:04 PM Mark Wronkiewicz [email protected] wrote:

In the plot_reproduce_erf.py tutorial, there's a line https://github.com/mne-tools/mne-hcp/blob/master/tutorials/plot_reproduce_erf.py#L118 where the events are sorted as follows:

events = np.sort(events, 0)

Is this intended? It seems like this would break the relationship between event time stamps (in 0-th column) and the event IDs (in 2nd column) -- calling the np.sort function in this way will only sort the 0th column while leaving all other columns the same.

Example:

In [47]: temp Out[47]: array([[6, 1], [5, 2], [4, 3]])

In [48]: np.sort(temp, 0) Out[48]: array([[4, 1], [5, 2], [6, 3]])

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/mne-tools/mne-hcp/issues/55, or mute the thread https://github.com/notifications/unsubscribe-auth/AB0fitCxrUSQmUdli0Gj9AeglUnG6DG-ks5rx-RigaJpZM4NDrc_ .

dengemann avatar Apr 20 '17 23:04 dengemann

Alright, I'll put in a PR tomorrow or Monday.

wronk avatar Apr 20 '17 23:04 wronk

Important is that things are sorted by time stamp. It should increase the correlation in the plots at the end.

On Thu, Apr 20, 2017 at 7:11 PM Mark Wronkiewicz [email protected] wrote:

Alright, I'll put in a PR tomorrow or Monday.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/mne-tools/mne-hcp/issues/55#issuecomment-295959951, or mute the thread https://github.com/notifications/unsubscribe-auth/AB0fit0zpDVMuHAKfbwbdp24avEFg2wIks5rx-YygaJpZM4NDrc_ .

dengemann avatar Apr 20 '17 23:04 dengemann