BUNPC / pysnirf2

Python package for reading, writing and validating Shared Near Infrared Spectroscopy Format (SNIRF) files
GNU General Public License v3.0
15 stars 11 forks source link

`copy()` creates an empty file called `r+.snirf` #38

Closed zEdS15B3GCwq closed 11 months ago

zEdS15B3GCwq commented 1 year ago

Minimal code to demonstrate problem:

from snirf import Snirf

with Snirf("test.snirf") as test:
    test.copy()

This produces 2 files: test.snirf as expected, and r+.snirf, which should not be created.

snirf 0.7.4 python 3.11.4 windows 11

Update: r+.snirf is created in the current working directory, no matter the path of the original file.

sstucker commented 1 year ago

Thanks--be advised copy functions were the latest addition to this package and may have other issues that are yet to surface. I recall they required a lot of HDF-fu

This is caused by a simple misuse of the the Snirf constructor in the copy method. I can release a fixed version soon, although if you are making use of the copy systems I urge you to contribute directly in the future as other fixes may be needed

zEdS15B3GCwq commented 1 year ago

Good to know, I'll probably avoid using copy() for now. Thanks for the quick response.