Skip to content

Instantly share code, notes, and snippets.

@ijiraq
Created September 25, 2018 14:49
Show Gist options
  • Save ijiraq/24af256570e961f26d90f6769429bc44 to your computer and use it in GitHub Desktop.
Save ijiraq/24af256570e961f26d90f6769429bc44 to your computer and use it in GitHub Desktop.
points = []
vertices = []
segment_type = SegmentType['MOVE']
for x, y in ([0, 0], [1, 0], [1, 1], [0, 1 ]):
V = w.all_pix2world(x*header['naxis1'], y*header['naxis2'], 1, 1, 1)
points.append(Point(float(V[0]), float(V[1])))
vertices.append(Vertex(float(V[0]), float(V[1]), segment_type))
segment_type = SegmentType['LINE']
vertices.append(Vertex(points[0].cval1,
points[0].cval2,
SegmentType['CLOSE']))
polygon = shape.Polygon(points=points, samples=shape.MultiPolygon(vertices))
position = Position(time_dependent=False,
bounds=polygon)
plane.position = position
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment