nominal#

named_arrays.nominal(a)#

Isolate the nominal attribute of an uncertain array. If a is a nested object, such as a vector, or an arbitrarily-nested structure (dict, list, tuple, or dataclasses instance), this function is recursively applied to all the attributes/elements of the nested object, leaving non-array values unchanged.

Parameters:

a (AnyT | UncertainScalarArray[NominalArrayT, DistributionArrayT]) – An array to isolate the nominal attribute of.

Return type:

AnyT | NominalArrayT

Examples

If we define an uncertain scalar x,

import named_arrays as na

x = na.UniformUncertainScalarArray(5, 4, num_distribution=5).explicit
x
UncertainScalarArray(
    nominal=5,
    distribution=ScalarArray(
        ndarray=[7.06670106, 4.92245573, 7.71579131, 7.23969375, 4.3812963 ],
        axes=('_distribution',),
    ),
)

then we can isolate the nominal attribute of x using this function

na.nominal(x)
5

If we use this scalar to define a vector a,

a = na.Cartesian2dVectorArray(x, 2)
a
Cartesian2dVectorArray(
    x=UncertainScalarArray(
        nominal=5,
        distribution=ScalarArray(
            ndarray=[7.06670106, 4.92245573, 7.71579131, 7.23969375, 4.3812963 ],
            axes=('_distribution',),
        ),
    ),
    y=2,
)

then we can also isolate the nominal attribute of every component of a

na.nominal(a)
Cartesian2dVectorArray(x=5, y=2)