mt.geond.moments
Raw moments up to 2nd order of ND points.
Functions
moments_from_pointlist()
: Constructs a Moments object from a list of points.
- mt.geond.moments.moments_from_pointlist(pl)
Constructs a Moments object from a list of points.
Classes
Moments
: Raw moments up to 2nd order of points living in the same Euclidean space.
- class mt.geond.moments.Moments(m0, m1, m2)
Raw moments up to 2nd order of points living in the same Euclidean space.
Overloaded operators are negation, multiplication with a scalar and true division with a scalar.
- Parameters:
m0 (scalar) – 0th-order raw moment
m1 (numpy 1d array of length D, where D is the ndim of the class) – 1st-order raw moment
m2 (numpy DxD matrix) – 2nd-order raw moment
Examples
>>> import mt.geo2d.polygon as gp >>> poly = gp.Polygon([[0,0],[0,1],[1,2],[1,0]]) >>> import mt.geond.moments as gm >>> from mt.base.casting import cast >>> m = cast(poly, gm.Moments2d) >>> m.m0 4.0 >>> m.m1 array([2, 3]) >>> m.m2 array([[2, 2], [2, 5]]) >>> m.mean array([0.5 , 0.75]) >>> m.cov array([[0.25 , 0.125 ], [0.125 , 0.6875]])
Inheritance
digraph inheritancede09bbda4d { bgcolor=transparent; rankdir=LR; size="8.0, 12.0"; "GeometricObject" [URL="../mt.geo/mt.geo.object.html#mt.geo.object.GeometricObject",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="A geometric object which lives in a d-dimensional Euclidean space."]; "Moments" [URL="#mt.geond.moments.Moments",fillcolor=white,fontname="Vera Sans, DejaVu Sans, Liberation Sans, Arial, Helvetica, sans",fontsize=10,height=0.25,shape=box,style="setlinewidth(0.5),filled",target="_top",tooltip="Raw moments up to 2nd order of points living in the same Euclidean space."]; "GeometricObject" -> "Moments" [arrowsize=0.5,style="setlinewidth(0.5)"]; }- __init__(m0, m1, m2)
- __mul__(scalar)
Returns a new instance where all the moments are multiplied by a scalar.
- __neg__()
Returns a new instance where all the moments are negated.
- __repr__()
Return repr(self).
- __truediv__(scalar)
Returns a new instance where all the moments are divided by a scalar.
- property cov
Returns the covariance matrix.
- property m0
0th-order moment
- property m1
1st-order moment
- property m2
2nd-order moment
- property mean
Returns the mean vector.
- property ndim
Returns the number of dimensions in which the geometric object lives.
Variables
- mt.geond.moments.EPSILON
Double-precision floating-point number type, compatible with Python float and C
double
.- Character code:
'd'
- Canonical name:
numpy.double
- Alias:
numpy.float_
- Alias on this platform (Linux x86_64):
numpy.float64: 64-bit precision floating-point number type: sign bit, 11 bits exponent, 52 bits mantissa.
1.4901161193847656e-08