psychoinformatics-de / datalad-hirni

DataLad extension for (semi-)automated, reproducible processing of (medical/neuro)imaging data
http://datalad.org
Other
5 stars 8 forks source link

spec4anything does not work for file in dataset-root #176

Open pvavra opened 3 years ago

pvavra commented 3 years ago

In a new and empty dataset, the following does not work:

# in dataset root
touch somefile
datalad hirni-spec4anything somefile

The error message indicates that hirni is interpreting somefile as the acquisition folder:

[ERROR ] [Errno 20] Not a directory: '/home/.../bug_demo/somefile/studyspec.json' [json_py.py:dum2stream:121] (NotADirectoryError)

(NB: I removed the full path info)

However, moving the file into a subdir and rerunning works.

I think that hirni-spec4anything should also work on arbitrary files in the dataset-root, even though the use-cases might be few.. I came across this during testing of my behavior-logfile converter, which I do in a separate dataset without the dicom-acquisitions.

bpoldrack commented 3 years ago

I think that hirni-spec4anything should also work on arbitrary files in the dataset-root, even though the use-cases might be few..

I agree!

In fact you can do this, but it's not obvious how: The error does not come from the given path, but from the default behavior for figuring the specification file to write to. This should be fixed - absolutely agree, but you can have what you want by circumventing the determination of the target file by specifying it:

datalad hirni-spec4anything --spec-file studyspec.json somefile does what you want.