From d262c55d88ca2d1588eb740af228925bde7c5dc9 Mon Sep 17 00:00:00 2001 From: Yaroslav Halchenko Date: Wed, 25 Jan 2023 12:52:43 -0500 Subject: [PATCH] Do not issue warning if cannot parse _task entity MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Also adjusted docstring to note that now _task- can be used in many other modalities ❯ git grep -l -B4 -E 'task: (r|o)' src/schema/README.md src/schema/rules/files/raw/anat.yaml src/schema/rules/files/raw/beh.yaml src/schema/rules/files/raw/channels.yaml src/schema/rules/files/raw/eeg.yaml src/schema/rules/files/raw/func.yaml src/schema/rules/files/raw/ieeg.yaml src/schema/rules/files/raw/meg.yaml src/schema/rules/files/raw/nirs.yaml src/schema/rules/files/raw/pet.yaml src/schema/rules/files/raw/task.yaml and overall -- even if required for some modality (e.g. func) IMHO we should not redo bids-validator functionality here. It should be validator to report oddities (may be we should bolt on integration with basic validation present in bidsschematools). --- heudiconv/convert.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/heudiconv/convert.py b/heudiconv/convert.py index 362c0544..4e5e2115 100644 --- a/heudiconv/convert.py +++ b/heudiconv/convert.py @@ -860,7 +860,10 @@ def save_converted_files(res, item_dicoms, bids_options, outtype, prefix, outnam def add_taskname_to_infofile(infofiles): - """Add the "TaskName" field to json files corresponding to func images. + """Add the "TaskName" field to json files with _task- entity in the name. + + Note: _task- entity could be present not only in functional data + but in many other modalities now. Parameters ---------- @@ -879,7 +882,8 @@ def add_taskname_to_infofile(infofiles): op.basename(infofile)) .group(0).split('_')[0]) except AttributeError: - lgr.warning("Failed to find task field in {0}.".format(infofile)) + # leave it to bids-validator to validate/inform about presence + # of required entities/fields. continue # write to outfile