pyvista.MultiBlock.set_active_scalars

pyvista.MultiBlock.set_active_scalars#

MultiBlock.set_active_scalars(
name: str | None,
preference: PointLiteral | CellLiteral = 'cell',
allow_missing: bool = False,
) tuple[FieldAssociation, NumpyArray[float]][source]#

Find the scalars by name and appropriately set it as active.

To deactivate any active scalars, pass None as the name.

Parameters:
namestr or None

Name of the scalars array to assign as active. If None, deactivates active scalars for both point and cell data.

preferencestr, default: “cell”

If there are two arrays of the same name associated with points or cells, it will prioritize an array matching this type. Can be either 'cell' or 'point'.

allow_missingbool, default: False

Allow missing scalars in part of the composite dataset. If all blocks are missing the array, it will raise a KeyError.

Returns:
pyvista.core.utilities.arrays.FieldAssociation

Field association of the scalars activated.

numpy.ndarray

An array from the dataset matching name.

Notes

The number of components of the data must match.