Attributes ManagementΒΆ

Each API object Base, Zone, Instant, Boundary, and Family contains an attrs attribute that behaves like a Python dictionary.

An attribute can be set using the classical (key, value) pair.

import antares
base = antares.Base()
base.attrs['omega'] = 10

In the above example, an attribute is set at the Base level. This attribute will be visible for all zones and instants belonging to the base. As an example, if you are dealing with a single rotor configuration, then you can set the rotation velocity to the base.

We can add an attribute to a Zone or an Instant too.

import antares
base = antares.Base()
base['rotor'] = antares.Zone()
base['rotor'].attrs['omega'] = 10
base['stator'] = antares.Zone()
base['stator'].attrs['omega'] = 0

In the above example, the attribute omega is set according to the type of the zone.

The value you can add to the attrs attribute can be of any type. The user (the applicative script writer) is solely responsible for the proper management of these new entities (key, value).

Except if documented, the key can not be known from the Antares library. As such, the value can not be used in other functions or methods from the library.