Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

csv_to_wfdb writes to current dir; needs param to specify output folder #490

Open
jshaffer94247 opened this issue Jun 26, 2024 · 3 comments

Comments

@jshaffer94247
Copy link

csv_to_wfdb currently strips the path from the input .csv, then writes the output to .dat and .hea

Request is for
a) full path to be preserved for the output file (not backward compatible)
b) accept an optional parameter to specify the output folder (preserves backward compatibility)

@jshaffer94247 jshaffer94247 changed the title csv_to_wfdb writes to current dir csv_to_wfdb writes to current dir; needs param to specify output folder Jun 26, 2024
@tompollard
Copy link
Member

@jshaffer94247 not ideal, it should definitely be possible to specify the output directory!

Does adding an output_dir argument sound okay, or do you have a cleaner suggestion?

def csv_to_wfdb(
    ...
    delimiter=",",
    verbose=False,
    output_dir=None,
):

@jshaffer94247
Copy link
Author

I do not have a cleaner suggestion; that's what I'd do.

tompollard added a commit that referenced this issue Jul 11, 2024
As discussed in #490,
https://github.com/MIT-LCP/wfdb-python/blob/34b989e08435c1a82d31bdd2800c4c14147e3e93/wfdb/io/convert/csv.py#L10
currently "strips the path from the input .csv, then writes the output
to .dat and .hea".

It's inconvenient not to be able to specify the output directory. This
pull request adds a new `output_dir` argument to the `csv_to_wfdb`
function. By default `output_dir` is set to None, which will maintain
backwards compatibility. Setting `output_dir` to a directory will mean
that output files are saved to this directory.

I have set this to a WIP, because I haven't tested the new behaviour
(other than running `pytest`). @jshaffer94247, if you have an
opportunity to test the fix, I'd appreciate your feedback.
@tompollard
Copy link
Member

write_dir will be available in the next release. If you'd like to use it now, you should be able to pip install from this repo with:

pip install git+https://github.com/MIT-LCP/wfdb-python.git@6a0de803b4d396fa22da583dfa0d19250d347217

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants