-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Equivalent for mne_mark_bad_channels #101
Comments
Wouldn't it be sufficient just to add the appropriate channel name to the respective raw.info['bads'] ? On 20.09.2012, at 02:46, Eric89GXL notifications@github.com wrote:
|
I assume that that, followed by a save() would work---when I looked at the how Raw.save() was coded, I thought it would cause it to re-write all the data to disk, though. It's possible I mis-read the code, though, so I'll give it a shot tomorrow. |
You have to explicitly pass a name to save which is different from raw.info['filename'] if i understand you problem right. -Denis On 20.09.k2012, at 03:34, Eric89GXL notifications@github.com wrote:
|
Yeah, I think that's what it was. mne_mark_bad_channels is nice because it operates on the file itself, I believe without needing to re-write / duplicate the data. In the meantime I'll probably just save to a different file and replace the old one until there's a more elegant solution. |
indeed mne_mark_bad_channels avoids duplicating the file. I could look into this. The thing is that since I work with python functions It just works to do raw.info['bads'] = ['...'] but I agree that its nice to store in the file the bad channels... |
mne_mark_bad_channels makes use of the fact that the tags in a fif file form a linked list. Therefore, you can add new tags, in this case the bad channel list, in the middle of the existing tag list without having to move the remainder of the file forward. The bad channel list is thus physically located at the end of the file but logically in the middle of it. Furthermore, when a bad channel list is modified, mne_mark_bad_channels marks the existing list as "free space" and writes a new bad channel tag according to the new bad channel specification. This was necessary because the tag data sizes can be different. I suppose all of this could be done in Python, too. However, when I wrote the MNE Matlab code I felt it was not necessary to include support for the rarely used fif features employed in mne_mark_bad_channels.
On Sep 20, 2012, at 1:04 AM, Eric89GXL wrote:
Matti Hamalainen, Ph.D. msh@nmr.mgh.harvard.edu The information in this e-mail is intended only for the person to whom it is |
That makes sense. It occurred to me that since we're porting our analysis stream to Python now, we should be able to just use what you all suggested and set the raw.info['bads'] directly, since we can combine that step in preprocessing with filtering, SSP, etc. before writing out the processed files. Feel free to close this issue! |
Is it alright if I add a function to fiff.raw called mark_bad_channels that reads in bad channels from a text file and marks them in raw.info? I think it would decrease the barrier of entry for folks who were already making use of saving bad channels in text files. |
Currently making system calls to accomplish this. Perhaps it could currently be done by reading a raw fif and writing it out again, but I imagine this will be slow as it will have to re-write all the channel data (I assume this is not what the C code does?).
The text was updated successfully, but these errors were encountered: