The Attribute classΒΆ
The main characteristics of Attribute
are described below.
label
: The name of theAttribute
. Comes from the standard and should not be changed.value
: The value(s) specified for thisAttribute
. In general, any type is allowed, but in most cases it is (a list of): str / int / float /EFLRItem
/datetime
.multivalued
: a Boolean indicating whether thisAttribute
instance accepts a list of values (if True) or a single value (if False). Specified at initialisation of theAttribute
(which usually takes place at initialisation of the relevant EFLR object).multidimensional
: a Boolean indicating whether the value of thisAttribute
can have multiple dimensions (be represented as a nested list). If True,multivalued
must also be True.count
: Number of values specified for theAttribute
instance. If theAttribute
is notmultivalued
,count
is always 1. Otherwise, it is the number of values added to theAttribute
(orNone
if no value is given).units
: A string representing the units of thevalue
of theAttribute
- if relevant. The standard pre-defines a list of allowed units, but many DLIS readers accept any string value. For this reason, only a log warning is issued if the user specifies a unit other than those given by the standard.representation_code
: indication of type of the value(s) of theAttribute
and guidance on how they should be converted to bytes to be included in the file. Representation codes are either defined when the Attribute is initialised or are inferred from the provided value(s). They are not settable by the user.parent_eflr
: TheEFLRItem
instance this attribute belongs to. Mainly used for string representation of theAttribute
(e.g.Attribute 'description' of ToolItem 'TOOL-1'
, whereTOOL-1
is the parent EFLR).converter
: A callable which is used to convert the value passed by the user (or each of the individual items if theAttribute
is multivalued) to fit the standard-imposed requirements for the givenAttribute
. It can also include type checks etc. (for example, checking that the objects passed tocalibrated_channels
ofCalibrationItem
) are all instances ofChannelItem
.
Settable parts of Attribute
instance include: value
, units
, and converter
.
Some subtypes of Attribute
further restrict what can be set.