archetypal.template.umi_base.UmiBase

class archetypal.template.umi_base.UmiBase(Name, Category='Uncategorized', Comments='', DataSource=None, allow_duplicates=False, **kwargs)[source]

Base class for template objects.

The UmiBase class handles common properties to all Template objects.

Parameters
  • Name (str) – Unique, the name of the object.

  • Category (str) – Group objects by assigning the same category identifier. Thies can be any string.

  • Comments (str) – A comment displayed in the UmiTemplateLibrary.

  • DataSource (str) – A description of the datasource of the object. This helps identify from which data is the current object created.

  • allow_duplicates (bool) – If True, this object can be equal to another one if it has a different name.

  • **kwargs

property Name

Get or set the name of the object.

property id

Get or set the id.

property DataSource

Get or set the datasource of the object.

property Category

Get or set the Category attribute.

property Comments

Get or set the object comments.

property allow_duplicates

Get or set the use of duplicates [bool].

property predecessors

Get or set the predecessors of self.

Of which objects is self made of. If from nothing else then self, return self.

duplicate()[source]

Get copy of self.

rename(name)[source]

renames self as well as the cached object

Parameters

name (str) – the name.

to_dict()[source]

Return UmiBase dictionary representation.

to_ref()[source]

Return a ref pointer to self.

float_mean(other, attr, weights=None)[source]

Calculates the average attribute value of two floats. Can provide weights.

Parameters
  • other (UmiBase) – The other UmiBase object to calculate average value with.

  • attr (str) – The attribute of the UmiBase object.

  • weights (iterable, optional) – Weights of [self, other] to calculate weighted average.

extend(other, allow_duplicates)[source]

Append other to self. Modify and return self.

Parameters

other (UmiBase) –

Returns

self

Return type

UmiBase

validate()[source]

Validate UmiObjects and fills in missing values.

mapping(validate=True)[source]

Get a dict based on the object properties, useful for dict repr.

Parameters

validate (bool) – If True, try to validate object before returning the mapping.

get_unique()[source]

Return first object matching equality in the list of instantiated objects.