wfdb-python icon indicating copy to clipboard operation
wfdb-python copied to clipboard

wrsamp wrong output *.dat filename

Open Scoodood opened this issue 6 years ago • 1 comments

I follow demo #10 to clone from an existing record with this code.

rec = wfdb.rdrecord('sample-data/100', physical=False)
rec.record_name = '100_cloned'
rec.wrsamp()

2 files were created

100.dat
100_cloned.hea

May I know why the *.dat file was not rename to 100_cloned.dat? Is this a bug or by design?

If it's by design, I think there is a flaw. Suppose I clone a record, modify the waveform, and save to the same folder, then the original 100.dat will be overwritten! Isn't that a bad thing? Please advice

Scoodood avatar Dec 13 '18 20:12 Scoodood

It's by design, since:

  • A record has one header file with with the same base name.
  • A record can contain zero or more signals, distributed in zero or more dat files. So it's not a 1:1 mapping.

https://github.com/wfdb/wfdb-spec/blob/main/spec/RECORDS.md

It is a little confusing. In your case, you should also update the file_name field of the record before writing. We should add an example.

cx1111 avatar Apr 29 '22 21:04 cx1111