# Statistics¶

Methods Summary

 integral Evaluate the integral of the dependent variables over all dimensions. mean Evaluate the mean coordinate of a dependent variable along each dimension. var Evaluate the variance of the dependent variables along each dimension. std Evaluate the standard deviation of the dependent variables along each dimension.

Method Documentation

csdmpy.statistics.integral(csdm)[source]

Evaluate the integral of the dependent variables over all dimensions.

Parameters

csdm – A csdm object.

Returns

A list of integrals corresponding to the list of the dependent variables. If only one dependent variable is present, return a quantity instead.

Example

>>> import csdmpy.statistics as stat
>>> x = np.arange(100) * 2 - 100.0
>>> gauss = np.exp(-((x - 5.) ** 2) / (2 * 4. ** 2))
>>> csdm = cp.as_csdm(gauss, unit='T')
>>> csdm.dimensions = cp.as_dimension(x, unit="m")
>>> stat.integral(csdm)
<Quantity 10.0265131 m T>

csdmpy.statistics.mean(csdm)[source]

Evaluate the mean coordinate of a dependent variable along each dimension.

Parameters

csdm – A csdm object.

Returns

A list of tuples, where each tuple represents the mean coordinates of the dependent variables. If only one dependent variable is present, return a tuple of coordinates instead.

Example

>>> stat.mean(csdm)
(<Quantity 5. m>,)

csdmpy.statistics.var(csdm)[source]

Evaluate the variance of the dependent variables along each dimension.

Parameters

csdm – A csdm object.

Returns

A list of tuples, where each tuple is the variance along the dimensions of the dependent variables. If only one dependent variable is present, return a tuple instead.

Example

>>> stat.var(csdm)
(<Quantity 16. m2>,)

csdmpy.statistics.std(csdm)[source]

Evaluate the standard deviation of the dependent variables along each dimension.

Parameters

csdm – A csdm object.

Returns

A list of tuples, where each tuple is the standard deviation along the dimensions of the dependent variables. If only one dependent variable is present, return a tuple instead.

Example

>>> stat.std(csdm)
(<Quantity 4. m>,)