UnitEntry

class UnitEntry(*args, **kwargs)[source]

A single unit entry with modifiers in the HedSchema.

Methods

hed.schema.hed_schema_entry.UnitEntry.__init__(...)

Constructor for HedSchemaEntry.

hed.schema.hed_schema_entry.UnitEntry.attribute_has_property(...)

Return True if attribute has property.

hed.schema.hed_schema_entry.UnitEntry.finalize_entry(schema)

Called once after loading to set internal state.

hed.schema.hed_schema_entry.UnitEntry.get_conversion_factor(...)

Returns the conversion factor from combining this unit with the specified modifier

hed.schema.hed_schema_entry.UnitEntry.get_known_attributes()

hed.schema.hed_schema_entry.UnitEntry.has_attribute(...)

Checks for the existence of an attribute in this entry.

Attributes

hed.schema.hed_schema_entry.UnitEntry.section_key

UnitEntry.__init__(*args, **kwargs)[source]

Constructor for HedSchemaEntry.

Parameters:
  • name (str) – The name of the entry.

  • section (HedSchemaSection) – The section to which it belongs.

UnitEntry.attribute_has_property(attribute, property_name)

Return True if attribute has property.

Parameters:
  • attribute (str) – Attribute name to check for property_name.

  • property_name (str) – The property value to return.

Returns:

Returns True if this entry has the property.

Return type:

bool

UnitEntry.finalize_entry(schema)[source]

Called once after loading to set internal state.

Parameters:

schema (HedSchema) – The schema rules come from.

UnitEntry.get_conversion_factor(unit_name)[source]

Returns the conversion factor from combining this unit with the specified modifier

Parameters:

unit_name (str or None) – the full name of the unit with modifier

Returns:

Returns the conversion factor or None

Return type:

conversion_factor(float or None)

UnitEntry.get_known_attributes()
UnitEntry.has_attribute(attribute, return_value=False)

Checks for the existence of an attribute in this entry.

Parameters:
  • attribute (str) – The attribute to check for.

  • return_value (bool) – If True, returns the actual value of the attribute. If False, returns a boolean indicating the presence of the attribute.

Returns:

If return_value is False, returns True if the attribute exists and False otherwise. If return_value is True, returns the value of the attribute if it exists, else returns None.

Return type:

bool or any

Notes

  • The existence of an attribute does not guarantee its validity.

UnitEntry.section_key