BidsFile

class BidsFile(file_path)[source]

A BIDS file with entity dictionary.

file_path

Real path of the file.

Type:

str

suffix

Suffix part of the filename.

Type:

str

ext

Extension (including the .).

Type:

str

entity_dict

Dictionary of entity-names (keys) and entity-values (values).

Type:

dict

sidecar

Merged sidecar for this file.

Type:

BidsSidecarFile

Notes

  • This class may hold the merged sidecar giving metadata for this file as well as contents.

Methods

hed.tools.bids.bids_file.BidsFile.__init__(...)

Constructor for a file path.

hed.tools.bids.bids_file.BidsFile.clear_contents()

Set the contents attribute of this object to None.

hed.tools.bids.bids_file.BidsFile.get_entity(...)

hed.tools.bids.bids_file.BidsFile.get_key([...])

Return a key for this BIDS file given a list of entities.

hed.tools.bids.bids_file.BidsFile.set_contents([...])

Set the contents of this object.

Attributes

hed.tools.bids.bids_file.BidsFile.contents

Return the current contents of this object.

BidsFile.__init__(file_path)[source]

Constructor for a file path.

Parameters:

file_path (str) – Full path of the file.

BidsFile.clear_contents()[source]

Set the contents attribute of this object to None.

BidsFile.get_entity(entity_name)[source]
BidsFile.get_key(entities=None)[source]

Return a key for this BIDS file given a list of entities.

Parameters:

entities (tuple) – A tuple of strings representing entities.

Returns:

A key based on this object.

Return type:

str

Notes

If entities is None, then the file path is used as the key

BidsFile.set_contents(content_info=None, overwrite=False)[source]

Set the contents of this object.

Parameters:
  • content_info – The contents appropriate for this object.

  • overwrite (bool) – If False and the contents are not empty, do nothing.

Notes

  • Do not set if the contents are already set and no_overwrite is True.

BidsFile.contents

Return the current contents of this object.