Saving a file in EDF format

External Email - Use Caution

Hi:

Is it posible to save a raw object in EDF format?

The details of what I'm trying to do are as follow. I have a Biosemi
BDF file that I read with `https://ohbm-openscience.org/`. I then
modify the trigger signal of this raw object:

raw[mne.pick_types(raw.info, include=['STI 014']), :] = trigger

(I think that how and why I need to change the trigger is not
relevant, but I can give details if that is useful)

Now I want to save the raw object as a BDF file, but I haven't find
how. I can do raw.save, but that save the raw object as a FIF file.

The reason I need a BDF file back is that the file will be processed
by another person using Brainvision, and it seems this software is not
able to open FIF files.

I have also search for tools outside MNE to convert from FIF to BDF
with out succes.

Alejandro

External Email - Use Caution

Sorry for the copy paste error. Instead of
"https://ohbm-openscience.org/" it should say "mne.io.read_raw_edf"

External Email - Use Caution

Since you want to open it up in Brainvision, why not just export to
BrainVision format?

https://philistine.readthedocs.io/en/master/api/philistine.mne.write_raw_brainvision.html#philistine.mne.write_raw_brainvision

That function isn't yet in the PyPI release, so you'll have to install
via Git:

python -m pip install --user --upgrade?
git+https://gitlab.com/palday/philistine.git

In my preliminary tests, the triggers and raw data match when reading in
a BV file, writing it out, and then reading it back in, but I haven't
yet tested everything extensively. If you find a bug, please report it!

Phillip

External Email - Use Caution

Thank you Phillip for the answer.

I tried saving to a BV file using your function, but my laptop
completely freeze. I had to hard reset the laptop to bring it back.

The raw object is big (around 900 MB), and after calling
philistine.mne.write_raw_brainvision, the laptop run out of RAM and
starts using the swap. I would expect that to be slow, but not to
freeze the machine. I don't know if there is something odd with my
machine or if it's the function that misbehave. I'll try tomorrow with
another machine and see how it goes.

Alejandro

External Email - Use Caution

It seems it's a problem with the configuration of my machine. The
behavior I observe is described here:

https://superuser.com/questions/1115983/prevent-system-freeze-unresponsiveness-due-to-swapping-run-away-memory-usage
https://unix.stackexchange.com/questions/271765/machine-freezes-once-it-hits-swap-space-under-heavy-load

I'll see if I can fix it.

Alejandro

External Email - Use Caution

I tried again and waited for a long time. The laptop come back to life
and now I have three files that looks like what BV wants. I'll let you
know if BV is able to open the file.

Thanks again.
Alejandro