mt.geo2d.moments

Raw moments up to 2nd order of 2D points.

Classes

  • Moments2d: Raw moments up to 2nd order of points living in 2D, implemnted in GLM.

class mt.geo2d.moments.Moments2d(m0: float, m1: ndarray | vec2, m2: ndarray | mat2x2)

Raw moments up to 2nd order of points living in 2D, implemnted in GLM.

Overloaded operators are negation, multiplication with a scalar and true division with a scalar.

Parameters:
  • m0 (float) – 0th-order raw moment

  • m1 (glm.vec2) – 1st-order raw moment

  • m2 (glm.mat2 or numpy.ndarray) – 2nd-order raw moment. If the input is numpy.ndarray, a row-major matrix is expected. Otherwise, a column-major matrix is expected.

m0

0th-order raw moment

Type:

float

m1_glm

1st-order raw moment

Type:

glm.vec2

m1

the numpy view of m1_glm

Type:

numpy.ndarray

m2_glm

2nd-order column-major raw moment

Type:

glm.mat2

m2

the numpy view of m2_glm

Type:

numpy.ndarray

mean_glm

the mean of points

Type:

glm.vec2

mean

the numpy view of mean_glm

Type:

numpy.ndarray

cov_glm

the covariance matrix of points

Type:

glm.mat2

cov

the numpy view of cov_glm

Type:

numpy.ndarray

Examples

>>> import numpy as np
>>> from mt.geo2d.moments import Moments2d
>>> gm.Moments2d(10, np.array([2,3]), np.array([[1,2],[3,4]]))
Moments2d(m0=10, mean=vec2( 0.2, 0.3 ), cov=mat2x2(( 0.06, 0.14 ), ( 0.24, 0.31 )))

See also

Moments

base class

Inheritance

digraph inheritancee5a6323cc5 { 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/mt.geond.moments.html#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)"]; "Moments2d" [URL="#mt.geo2d.moments.Moments2d",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 2D, implemnted in GLM."]; "TwoD" -> "Moments2d" [arrowsize=0.5,style="setlinewidth(0.5)"]; "Moments" -> "Moments2d" [arrowsize=0.5,style="setlinewidth(0.5)"]; "TwoD" [URL="../mt.geo/mt.geo.object.html#mt.geo.object.TwoD",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="Mixin to assert that the geometric object lives in 2D Euclidean space."]; }
__init__(m0: float, m1: ndarray | vec2, m2: ndarray | mat2x2)
__repr__()

Return repr(self).

property cov

Returns the row-major covariance matrix as a numpy array.

property cov_glm

Returns the column-major covariance matrix as a mat2.

property m1

1st-order moment

property m2

2nd-order moment

property mean

Returns the mean vector.

property mean_glm

Returns the mean vector as a vec2.