Skip to content

Commit

Permalink
Merge pull request #768 from VisLab/develop
Browse files Browse the repository at this point in the history
Create separate dispatcher for each task in remodeling comand line processing
  • Loading branch information
VisLab authored Sep 12, 2023
2 parents 53a85c6 + b5776e2 commit ccfe535
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 5 deletions.
2 changes: 2 additions & 0 deletions hed/tools/analysis/hed_tag_counts.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ def update_event_counts(self, hed_string_obj, file_name):
"""
if file_name not in self.files:
self.files[file_name] = ""
if not hed_string_obj:
return
tag_list = hed_string_obj.get_all_tags()
tag_dict = {}
for tag in tag_list:
Expand Down
5 changes: 3 additions & 2 deletions hed/tools/remodeling/cli/run_remodel.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,14 +197,15 @@ def main(arg_list=None):
if not os.path.isdir(args.data_dir):
raise HedFileError("DataDirectoryDoesNotExist", f"The root data directory {args.data_dir} does not exist", "")
backup_name = handle_backup(args)
dispatch = Dispatcher(operations, data_root=args.data_dir, backup_name=backup_name, hed_versions=args.hed_versions)
save_dir = None
if args.work_dir:
save_dir = os.path.realpath(os.path.join(args.work_dir, Dispatcher.REMODELING_SUMMARY_PATH))
files = get_file_list(dispatch.data_root, name_suffix=args.file_suffix, extensions=args.extensions,
files = get_file_list(args.data_dir, name_suffix=args.file_suffix, extensions=args.extensions,
exclude_dirs=args.exclude_dirs)
task_dict = parse_tasks(files, args.task_names)
for task, files in task_dict.items():
dispatch = Dispatcher(operations, data_root=args.data_dir, backup_name=backup_name,
hed_versions=args.hed_versions)
if args.use_bids:
run_bids_ops(dispatch, args, files)
else:
Expand Down
4 changes: 2 additions & 2 deletions hed/tools/remodeling/operations/base_summary.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,11 @@ def _save_summary_files(self, save_dir, file_format, summary, individual_summari
time_stamp = '_' + get_timestamp()
else:
time_stamp = ''
if task_name:
if task_name:
task_name = "_" + task_name
this_save = os.path.join(save_dir, self.op.summary_name + '/')
os.makedirs(os.path.realpath(this_save), exist_ok=True)
filename = os.path.realpath(os.path.join(this_save,
filename = os.path.realpath(os.path.join(this_save,
self.op.summary_filename + task_name + time_stamp + file_format))
individual = summary.get("Individual files", {})
if individual_summaries == "none" or not individual:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ def do_op(self, dispatcher, df, name, sidecar=None):
Returns:
DataFrame: A copy of df.
Side-effect:
Side effect:
Updates the relevant summary.
"""
Expand Down

0 comments on commit ccfe535

Please sign in to comment.