def test_image():
    size = (3, 2)
    targets, pred, member, img = cp.image(points, values, size,
                                          ((0, 0.5), (2, -0.5)),
                                          colormap=summer)
    eq(targets.shape, size + (2,))
    eq(pred.shape, size)
    eq(member.shape, size)
def create_heatmap(points, values, area):
    """
    Create clusterpolated heatmap.

    Takes a 2-column matrix with point coordinates, a 1-column matrix
    with associated values, and a 2-tuple of 2-tuples describing the
    target area.

    Returns a ``PIL.Image.Image`` instance.
    """
    normalized = (values - MIN_RENT) / (MAX_RENT - MIN_RENT)
    return clusterpolate.image(
        points, normalized, size=HEATMAP_SIZE, area=area,
        radius=HEATMAP_RADIUS, colormap=HEATMAP_COLORMAP,
        normalize=False)[3]
示例#3
0
def create_heatmap(points, values, area):
    """
    Create clusterpolated heatmap.

    Takes a 2-column matrix with point coordinates, a 1-column matrix
    with associated values, and a 2-tuple of 2-tuples describing the
    target area.

    Returns a ``PIL.Image.Image`` instance.
    """
    normalized = (values - MIN_RENT) / (MAX_RENT - MIN_RENT)
    return clusterpolate.image(points,
                               normalized,
                               size=HEATMAP_SIZE,
                               area=area,
                               radius=HEATMAP_RADIUS,
                               colormap=HEATMAP_COLORMAP,
                               normalize=False)[3]