Comments (8)
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.
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.
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.
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.
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.
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.
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.
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)
- Resolution issue with EDF export HOT 12
- Brain and source space are not aligned in the left_cerebellum_volume_source example HOT 1
- Error in VS Code test discovery HOT 3
- Reduce `Expected .fdt file format` error to warning HOT 5
- BUG: get_coef in a pipeline does not work for CSP
- Building the MNE doc fails with Python 3.12 and 3.11 (?) HOT 5
- _extract_sampling_rate function for io.read_raw_snirf incorrectly estimates sample rate due to floating point error. HOT 3
- BUG: EpochsTFR bug popping up in MNE-BIDS-Pipeline HOT 1
- Read_raw_eyelink failure: missing headpos data in file HOT 4
- GDF reader bug HOT 6
- raw.compute_psd("multitaper", ...) on a raw with "bad_xxx" annotations yields all np.nan HOT 1
- BUG: EDF export failing on latest edfio HOT 3
- mne.time_frequency.read_tfrs() did not work correctly when MNE.Raw.compute_tfr(method='multitaper', output='phase') HOT 1
- Complete uninstall documentation missing HOT 3
- set_annotations changes key:value mapping in event_id dict HOT 5
- Be more explicit about what is returned by read_epochs_eeglab and read_epochs_kit HOT 3
- Unicode support in the method add.text() of mne.viz.brain HOT 3
- Can't download the fsaverage data by mne.datasets.fetch_fsaverage(verbose=0) HOT 3
- Bad channels do not show up at all in `raw.plot()` HOT 4
- Mouse Offset in Brain Plot HOT 14
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from mne-python.