Repository navigation
Commit 16877aa
authored
Fix record name and add write_dir in csv2ann (#599)
Closes #595.
- The record name is now
`os.path.splitext(os.path.basename(file_name))[0]`, the same as in
`csv_to_wfdb`. Before, `file_name.split(".")[0]` turned `./x.csv` into
`""` and `data/v1.2/x.csv` into `data/v1`.
- New `write_dir` argument (default `""`, the current directory), passed
to `wrann`. It's added at the end of the signature so positional calls
keep working.
- Tests for time onsets, sample onsets without a header, and paths with
dots (`./x.csv`, `data/v1.2/x.csv`). The two tests that exercise the fix
fail on `main`.
- `csv2ann` is added to `docs/convert.rst`. The docs build passes with
`-W`.
**Behaviour change:** the annotation file used to be written next to the
CSV file (for paths without other dots). Now it's written to
`write_dir`, like `csv_to_wfdb`. That follows the note in #595 that both
functions should write to the same place. If you'd prefer to keep the
old location as the default, I can make `write_dir=None` mean "next to
the CSV file" instead.
`ruff check` is clean and `pytest -m "not network"` passes (85 tests).4 files changed
Lines changed: 67 additions & 11 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
23 | 23 | | |
24 | 24 | | |
25 | 25 | | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
26 | 29 | | |
27 | 30 | | |
28 | 31 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
482 | 482 | | |
483 | 483 | | |
484 | 484 | | |
| 485 | + | |
485 | 486 | | |
486 | 487 | | |
487 | 488 | | |
| |||
490 | 491 | | |
491 | 492 | | |
492 | 493 | | |
493 | | - | |
494 | | - | |
495 | | - | |
496 | | - | |
497 | | - | |
| 494 | + | |
| 495 | + | |
| 496 | + | |
| 497 | + | |
498 | 498 | | |
499 | 499 | | |
500 | 500 | | |
| |||
522 | 522 | | |
523 | 523 | | |
524 | 524 | | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
525 | 528 | | |
526 | 529 | | |
527 | 530 | | |
| |||
627 | 630 | | |
628 | 631 | | |
629 | 632 | | |
630 | | - | |
631 | | - | |
| 633 | + | |
632 | 634 | | |
633 | 635 | | |
634 | 636 | | |
| |||
652 | 654 | | |
653 | 655 | | |
654 | 656 | | |
655 | | - | |
| 657 | + | |
656 | 658 | | |
657 | 659 | | |
658 | 660 | | |
| |||
664 | 666 | | |
665 | 667 | | |
666 | 668 | | |
667 | | - | |
| 669 | + | |
668 | 670 | | |
669 | 671 | | |
670 | 672 | | |
| |||
673 | 675 | | |
674 | 676 | | |
675 | 677 | | |
| 678 | + | |
676 | 679 | | |
677 | 680 | | |
678 | 681 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
| 6 | + | |
6 | 7 | | |
7 | 8 | | |
8 | 9 | | |
| |||
145 | 146 | | |
146 | 147 | | |
147 | 148 | | |
| 149 | + | |
| 150 | + | |
| 151 | + | |
| 152 | + | |
| 153 | + | |
| 154 | + | |
| 155 | + | |
| 156 | + | |
| 157 | + | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
| 164 | + | |
| 165 | + | |
| 166 | + | |
| 167 | + | |
| 168 | + | |
| 169 | + | |
| 170 | + | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
| 180 | + | |
| 181 | + | |
| 182 | + | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
| 186 | + | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
| 190 | + | |
| 191 | + | |
| 192 | + | |
| 193 | + | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
0 commit comments