def _scalars_changed(self, s):
        mask = self.mask
        if mask is not None and len(mask) > 0:
            s[mask.astype('bool')] = np.nan
            # The NaN tric only works with floats.
            s = s.astype('float')
            self.set(scalars=s, trait_change_notify=False)

        self.dataset.point_data.scalars = s.ravel()
        self.dataset.point_data.scalars.name = 'scalars'
        self.update()


###############################################################################
# `MTriangularMeshSource` class.
###############################################################################
dataset/ETHPy150Open enthought/mayavi/mayavi/tools/sources.py/MGridSource._scalars_changed/original