Skip to content
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

DOC motor task events have 2 super-imposed event_id #62

Open
tomMoral opened this issue Nov 21, 2018 · 11 comments
Open

DOC motor task events have 2 super-imposed event_id #62

tomMoral opened this issue Nov 21, 2018 · 11 comments

Comments

@tomMoral
Copy link

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 tomMoral changed the title BUG event_id should be < 256, but some seems to be duplicated with +256 BUG event_id should be < 256, but some seem to be duplicated with +256 Nov 21, 2018
@dengemann
Copy link
Member

dengemann commented Nov 21, 2018 via email

@agramfort
Copy link
Member

agramfort commented Nov 21, 2018 via email

@tomMoral
Copy link
Author

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 tomMoral changed the title BUG event_id should be < 256, but some seem to be duplicated with +256 DOC motor task events have 2 super-imposed event_id Nov 22, 2018
@dengemann
Copy link
Member

dengemann commented Nov 22, 2018 via email

@jasmainak
Copy link
Member

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

@tomMoral
Copy link
Author

@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).

@dengemann
Copy link
Member

dengemann commented Nov 22, 2018 via email

@tomMoral
Copy link
Author

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.

@dengemann
Copy link
Member

dengemann commented Nov 22, 2018 via email

@tomMoral
Copy link
Author

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.

@dengemann
Copy link
Member

dengemann commented Nov 22, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants