Classes¶
Circle¶
-
class
Circle¶ the class for fitting a circle to a set of points. By using this class, you can convert a set of 2D coordinates into
angleandradius.Conversely, you can draw the corresponding circle by giving phases in radians,
-
xc¶ Type: float (read-only) the x coordinate of the center of the circle.
-
yc¶ Type: float (read-only) the y coordinate of the center of the circle.
-
radius¶ Type: float (read-only) the radius of the circle.
-
center¶ Type: numpy.ndarray (read-only) the
(x,y)coordinates of the center of the circle.
-
compute_angles(x, y)¶ computes the angles (phases) for the given points with respect to this circle.
Parameters: - x – a list of x coordinates for the points to compute angles.
- y – a list of y coordinates for the points to compute angles.
Returns: a list of angles (phases) for the given points in radians.
Return type:
-
compute_radius(x, y)¶ computes the radius (distance from the center of this circle) for the given points.
Parameters: - x – a list of x coordinates for the points to compute radius.
- y – a list of y coordinates for the points to compute radius.
Returns: a list of radius values for the given points.
Return type:
-
draw(angles)¶ computes the
(x, y)coordinates of the points on this circle corresponding to the specifiedangles.Parameters: angles – a list of angles (phases) in radians you want to get the coordinates for. Returns: a tuple (xcoords, ycoords), each of which is a numpy.ndarray.
-
Ellipse¶
-
class
Ellipse¶ a class for fitting an ellipse to a set of points.
The class is implemented based on the assumption “an ellipse is a distorted circle”. The
matrixattribute represents such distortion from a circle to the ellipse. Conversely, thetransformationattribute gives the inverse of the distortion to transform the points back into a circle.In accordance with the above assumption, each
Ellipseobject is managed by its center coordinates (xc,yc, as well ascenter), the lengths of semi-major and semi-minor axes (AandB), and the rotation of the semi-major axis around the origin (phi).Analogously to the
Circleclass, you can computeanglefrom the set of points, but note that the obtainedanglesdoes not correspond to literal angles.-
xc¶ Type: float (read-only) the x coordinate of the center of the ellipse.
-
yc¶ Type: float (read-only) the y coordinate of the center of the ellipse.
-
A¶ Type: float (read-only) the length of the semi-major axis.
-
B¶ Type: float (read-only) the length of the semi-minor axis.
-
phi¶ Type: float (read-only) the angle between the semi-major axis of this ellipse and the x axis.
-
center¶ Type: numpy.ndarray (read-only) the
(x,y)coordinates of the center of the ellipse.
-
matrix¶ Type: numpy.ndarray with shape (2, 2) returns the matrix whose column vectors correspond to the coordinates for the semi-major and semi-minor axis vectors of this ellipse.
-
transformation¶ Type: numpy.ndarray with shape (2, 2) returns the matrix to convert a set of points from the elliptic into the circular (i.e. standardized) parameter space.
This is the inverse matrix for
matrix.
-
transform(x, y)¶ convert a set of points from the elliptic (original euclidian) into the circular (i.e. standardized) parameter space.
Internally, this is done by matrix multiplication of
transformationfrom the left.Parameters: - x – a list of x coordinates for the points to transform.
- y – a list of y coordinates for the points to transform.
Return type: numpy.ndarray with shape (2, N)
Returns: array of transformed points, with each column corresponding to a single point.
-
compute_phases(x, y)¶ computes the phases for the given points with respect to this ellipse.
Note that the “angles” are computed based on the corresponding circle. Internally, the computation is done by applyling
transform()to a set of points, and then computing their phases on the standard circle. Differences in “angles” therefore do not necessarily correspond to the actual differences in angles in the original space.Parameters: - x – a list of x coordinates for the points to compute phases.
- y – a list of y coordinates for the points to compute phases.
Returns: a list of phases for the given points in radians.
Return type:
-
draw(phases)¶ computes the
(x, y)coordinates of the points on this ellipse corresponding to the specifiedphases.Parameters: phases – a list of phases in radians you want to get the coordinates for. Returns: a tuple (xcoords, ycoords), each of which is a numpy.ndarray.
-
Parabola¶
-
class
Parabola¶ a class for fitting a Parabola to a set of points.
Each
Parabolaobject is managed based on the focus coordinates (xfandyf, as well asfocus), the distance between the focus and the directrix (L), and the rotation of the directrix around the origin (phi)-
xf¶ Type: float (read-only) the x coordinate of the focus of the parabola.
-
yf¶ Type: float (read-only) the y coordinate of the focus of the parabola.
-
phi¶ Type: float (read-only) the angle between the directrix for this parabola and the x axis.
-
L¶ Type: float (read-only) the distance between the focus and the directrix of this parabola.
-
focus¶ Type: numpy.ndarray (shape (2,)) (read-only) the
(x,y)coordinates of the focus of the parabola.
-
axis¶ Type: numpy.ndarray (shape (2,)) (read-only) the
(x,y)values for the unit vector along the axis of symmetry for this parabola.
-
rotation¶ Type: numpy.ndarray (shape (2,2)) (read-only) the rotation matrix corresponding to
phi, such that application of this conversion to an “upright” parabola results in the rotation of this parabola.
-
draw(t)¶ Parameters: t – a list of the positional parameters on the parabola. For an “upright” parabola centered around the y axis, this parameter corresponds exactly to the range of x coordinates. Returns: a tuple (xcoords, ycoords), each of which is a numpy.ndarray.
-