How to use the cplot.get_srgb1 function in cplot

To help you get started, we’ve selected a few cplot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github nschloe / orthopy / orthopy / sphere / tools.py View on Github external
def write(filename, f):
    """Write a function `f` defined in terms of spherical coordinates to a file.
    """
    import meshio
    import meshzoo
    import cplot

    points, cells = meshzoo.icosa_sphere(5)
    # get spherical coordinates from points
    polar = numpy.arccos(points[:, 2])
    azimuthal = numpy.arctan2(points[:, 1], points[:, 0])
    vals = cplot.get_srgb1(f(polar, azimuthal), colorspace="cam16")

    vals *= 2.5
    vals[vals > 1] = 1
    vals[vals < 0] = 0

    meshio.write_points_cells(
        filename, points, {"triangle": cells}, point_data={"srgb1": vals}
    )
    return

cplot

Plot complex-valued functions

GPL-3.0
Latest version published 2 years ago

Package Health Score

39 / 100
Full package analysis