BidsFileGroup

class BidsFileGroup(root_path, file_list, suffix='events')[source]

Container for BIDS files with a specified suffix.

suffix

The file suffix specifying the class of file represented in this group (e.g., events).

Type:

str

sidecar_dict

A dictionary of sidecars associated with this suffix .

Type:

dict

datafile_dict

A dictionary with values either BidsTabularFile or BidsTimeseriesFile.

Type:

dict

sidecar_dir_dict

Dictionary whose keys are directory paths and values are list of sidecars in the corresponding directory.

Type:

dict

Methods

BidsFileGroup.__init__(root_path, file_list)

Constructor for a BidsFileGroup.

BidsFileGroup.create_file_group(root_path, ...)

BidsFileGroup.summarize([value_cols, skip_cols])

Return a BidsTabularSummary of group files.

BidsFileGroup.validate(hed_schema[, ...])

Validate the sidecars and datafiles and return a list of issues.

BidsFileGroup.validate_datafiles(hed_schema)

Validate the datafiles and return an error list.

BidsFileGroup.validate_sidecars(hed_schema)

Validate merged sidecars.

Attributes

BidsFileGroup.__init__(root_path, file_list, suffix='events')[source]

Constructor for a BidsFileGroup.

Parameters:
  • file_list (list) – List of paths to the relevant tsv and json files.

  • suffix (str) – Suffix indicating the type this group represents (e.g. events, or channels, etc.).

static BidsFileGroup.create_file_group(root_path, file_list, suffix)[source]
BidsFileGroup.summarize(value_cols=None, skip_cols=None)[source]

Return a BidsTabularSummary of group files.

Parameters:
  • value_cols (list) – Column names designated as value columns.

  • skip_cols (list) – Column names designated as columns to skip.

Returns:

A summary of the number of values in different columns if tabular group.

Return type:

TabularSummary or None

Notes

  • The columns that are not value_cols or skip_col are summarized by counting

the number of times each unique value appears in that column.

BidsFileGroup.validate(hed_schema, extra_def_dicts=None, check_for_warnings=False)[source]

Validate the sidecars and datafiles and return a list of issues.

Parameters:
  • hed_schema (HedSchema) – Schema to apply to the validation.

  • extra_def_dicts (DefinitionDict) – Extra definitions that come from outside.

  • check_for_warnings (bool) – If True, include warnings in the check.

Returns:

A list of validation issues found. Each issue is a dictionary.

Return type:

list

BidsFileGroup.validate_datafiles(hed_schema, extra_def_dicts=None, error_handler=None)[source]

Validate the datafiles and return an error list.

Parameters:
  • hed_schema (HedSchema) – Schema to apply to the validation.

  • extra_def_dicts (DefinitionDict) – Extra definitions that come from outside.

  • error_handler (ErrorHandler) – Error handler to use.

Returns:

A list of validation issues found. Each issue is a dictionary.

Return type:

list

Notes: This will clear the contents of the datafiles if they were not previously set.

BidsFileGroup.validate_sidecars(hed_schema, extra_def_dicts=None, error_handler=None)[source]

Validate merged sidecars.

Parameters:
  • hed_schema (HedSchema) – HED schema for validation.

  • extra_def_dicts (DefinitionDict) – Extra definitions.

  • error_handler (ErrorHandler) – Error handler to use.

Returns:

A list of validation issues found. Each issue is a dictionary.

Return type:

list