Skip to content
Merged
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
11 changes: 6 additions & 5 deletions hed/models/df_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

from hed.models.sidecar import Sidecar
from hed.models.tabular_input import TabularInput
from hed import HedString
from hed.models.hed_string import HedString
from hed.models.definition_dict import DefinitionDict
from hed.models.definition_entry import DefinitionEntry


def get_assembled(tabular_file, sidecar, hed_schema, extra_def_dicts=None, join_columns=True,
Expand All @@ -29,7 +28,7 @@ def get_assembled(tabular_file, sidecar, hed_schema, extra_def_dicts=None, join_
Expand any def tags found
Returns:
tuple: A list of HedStrings or a list of lists of HedStrings, DefinitionDict

"""
if isinstance(sidecar, str):
sidecar = Sidecar(sidecar)
Expand All @@ -52,7 +51,8 @@ def get_assembled(tabular_file, sidecar, hed_schema, extra_def_dicts=None, join_
return [[HedString(x, hed_schema, def_dict).expand_defs() if expand_defs
else HedString(x, hed_schema, def_dict).shrink_defs() if shrink_defs
else HedString(x, hed_schema, def_dict)
for x in text_file_row] for text_file_row in tabular_file.dataframe_a.itertuples(index=False)], def_dict
for x in text_file_row] for text_file_row in tabular_file.dataframe_a.itertuples(index=False)], \
def_dict


def convert_to_form(df, hed_schema, tag_form, columns=None):
Expand Down Expand Up @@ -139,6 +139,7 @@ def _expand_defs(hed_string, hed_schema, def_dict):
from hed import HedString
return str(HedString(hed_string, hed_schema, def_dict).expand_defs())


def _get_matching_value(tags):
# Filter out values equal to "#" and get unique values
unique_values = set(tag.extension for tag in tags if tag.extension != "#")
Expand Down Expand Up @@ -166,4 +167,4 @@ def process_def_expands(hed_strings, hed_schema, known_defs=None, ambiguous_defs
"""
from hed.models.def_expand_gather import DefExpandGatherer
def_gatherer = DefExpandGatherer(hed_schema, known_defs, ambiguous_defs)
return def_gatherer.process_def_expands(hed_strings)
return def_gatherer.process_def_expands(hed_strings)