bids.layout.Tag

class Tag(file, entity, value, dtype=None, is_metadata=False)[source]

Represents an association between a File and an Entity.

Parameters:
  • file (BIDSFile) – The associated BIDSFile.

  • entity (Entity) – The associated Entity.

  • value (json-serializable type) – The value to store for this file/entity pair. Must be of type str, int, float, bool, or any json-serializable structure.

  • dtype (str) – Optional type for the value field. If None, inferred from value. If passed, must be one of str, int, float, bool, or json. Any other value will be treated as json (and will fail if the value can’t be serialized to json).

  • is_metadata (bool) – Indicates whether or not the Entity is derived from JSON sidecars (True) or is a predefined Entity from a config (False).

Attributes:
entity
entity_name
file
file_path
is_metadata
__init__(file, entity, value, dtype=None, is_metadata=False)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

Methods

__init__(file, entity, value[, dtype, ...])

A simple constructor that allows initialization from kwargs.

Attributes

entity

entity_name

file

file_path

is_metadata

metadata

registry