def reset(self, **traits):
        """Creates the dataset afresh or resets existing data source."""
        # First convert numbers to arrays.
        for name in ('x', 'y', 'z', 'u', 'v', 'w', 'scalars'):
            if name in traits and traits[name] is not None:
                traits[name] = np.atleast_1d(traits[name])

        # First set the attributes without really doing anything since
        # the notification handlers are not called.
        self.set(trait_change_notify=False, **traits)

        vectors = self.vectors
        scalars = self.scalars
        points = self.points
        x, y, z = self.x, self.y, self.z
        x = np.atleast_1d(x)
        y = np.atleast_1d(y)
        z = np.atleast_1d(z)

        if 'points' in traits:
            x = points[:, 0].ravel()
            y = points[:, 1].ravel()
            z = points[:, 2].ravel()
            self.set(x=x, y=y, z=z, trait_change_notify=False)

        else:
            points = np.c_[x.ravel(), y.ravel(), z.ravel()].ravel()
            points.shape = (-1, 3)
            self.set(points=points, trait_change_notify=False)

        u, v, w = self.u, self.v, self.w
        if u is not None:
            u = np.atleast_1d(u)
            v = np.atleast_1d(v)
            w = np.atleast_1d(w)
            if len(u) > 0:
                vectors = np.c_[u.ravel(), v.ravel(),
                                w.ravel()].ravel()
                vectors.shape = (-1, 3)
                self.set(vectors=vectors, trait_change_notify=False)

        if 'vectors' in traits:
            u = vectors[:, 0].ravel()
            v = vectors[:, 1].ravel()
            w = vectors[:, 2].ravel()
            self.set(u=u, v=v, w=w, trait_change_notify=False)

        else:
            if u is not None and len(u) > 0:
                vectors = np.c_[u.ravel(), v.ravel(),
                                w.ravel()].ravel()
                vectors.shape = (-1, 3)
                self.set(vectors=vectors, trait_change_notify=False)

        if vectors is not None and len(vectors) > 0:
            assert len(points) == len(vectors)
        if scalars is not None:
            scalars = np.atleast_1d(scalars)
            if len(scalars) > 0:
                assert len(points) == len(scalars.ravel())

        # Create the dataset.
        polys = np.arange(0, len(points), 1, 'l')
        polys = np.reshape(polys, (len(points), 1))
        if self.dataset is None:
            # Create new dataset if none exists
            pd = tvtk.PolyData()
        else:
            # Modify existing one.
            pd = self.dataset
        pd.set(points=points, polys=polys)

        if self.vectors is not None:
            pd.point_data.vectors = self.vectors
            pd.point_data.vectors.name = 'vectors'
        if self.scalars is not None:
            pd.point_data.scalars = self.scalars.ravel()
            pd.point_data.scalars.name = 'scalars'

        self.dataset = pd

    ######################################################################
    # Non-public interface.
    ######################################################################
dataset/ETHPy150Open enthought/mayavi/mayavi/tools/sources.py/MGlyphSource.reset/original