Skip to content

Commit

Permalink
Make "Used" to contain only unique values and sort them
Browse files Browse the repository at this point in the history
  • Loading branch information
yarikoptic committed Sep 28, 2023
1 parent 784ea7e commit 827b38c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions bids_prov/afni/afni_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,9 @@ def build_records(commands_bloc: list, agent_id: str, verbose: bool = False):
else:
activity["Used"].append(existing_input["@id"])

# Order does not matter and then makes sense to include only unique values
activity["Used"] = sorted(set(activity["Used"]))

for output_path in outputs:
records["Entities"].append(
{
Expand Down
3 changes: 3 additions & 0 deletions bids_prov/fsl/fsl_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -502,6 +502,9 @@ def build_records(groups: Mapping[str, List[str]], agent_id: str):
else:
a["Used"].append(existing_input["@id"])

# Order does not matter and then makes sense to include only unique values
a["Used"] = sorted(set(a["Used"]))

for output_path in outputs:
# output_name = output_path.replace("/", "_") # TODO
records["Entities"].append(
Expand Down
3 changes: 3 additions & 0 deletions bids_prov/spm/spm_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,9 @@ def get_records(task_groups: dict, agent_id: str, verbose=False) -> dict:
param_value = right_ if not right_.startswith("[") else right_.replace(" ", ", ")
params[param_name] = param_value # example : [4 2] becomes [4, 2]

# Order does not matter and then makes sense to include only unique values
activity["Used"] = sorted(set(activity["Used"]))

if params:
activity["Parameters"] = params

Expand Down

0 comments on commit 827b38c

Please sign in to comment.