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

DOC motor task events have 2 super-imposed event_id

Open tomMoral opened this issue 6 years ago • 11 comments

In HCP documentation, it is stated that the codes for Motor tasks should be bellow 256. (see page 13 here).

However, loading a subject with hcp gives event ids [ 18 22 34 38 66 70 130 134 274 278 290 294 322 326 386 390]. If you take the modulus 256 on the events, it seems that you recover the proper event ids.

I am not sure if this is a bug in the loading of the event ids or if I am missing something here?

import hcp
import mne

HCP_DIR = "/path/to/HCP/data"
subject="581450"
data_type = "task_motor"
run_index = 1
raw = hcp.read_raw(subject, data_type=data_type, run_index=run_index,
                   hcp_path=HCP_DIR, verbose=0)
events = mne.find_events(raw)
print(np.unique(events[:, 2] % 256))
Trigger channel has a non-zero initial value of 2 (consider using initial_event=True to detect this event)
Removing orphaned offset at the beginning of the file.
694 events found
Event IDs: [ 18  22  34  38  66  70 130 134 274 278 290 294 322 326 386 390]

tomMoral avatar Nov 21 '18 15:11 tomMoral

Probably a bug / lack of knowledge. If we can convince ourselves this is the right thing to do we should fix it or document it. On Wed 21 Nov 2018 at 16:54, Thomas Moreau [email protected] wrote:

In HCP documentation, it is stated that the codes for Motor tasks should be bellow 256. (see page 13 here https://www.humanconnectome.org/storage/app/media/documentation/s900/HCP_S900_Release_Appendix_VI.pdf ).

However, loading a subject with hcp gives event ids [ 18 22 34 38 66 70 130 134 274 278 290 294 322 326 386 390]. If you take the modulus 256 on the events, it seems that you recover the proper event ids.

I am not sure if this is a bug in the loading of the event ids or if I am missing something here?

import hcpimport mne HCP_DIR = "/path/to/HCP/data" subject="581450" data_type = "task_motor" run_index = 1 raw = hcp.read_raw(subject, data_type=data_type, run_index=run_index, hcp_path=HCP_DIR, verbose=0) events = mne.find_events(raw)print(np.unique(events[:, 2] % 256))

Trigger channel has a non-zero initial value of 2 (consider using initial_event=True to detect this event) Removing orphaned offset at the beginning of the file. 694 events found Event IDs: [ 18 22 34 38 66 70 130 134 274 278 290 294 322 326 386 390]

— 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/62, or mute the thread https://github.com/notifications/unsubscribe-auth/AB0finANeEmExOp801ibNsq8L915omlMks5uxXcjgaJpZM4YtZ4g .

dengemann avatar Nov 21 '18 17:11 dengemann

how can we test / check this?

agramfort avatar Nov 21 '18 22:11 agramfort

I discovered a great resource: the HCP Manual...

From bottom of page 62, the value is the right one. The 255 addition is the photodiode trigger sequence. So it is not a bug.

tomMoral avatar Nov 22 '18 10:11 tomMoral

I discovered a great resource: the HCP Manual https://www.humanconnectome.org/storage/app/media/documentation/s900/HCP_S900_Release_Reference_Manual.pdf ...

LOL. Yes this you need under your pillow when working with HCP :)

From bottom of page 62, the value is the right one. The 255 addition is the photodiode trigger sequence. So it is not a bug.

Great sounds like we can then programmatically include that.

On Thu, Nov 22, 2018 at 11:08 AM Thomas Moreau [email protected] wrote:

I discovered a great resource: the HCP Manual https://www.humanconnectome.org/storage/app/media/documentation/s900/HCP_S900_Release_Reference_Manual.pdf ...

From bottom of page 62, the value is the right one. The 255 addition is the photodiode trigger sequence. So it is not a bug.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mne-tools/mne-hcp/issues/62#issuecomment-440979067, or mute the thread https://github.com/notifications/unsubscribe-auth/AB0fiu-P2oMfi31kcR9b9eveLq3LeL8Tks5uxnesgaJpZM4YtZ4g .

dengemann avatar Nov 22 '18 10:11 dengemann

I think that's why we have the mask parameter in mne.find_events ...

jasmainak avatar Nov 22 '18 16:11 jasmainak

@jasmainak thank you very much! It is way cleaner now to get the events with:

events = mne.find_events(raw, consecutive=True, mask=255)

I will try to do an example to explain how to get the events from raw data, and add some info about how to parse this info (event_ids name and structure).

tomMoral avatar Nov 22 '18 18:11 tomMoral

Can you update also existing examples? On Thu 22 Nov 2018 at 19:01, Thomas Moreau [email protected] wrote:

@jasmainak https://github.com/jasmainak thank you very much! It is way cleaner now to get the events with:

events = mne.find_events(raw, consecutive=True, mask=255)

I will try to do an example to explain how to get the events from raw data, and add some info about how to parse this info (event_ids name and structure).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mne-tools/mne-hcp/issues/62#issuecomment-441096363, or mute the thread https://github.com/notifications/unsubscribe-auth/AB0figag3ChmiO3XLBZVFrcEmAjSwE7Rks5uxuaWgaJpZM4YtZ4g .

dengemann avatar Nov 22 '18 18:11 dengemann

There is only one example retrieving the stim and its retrieving it thru hcp.read_trial_info.

Also, there is currently no example using task_motor. So I think adding an example which only explain the data is a good addition.

tomMoral avatar Nov 22 '18 18:11 tomMoral

Yes absolutely. I was only wondering if other examples may also be affected. On Thu 22 Nov 2018 at 19:38, Thomas Moreau [email protected] wrote:

There is only one example retrieving the stim and its retrieving it thru hcp.read_trial_info.

Also, there is currently no example using task_motor. So I think adding an example which only explain the data is a good addition.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mne-tools/mne-hcp/issues/62#issuecomment-441101666, or mute the thread https://github.com/notifications/unsubscribe-auth/AB0fik3cWNQxyHn5CRDHcujR-ugjTryOks5uxu9BgaJpZM4YtZ4g .

dengemann avatar Nov 22 '18 19:11 dengemann

The example I am planning to do is to expose the different protocols for each of the tMEG. I have a clear view for task_motor but I still need some digging for the others.

It could definitely be updated in other examples but I am unsure of the difference between hcp.read_trial_info and the TRIGGER channel. I will have a look when I try to parse what is happening for other tasks, as other examples rely on task_working_memory.

tomMoral avatar Nov 22 '18 19:11 tomMoral

Ideally we can see if by sanitizing the trigger we can reconstruct the trial info somehow -> generate same outputs. On Thu 22 Nov 2018 at 20:16, Thomas Moreau [email protected] wrote:

The example I am planning to do is to expose the different protocols for each of the tMEG. I have a clear view for task_motor but I still need some digging for the others.

It could definitely be updated in other examples but I am unsure of the difference between hcp.read_trial_info and the TRIGGER channel. I will have a look when I try to parse what is happening for other tasks, as other examples rely on task_working_memory.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/mne-tools/mne-hcp/issues/62#issuecomment-441106688, or mute the thread https://github.com/notifications/unsubscribe-auth/AB0fiqViGTBCMqeXL-CVf-5tfAbmdLNfks5uxvf4gaJpZM4YtZ4g .

dengemann avatar Nov 22 '18 19:11 dengemann