Giter VIP home page Giter VIP logo

Comments (8)

dengemann avatar dengemann commented on July 24, 2024

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 [email protected] wrote:

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


Reply to this email directly or view it on GitHub.

from mne-python.

larsoner avatar larsoner commented on July 24, 2024

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.

from mne-python.

dengemann avatar dengemann commented on July 24, 2024

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 [email protected] 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.


Reply to this email directly or view it on GitHub.

from mne-python.

larsoner avatar larsoner commented on July 24, 2024

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.

from mne-python.

agramfort avatar agramfort commented on July 24, 2024

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

from mne-python.

mshamalainen avatar mshamalainen commented on July 24, 2024

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.

  • Matti

On Sep 20, 2012, at 1:04 AM, Eric89GXL 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.


Reply to this email directly or view it on GitHub.


Matti Hamalainen, Ph.D.
Athinoula A. Martinos Center for Biomedical Imaging
Massachusetts General Hospital

[email protected]
[email protected]

The information in this e-mail is intended only for the person to whom it is
addressed. If you believe this e-mail was sent to you in error and the e-mail
contains patient information, please contact the Partners Compliance HelpLine at
http://www.partners.org/complianceline . If the e-mail was sent to you in error
but does not contain patient information, please contact the sender and properly
dispose of the e-mail.

from mne-python.

larsoner avatar larsoner commented on July 24, 2024

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!

from mne-python.

larsoner avatar larsoner commented on July 24, 2024

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.

from mne-python.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.