Chaincode

class sunpy.roi.Chaincode(origin, chaincode, xdelta=1, ydelta=1)[source] [edit on github]

Bases: numpy.ndarray

A tool to infer some information from chaincodes produced by HELIO Feature Catalogue or Heliophysics Events Knowledgebase.

Parameters
  • origin (numpy.ndarray, list) – The 2 points of the origin of the chaincode.

  • chaincode (str) – A list of the numbers (0-7) that indicate the path of the chaincode. 0 moves horizontally to the left and the rest follows anticlockwise.

  • xdelta (float, optional) – The scale to convert between pixels and flat coordinates. Defaults to 1.0.

  • ydelta (float, optional) – The scale to convert between pixels and flat coordinates. Defaults to 1.0

Returns

numpy.ndarray – An array containing all the x and y coordinates of the chaincode e.g., [[x0, x1, x2, ..., xn], [y0 ,y1, y2, ..., yn]].

Examples

>>> from sunpy.roi.chaincode import Chaincode
>>> cc = Chaincode([-88, 812], "44464655567670006011212222324",
...     xdelta=2.629, ydelta=2.629)
>>> fig = plt.figure()   # doctest: +SKIP
>>> ax = fig.add_subplot(111)   # doctest: +SKIP
>>> x,y = zip(cc.coordinates)   # doctest: +SKIP
>>> ax.plot(x[0], y[0], 'go-')   # doctest: +SKIP
>>> fig.show()   # doctest: +SKIP

Methods Summary

BoundingBox()

Extract the coordinates of the chaincode.

area()

length()

matchany(coordinates, index)

matchend(end)

subBoundingBox([xedge, yedge])

Extract the x or y boundaries of the chaincode from a defined limits xedge or yedge.

Methods Documentation

BoundingBox()[source] [edit on github]

Extract the coordinates of the chaincode.

Returns in the form of [[x0,x1],[y0,y1]].

area()[source] [edit on github]
length()[source] [edit on github]
matchany(coordinates, index)[source] [edit on github]
matchend(end)[source] [edit on github]
subBoundingBox(xedge=None, yedge=None)[source] [edit on github]

Extract the x or y boundaries of the chaincode from a defined limits xedge or yedge.