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, ordataclassesinstance), this function is recursively applied to all the attributes/elements of the nested object, leaving non-array values unchanged.- Parameters:
a (Any | UncertainScalarArray[NominalArrayT, DistributionArrayT]) – An array to isolate the nominal attribute of.
- Return type:
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=[6.7574638 , 8.42026115, 3.3657868 , 4.7460339 , 2.53634125], shape={'_distribution': 5}, ), )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=[6.7574638 , 8.42026115, 3.3657868 , 4.7460339 , 2.53634125], shape={'_distribution': 5}, ), ), y=2, )then we can also isolate the nominal attribute of every component of a
na.nominal(a)
Cartesian2dVectorArray(x=5, y=2)