def test_mesh_mask_custom_colors(r=1.0, npts=(100, 100)):
    # Create the data like for test_mesh_sphere.
    pi = numpy.pi
    cos = numpy.cos
    sin = numpy.sin
    np_phi = npts[0] * 1j
    np_theta = npts[1] * 1j
    phi, theta = numpy.mgrid[0:pi:np_phi, 0:2 * pi:np_theta]
    x = r * sin(phi) * cos(theta)
    y = r * sin(phi) * sin(theta)
    z = r * cos(phi)

    # Setup the mask array.
    mask = numpy.zeros_like(x).astype(bool)
    mask[::5] = True
    mask[:,::5] = True

    # Create the mesh with the default colormapping.
    m = mesh(x, y, z, scalars=z, mask=mask)

    # Setup the colormap. This is an array of (R, G, B, A) values (each in
    # range 0-255), there should be at least 2 colors in the array.  If you
    # want a constant color set the two colors to the same value.
    colors = numpy.zeros((2, 4), dtype='uint8')
    colors[0,2] = 255
    colors[1,1] = 255
    # Set the alpha value to fully visible.
    colors[:,3] = 255

    # Now setup the lookup table to use these colors.
    m.module_manager.scalar_lut_manager.lut.table = colors
    return m
Write the header
dataset/ETHPy150Open enthought/mayavi/mayavi/tools/helper_functions.py/test_mesh_mask_custom_colors--crossover with--dataset/ETHPy150Open cloudera/hue/desktop/core/ext-py/python-ldap-2.3.13/Lib/dsml.py/DSMLWriter.writeHeader