You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fs paramater specification causing problem in load_physio #10
In the generate_physio function, when load_physio is called, it uses the fs specified in the parameters of generate_physio. However, for '.phys' files, this causes problem since the fs information can be retrieved from the file directly. So having fs=None (default value) lead to a fs value of NOTHING (enum type) after loading the file...
Since the fs parameters should still be specified if loading any file format that is not .phys, I would propose to create another mode to separate those different format rather than grouping everything under mode="physio"
I didn't have a look at the code yet, is it possible that passing arguments more carefully will solve the problem?
Also, yes, fs should be in a 'phys' file, but they should also be in the json file in BIDS format, and I don't remember us supporting anything else than that?
Worth adding a check in the affected function rather than duplicating code, but maybe you have another solution in mind I'm not 100% understanding.
Ah I see. Then yes, please separate the .physio from the other formats, creating another I/O function for those. In those, we can make sure that fs is given while loading somehow.
Unrelated, here's some code for input of those formats:
if isinstance(data, str):
if os.path.exists(data):
ext = os.path.splitext(data)[-1]
if ext == '.gz':
ext == os.path.splitext(os.path.splitext(data)[0])[-1]
if ext == '.tsv':
data = np.genfromtxt(data, delimiter='\t')
elif ext == '.csv':
data = np.genfromtxt(data, delimiter=',')
else:
data = np.genfromtxt(data)
else:
raise IOError(f'Cannot find {data}')
You can also use reading functions form phys2bids on top of that!
Activity
me-pic commentedon Oct 28, 2024
@smoia wdyt ?
smoia commentedon Oct 28, 2024
I didn't have a look at the code yet, is it possible that passing arguments more carefully will solve the problem?
Also, yes, fs should be in a 'phys' file, but they should also be in the json file in BIDS format, and I don't remember us supporting anything else than that?
Worth adding a check in the affected function rather than duplicating code, but maybe you have another solution in mind I'm not 100% understanding.
me-pic commentedon Oct 28, 2024
Should we then constrain the possible file extension here to only
.physhere ?smoia commentedon Oct 28, 2024
Ah I see. Then yes, please separate the
.physiofrom the other formats, creating another I/O function for those. In those, we can make sure thatfsis given while loading somehow.Unrelated, here's some code for input of those formats:
You can also use reading functions form phys2bids on top of that!
me-pic commentedon Oct 29, 2024
Thank you for that block of code, will integrate that !