Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion hed/errors/error_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ def push_error_context(self, context_type, context):
""" Push a new error context to narrow down error scope.

Parameters:
context_type (ErrorContext): A value from ErrorContext representing the type of scope.
context_type (str): A value from ErrorContext representing the type of scope.
context (str, int, or HedString): The main value for the context_type.

Notes:
Expand Down
33 changes: 16 additions & 17 deletions hed/tools/analysis/event_checker.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,8 +181,7 @@ def validate_event_tags(self):
""" Verify that the events in the HED strings validly represent events.

Returns:
dict: A dictionary with the summary information.
set: A set of tags that do not match any of the specified types but are not excluded.
issues: list of issues (each of which is a dictionary with 'code' and 'message' keys).
"""
all_issues = []
error_handler = ErrorHandler()
Expand Down Expand Up @@ -251,10 +250,10 @@ def update_tags(self, tag_set, all_tags):
schema = load_schema_version('8.4.0')

# # Wakeman Henson example
# root_dir = 'g:/HEDExamples/hed-examples/datasets/eeg_ds003645s_hed'
# sidecar_path = os.path.join(root_dir, 'task-FacePerception_events.json')
# tsv_path = os.path.join(root_dir, 'sub-002/eeg/sub-002_task-FacePerception_run-1_events.tsv')
# data_name = 'eeg_ds003645s_hed'
root_dir = 'g:/HEDExamples/hed-examples/datasets/eeg_ds003645s_hed'
sidecar_path = os.path.join(root_dir, 'task-FacePerception_events.json')
tsv_path = os.path.join(root_dir, 'sub-002/eeg/sub-002_task-FacePerception_run-1_events.tsv')
data_name = 'eeg_ds003645s_hed'

# # Attention shift example
# root_dir = 'g:/HEDExamples/hed-examples/datasets/eeg_ds002893s_hed_attention_shift'
Expand All @@ -263,18 +262,18 @@ def update_tags(self, tag_set, all_tags):
# data_name = 'eeg_ds002893s_hed_attention_shift'

# Sternberg example
root_dir = 'g:/HEDExamples/hed-examples/datasets/eeg_ds004117s_hed_sternberg'
sidecar_path = os.path.join(root_dir, 'task-WorkingMemory_events.json')
tsv_path = os.path.join(root_dir, 'sub-001/ses-01/eeg/sub-001_ses-01_task-WorkingMemory_run-1_events.tsv')
data_name = 'eeg_ds004117s_hed_sternberg'
# root_dir = 'g:/HEDExamples/hed-examples/datasets/eeg_ds004117s_hed_sternberg'
# sidecar_path = os.path.join(root_dir, 'task-WorkingMemory_events.json')
# tsv_path = os.path.join(root_dir, 'sub-001/ses-01/eeg/sub-001_ses-01_task-WorkingMemory_run-1_events.tsv')
# data_name = 'eeg_ds004117s_hed_sternberg'

# Create the event summary
events_summary = EventsSummary(schema, tsv_path, sidecar_path, data_name)

# Check the validity of the event tags
issues = events_summary.validate_event_tags()
if issues:
print(f"Errors found in {get_printable_issue_string(issues, '')}")
these_issues = events_summary.validate_event_tags()
if these_issues:
print(f"Errors found in {get_printable_issue_string(these_issues, '')}")
else:
print(f"No errors found in {data_name}.")

Expand All @@ -285,9 +284,9 @@ def update_tags(self, tag_set, all_tags):
if not the_item:
continue
print(f"{the_key}:")
for tag in the_item:
print(f" {tag}")
for the_tag in the_item:
print(f" {the_tag}")

print("Other:")
for tag in others:
print(f" {tag}")
for the_tag in others:
print(f" {the_tag}")