Skip to content

wrsamp wrong output *.dat filename #153

Done

Description

@Scoodood

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

Activity

  1. changed the title [-]wrsamp output *.dat filename is wrong?[/-] [+]wrsamp wrong output *.dat filename[/+] on Dec 13, 2018
  2. self-assigned this
    on Apr 30, 2020
  3. cx1111 commented on Apr 29, 2022

    @cx1111
    Collaborator

    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.

  4. added a commit that references this issue on Nov 24, 2026
    998888c
  5. added a commit that references this issue on Nov 24, 2026
    05db3a2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions