Open psadil opened 4 months ago
If all you want to do is get the same file but .json
, then I think bidsfile.path.replace(file.entities['extension'], '.json')
will do the trick.
The entities are a bit of a mess, due to the conflation of all path components (and, as you note, fmap
) in entities.
It seems unlikely that anybody's using that undocumented "entity", that is just the same as suffix for fieldmaps, but removing it properly would take a deprecation cycle. Feel free to add a config option:
https://github.com/bids-standard/pybids/blob/master/bids/config.py
There's not a lot of churn, so the deprecation is likely to take a while, but there's no reason we can't start it.
I'm not entirely sure that this is expected to work, but it was a bit surprising to me. One of the entities associated with the fmap nifti is
"fmap": "epi"
. Butget
ting files with that entity excludes the associated json sidecar. I expected the json sidecar to have the same entities as the nifti, but for the extension.