def _add_point_scalar(self, scalars, name, set_active=False, deep=True):
        """
        Adds point scalars to the mesh

        Parameters
        ----------
        scalars : numpy.ndarray
            Numpy array of scalars.  Must match number of points.

        name : str
            Name of point scalars to add.

        set_active : bool, optional
            Sets the scalars to the active plotting scalars.  Default False.

        deep : bool, optional
            Does not copy scalars when False.  A reference to the scalars
            must be kept to avoid a segfault.

        """
        if not isinstance(scalars, np.ndarray):
            raise TypeError('Input must be a numpy.ndarray')

        if scalars.shape[0] != self.n_points:
            raise Exception('Number of scalars must match the number of ' +
                            'points')

        # need to track which arrays are boolean as all boolean arrays
        # must be stored as uint8
        if scalars.dtype == np.bool:
            scalars = scalars.view(np.uint8)
            if name not in self._point_bool_array_names:
                self._point_bool_array_names.append(name)

        if not scalars.flags.c_contiguous:
            scalars = np.ascontiguousarray(scalars)

        vtkarr = numpy_to_vtk(scalars, deep=deep)
        vtkarr.SetName(name)
        self.GetPointData().AddArray(vtkarr)
        if set_active or self.active_scalar_info[1] is None:
            self.GetPointData().SetActiveScalars(name)
            self._active_scalar_info = [POINT_DATA_FIELD, name]
def _add_point_scalar ( self , scalars , name , set_active = False , deep = True ) : if not isinstance ( scalars , np . ndarray ) : raise TypeError ( 'Input must be a numpy.ndarray' ) if scalars . shape [ 0 ] != self . n_points : raise Exception ( 'Number of scalars must match the number of ' + 'points' ) if scalars . dtype == np . bool : scalars = scalars . view ( np . uint8 ) if name not in self . _point_bool_array_names : self . _point_bool_array_names . append ( name ) if not scalars . flags . c_contiguous : scalars = np . ascontiguousarray ( scalars ) vtkarr = numpy_to_vtk ( scalars , deep = deep ) vtkarr . SetName ( name ) self . GetPointData ( ) . AddArray ( vtkarr ) if set_active or self . active_scalar_info [ 1 ] is None : self . GetPointData ( ) . SetActiveScalars ( name ) self . _active_scalar_info = [ POINT_DATA_FIELD , name ]
Adds point scalars to the mesh

        Parameters
        ----------
        scalars : numpy.ndarray
            Numpy array of scalars.  Must match number of points.

        name : str
            Name of point scalars to add.

        set_active : bool, optional
            Sets the scalars to the active plotting scalars.  Default False.

        deep : bool, optional
            Does not copy scalars when False.  A reference to the scalars
            must be kept to avoid a segfault.