holgern / pyedflib

pyedflib is a python library to read/write EDF+/BDF+ files based on EDFlib.
http://pyedflib.readthedocs.org/
BSD 3-Clause "New" or "Revised" License
209 stars 121 forks source link

Allow file_type option in drop_channels #182

Closed aklos closed 1 year ago

aklos commented 1 year ago

drop_channels forces the target to EDF+ but it should allow you to choose the file type.

skjerns commented 1 year ago

This should already work - just set edf_target to end in .bdf and it should automatically be saved with BDF+

However, this change should be fine as well.

skjerns commented 1 year ago

could you also change the file name accordingly in line 697 and possibly a simple test to test_highlevel.py?

then I'll merge.

aklos commented 1 year ago

This should already work - just set edf_target to end in .bdf and it should automatically be saved with BDF+

However, this change should be fine as well.

The issue is that I actually need a plain EDF (no annotations) to work with wfdb, so inferring from file extension isn't enough.

I'll make the requested changes, thanks!

skjerns commented 1 year ago

right! so vanilla EDF. Then this check makes sense. I would not have thought that vanilla EDF is still used anywhere.

Does pyedflib create valid vanilla EDF files? I do remember there to be some problems

aklos commented 1 year ago

They're valid enough that wfdb can process them. I suppose wfdb 4.0.0 now handles EDF/EDF+ without conversion, but a lot of algorithms still rely on using edf2mit which only accepts vanilla EDFs.

I'm very much a layman when it comes to this stuff. Just trying to get some heartbeat classification models working correctly and wfdb is really hard to understand.

skjerns commented 1 year ago

looks good, thanks a lot!