[Mne_analysis] Grand Averaging from Text Events Files

conrad at nmr.mgh.harvard.edu conrad at nmr.mgh.harvard.edu
Wed Jan 25 15:08:03 EST 2012
Search archives:

Brian,

I'm not sure why you need to change the events by an offset. I'll explain
my approach to the same problem (rewriting new .eve files based on subject
criteria eg. correctness). From your description, I am not sure what you
mean by offsets, and I think if your triggers were at the right times you
don't want to rewrite or readd any offsets just use the original event
timing. (If you do want to change the timing of triggers that is another
problem my lab has to deal with. We have a solution but haven't tested it
out yet)

I contain all of my subject (and study) variables in structures, hopefully
their syntax is intuitive so I don't need to explain it. I do this in
Matlab, but if you use a different programming environment I may be able
to help you translate.

Presume we have already extracted event files from each of the raw data
blocks.

> event_file = sprintf('%s/triggers/%s_%s.eve',...
>   subject.meg.dir, subject.name, block);
> events = load(event_file);

Matlab's load command loads them perfectly. Now events is a N row by 4
column matrix representing the data from the .eve file. Then my code goes
line by line, finding events that correspond to triggers we sent and the
next user input and evaluates their action. For events that we will use in
the analysis I reassign by:

> events(i, 4) = some_code;

I do not delete events I will not use. I presume you still could by doing:

> events(i, :) = [];
or just make a new events matrix for ones you will include
> new_events(end + 1, :) = events(i, :);
just make sure to include the initial line before you do that
> new_events(1, :) = events(1, :);

Then I make a new event_file and reprint every line based on the events
matrix.

> event_file = sprintf('%s/triggers/%s_%s_applied.eve',...
>   subject.meg.dir, subject.name, block);
> fid = fopen(event_file);
> for i = 1:size(events, 1)
>   fprintf(fid, '%6d %3.3f %6d %3d\n',...
>     events(i, 1), events(i, 2), events(i, 3), events(i, 4));
> end
> fclose(fid);

I hope that makes some sense and could be useful. Good luck with it!

- Conrad Nied
Neuropsychology Lab @ MGH, David Gow
617 724 8846
conrad at martinos.org

> Hello MNE users,
> I am having an odd issue that I am having trouble conceptualizing.
>
> I am averaging data that is split into 3 raw data files, then taking the
> events files generated from these averages and modifying these events
> files
> to include only events where the subject responded correctly. I am then
> taking these corrected events files and grand averaging the raw data to
> end
> up with a single .fif average which is corrected for our behavioral data.
>
> The issue I am having is related ot the initial offsets in the events
> files. In all cases, there is an initial offset greater than zero for the
> 2nd and 3rd raw data files. In some cases, there is also an initial offset
> of a few seconds in the events file for the first of the three raw data
> files. It seems from the log files that the offset is being utilized
> differently for the two cases (a few seconds offset vs a whole dataset
> offset). For the log from the first file, the offset is added to the
> times,
> while for the other files, the offset is not added. For example, with an
> initial offset of 4 seconds, the log for the uncorrected average starts at
> 29.555 seconds, while for the corrected data, the log starts at 33.555
> seconds. The logs are identical for the second and third data files. This
> is also apparent in the averages, as there is no signal in the corrected
> average of the first raw file. It seems that the offsets are necessary for
> the later files (data files 2 and 3), however, as I get no averages
> without
> them.
>
> My question is: Should I eliminate these offsets from the first text
> events
> file when averaging from events files? Is there something I have not
> considered here?
>
>
> Thanks in advance!!
>
> -Brian Coffman, M.S.
> Research Associate, The Mind Research Network
> Doctoral Candidate, The University of New Mexico
>
> Phone: (505) 336-0606
> Fax: (505) 272-7011
>
> "I used to think that the brain was the most wonderful organ in my body.
> Then I realized who was telling me this."
>   - Emo Phillips
> _______________________________________________
> Mne_analysis mailing list
> Mne_analysis at nmr.mgh.harvard.edu
> https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis




More information about the Mne_analysis mailing list