TODO :
- how to make UV attributes like std, skew, accessible ? using q.value.skew ?
- multiplication precedence : x = mcerp.Normal(1, 2)*s doesn't work because mcerp can't cast quantity object to UV
mcerp¶
See : - github : https://github.com/tisimst/mcerp - online doc : https://pythonhosted.org/mcerp/
Introduction on mcerp¶
UV : uncertain Variable
liste of distributions : https://pythonhosted.org/mcerp/distribution_constructors.html
x = mcerp.Normal(1, 3, tag="toto")
y = mcerp.Normal(2, 5)
print(x)
print(y)
print(x.mean)
print(x.var)
print(x.kurt)
print(x.skew)
print(mcerp.npts)
print(x.tag)
Support with physipy¶
Construction¶
# using multiplication
# x = mcerp.Normal(1, 2)*s : NotUpcast: <class 'physipy.quantity.quantity.Quantity'> cannot be converted to a number with uncertainty
x = m *mcerp.Normal(1, 2)
x
Basic Operation¶
# with scalar
scalar = 2*m
print(x+scalar)
print(x-scalar)
print(x*scalar)
print(x/scalar)
# print(x**s) : NotUpcast: <class 'physipy.quantity.quantity.Quantity'> cannot be converted to a number with uncertainty
print(scalar+x)
print(scalar-x)
print(scalar*x)
print(scalar/x)
# print(x**s) : NotUpcast: <class 'physipy.quantity.quantity.Quantity'> cannot be converted to a number with uncertainty
# with other uv
x = Quantity(mcerp.Normal(1, 2), Dimension("L"))
y = Quantity(mcerp.Normal(1, 2), Dimension("L"))
print(x+y)
print(x-y)
print(x*y)
print(x/y)
# print(x**y) : NotUpcast: <class 'physipy.quantity.quantity.Quantity'> cannot be converted to a number with uncertainty
print(y+x)
print(y-x)
print(y*x)
print(y/x)
# print(y**x) : NotUpcast: <class 'physipy.quantity.quantity.Quantity'> cannot be converted to a number with uncertainty
Functionnalities¶
Use q.value. to acces mcerp attributes
Examples¶
# x1.mean
print("x1.mean")
print(x1.mean) # falls back on UV value, hence drops the unit
# x1.mean() : fails because relies on numpy.mean
# x1.var
print("x1.var")
print(x1.var) # falls back on UV value, hence drops the nit
# x1.skew
print("x1.skew")
print(x1.skew) # falls back on UV value, hence drops the nit
# x1.kurt
print("x1.kurt")
print(x1.kurt)
# x1.stats
print("x1.stats")
print(x1.stats)
# Z = (x1*x2**2)/(15*(1.5 + x3))
Z = (x1*x2**2)/(15*(1.5*s + x3))
print(Z)
# Z.describe()
Z.describe()