pyssaBSS.polygon

Classes

PolygonDrawer(ax, points[, filename])

Polygon drawer

class pyssaBSS.polygon.PolygonDrawer(ax, points, filename='polygons.json')[source]

Bases: object

Polygon drawer

This can be used to construct polygonal partitions of data points on a given map. The partition can then be saved a JSON file and used for the SPSSA methods.

Usage

  1. Initialize:

    drawer = PolygonDrawer(ax, points)

  2. Draw polygons:

    plt.show()

  3. Save polygons:

    drawer.save(“polygons.json”)

type ax:

an ax object from pyplot

param ax:

this is the map on which we draw. The drawer assumes that this is already constructed (e.g. from png and a bounding box)

type ax:

an ax object from pyplot

type points:

ndarray of shape (n, 2)

param points:

the coordinates of the points we want to partition. The points should lie inside the bounding box of the ax figure.

type points:

ndarray of shape (n, 2)

MOVE_THRESHOLD = 2
SNAP_RADIUS_PX = 10
get_polygons()[source]
on_click(event)[source]
on_key(event)[source]
on_move(event)[source]
on_scroll(event)[source]
save(filename)[source]