# splitting fif files

**URL:** <https://mne.discourse.group/t/splitting-fif-files/306>\
**Category:** Mailing List Archive (read-only)\
**Tags:** list-archive\
**Created:** [May 25, 2011, 12:59am UTC](https://mne.discourse.group/t/splitting-fif-files/306 "2011-05-25T00:59:24Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 25, 2011, 12:59am UTC](https://mne.discourse.group/t/splitting-fif-files/306/1 "2011-05-25T00:59:24Z")

</div>

Dear. all.

This is Ji Won Bang from Dr. Sasaki's group at MGH.

I came up with a problem regarding splitting fif files.

Do you know how I can split them into 2 or 3 as I want?

I would appreciate that!

Best regards,  
Ji Won Bang  
-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20110524/7484a50a/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20110524/7484a50a/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 25, 2011, 12:59pm UTC](https://mne.discourse.group/t/splitting-fif-files/306/2 "2011-05-25T12:59:03Z")

</div>

Hi,

if you're willing to give it a try you could easily split your raw fif  
file in python.

> From a Linux machine at MGH do in a terminal:

setenv PATH /usr/pubsw/packages/python/epd/bin:${PATH}

then the following python script should help you do what you want:

-------- beginning of script

from mne import fiff  
from mne.datasets import sample  
data\_path = sample.data\_path('.')

fname = data\_path + '/MEG/sample/sample\_audvis\_raw.fif'

raw = fiff.Raw(fname)

# save the first 150s of MEG data in FIF file  
raw.save('sample\_audvis\_meg\_raw\_part1.fif', tmin=0, tmax=150)  
# save the rest in a second FIF file  
raw.save('sample\_audvis\_meg\_raw\_part2.fif', tmin=150)

--- end of script

if you're lost I can help you tomorrow.

you can get more info at [https://martinos.org/mne/mne-python.html](https://martinos.org/mne/mne-python.html)  
(visible internally only for now)  
and if you feel like it the code is public at  
[GitHub - mne-tools/mne-python: MNE: Magnetoencephalography (MEG) and Electroencephalography (EEG) in Python](https://github.com/mne-tools/mne-python)

Alex

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 25, 2011, 3:02pm UTC](https://mne.discourse.group/t/splitting-fif-files/306/3 "2011-05-25T15:02:32Z")

</div>

You can also split the file into equal-size pieces using mne\_process\_raw:

mne\_process\_raw --split \<size/MB\> --projoff --raw \<raw file\> --save \<output file\>

- Matti

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 25, 2011, 4:14pm UTC](https://mne.discourse.group/t/splitting-fif-files/306/4 "2011-05-25T16:14:10Z")

</div>

Dear. Dr. Hamalainen

Hello. I've tried what you suggested, but I still have a problem.

I typed:

mne\_process\_raw --split \<40911222\> --projoff --raw \<svl2\_day2\_032511.fif\>  
--save \<svl2\_day2\_split.fif\>

Then I got:  
Ambiguous input redirect.

Do you have any idea about this?

I appreciate that!

Best,  
Ji Won Bang

2011/5/25 Matti Hamalainen \<msh at nmr.mgh.harvard.edu\>

> You can also split the file into equal-size pieces using mne\_process\_raw:
> 
> mne\_process\_raw --split \<size/MB\> --projoff --raw \<raw file\> --save  
> \<output file\>
> 
> - Matti
> 
> \> Dear. all.  
> \>  
> \> This is Ji Won Bang from Dr. Sasaki's group at MGH.  
> \>  
> \> I came up with a problem regarding splitting fif files.  
> \>  
> \> Do you know how I can split them into 2 or 3 as I want?  
> \>  
> \> I would appreciate that!  
> \>  
> \> Best regards,  
> \> Ji Won Bang  
> \> \_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_\_  
> \> Mne\_analysis mailing list  
> \> Mne\_analysis at nmr.mgh.harvard.edu  
> \> [https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne\_analysis](https://mail.nmr.mgh.harvard.edu/mailman/listinfo/mne_analysis)
> 
> 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](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.

-------------- next part --------------  
An HTML attachment was scrubbed...  
URL: [http://mail.nmr.mgh.harvard.edu/pipermail/mne\_analysis/attachments/20110525/85d149cc/attachment.html](http://mail.nmr.mgh.harvard.edu/pipermail/mne_analysis/attachments/20110525/85d149cc/attachment.html)

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/free1/uploads/mne/original/1X/85cc6bd2b69cb698a166dc6d880fb550510d0144.jpeg) [@system](https://mne.discourse.group/u/system)\
**Post date:** [May 25, 2011, 4:32pm UTC](https://mne.discourse.group/t/splitting-fif-files/306/5 "2011-05-25T16:32:32Z")

</div>

I looks like it's the \<'s and \>'s that you included in your command line which caused the problem. I think he used those to indicate fields that you have to fill in but not that you should actually include those symbols.

Don

Don Krieger, Ph.D., D.ABNM  
Department of Neurological Surgery  
University of Pittsburgh  
(412)648-9654  
(412)606-2189 Cell
