scuq.ucomponents

scuq.ucomponents.coerce(x, y)[source]
scuq.ucomponents.clearDuplicates(alist)[source]

Remove identical elements from a list

Parameters:

alist – A list that may contain identical elements.

Returns:

A list that only contains unique elements.

class scuq.ucomponents.UncertainComponent[source]

Bases: object

This is the abstract base class to model components of uncertainty as described in by “The GUM Tree”. measurement uncertainty”; B. D. Hall; Industrial Research Report 1291; Measurements Standards Laboratory New Zealand (2003).

__init__()[source]

Default constructor.

arithmetic_check()[source]

This method checks this instance for mathematical correctness. You should overload this method, if your class is not defined for specific argument values. If any (mathematical) invalid values have been assigned, your implementation should raise an ArithmeticError explaining the problem. This method is usually called within the constructor of a class, after the members have been initialized.

get_value()[source]

Abstract method: The implementation should return a numeric value (e.g. float,int,long,or arithmetic.RationalNumber) representing the value assigned to the component of uncertainty.

Returns:

A numeric value, representing the value.

get_uncertainty(component)[source]

Abstract method: The implementation should return a numeric value (e.g. float,int,long,or arithmetic.RationalNumber) representing the standard uncertainty of this component.

Parameters:

component – Another instance of uncertainty.

If the argument is this instance the uncertainty is returned, rac{0}{1} should be returned otherwise. This is analogous to taking the derivate of an independent variable. For further explanation see “The GUM tree”.

Returns:

A numeric value, representing the standard uncertainty. measurement uncertainty”; B. D. Hall; Industrial Research Report 1291; Measurements Standards Laboratory New Zealand (2003).

depends_on()[source]

Abstract method: The implementation should return a list of the components of uncertainty, that this component depends on.

Returns:

A list of the components of uncertainty.

__getstate__()[source]

Serialization using pickle.

Returns:

A string that represents the serialized form of this instance.

__setstate__(state)[source]

Deserialization using pickle.

Parameters:

state – The state of the object.

static value_of(value)[source]

A factory method, that can be used to create instances of uncertain components. This method returns instances of UncertainNumber depending on the argument.

Parameters:

value – An instance of UncertainNumber or a numeric

value.

Returns:

The argument, if it is already an instance of UncertainNumber, or a new instance of UncertainInput (having an uncertainty of 0.0) if the argument is a numeric value (i.e. int,float…). encapsulate quantites in UncertainValues. Plase use Quantity(UncertainValue) instead.

static gaussian(value, sigma, dof='inf')[source]

A factory method, that can be used to create instances of uncertain components. This method returns uncertain inputs that are quantified as a gaussian distribution, centered at value, and having the uncertainty sigma.

Parameters:
  • value – A numeric value, representing x.

  • sigma – A numeric value, representing a

  • dof – The assigned number of degrees of freedom.

Returns:

An uncertain component.

static uniform(value, halfwidth, dof='inf')[source]

A factory method, that can be used to create instances of uncertain components. This method returns uncertain inputs that are quantified as a uniform distribution, centered at x, and having the half-width a.

Parameters:
  • value – A numeric value, representing x.

  • halfwidth – A numeric value, representing a.

  • dof – The assigned number of degrees of freedom.

Returns:

An uncertain component, having the uncertainty

static triangular(value, halfwidth, dof='inf')[source]

A factory method, that can be used to create instances of uncertain components. This method returns uncertain inputs that are quantified as a triangular distribution, centered at x, and having the half-width a.

Parameters:
  • value – A numeric value, representing x.

  • halfwidth – A numeric value, representing a

  • dof – The assigned number of degrees of freedom.

Returns:

An uncertain component, having the uncertainty

static beta(value, p, q, dof='inf')[source]

A factory method, that can be used to create instances of uncertain components. This method returns uncertain inputs that are quantified as a beta distribution, having the parameters p and q .

Parameters:
  • value – The assigned value.

  • p – A numeric value, representing p.

  • q – A numeric value, representing q

  • dof – The assigned number of degrees of freedom.

Returns:

An uncertain component.

static arcsine(value, dof='inf')[source]

A factory method, that can be used to create instances of uncertain components. This method returns uncertain inputs that are quantified as an arcsin distribution.

Returns:

An uncertain component.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has equal attributes as the argument

__eq__(other)[source]

This method is an alias for (self is other). It checks if the argument is identical with the current instance. Imagine you want to compare with sin(a pm u_a) times (b pm u_b) with Since in the first case the values are identical, they are dependent. In the second case the values are the same, but we do not know about their independence. Therefore the second case needs a different handling. In order not to confuse these two cases, this method has to check for identity.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the argument is identical to the current instance.

__ne__(other)[source]

This method is an alias for not(self is other). It checks if the argument is not identical with the current instance.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the argument is not identical to the current instance.

__add__(other)[source]

This method adds the argument to this instance. it will be converted using UncertainComponent.value_of.

Parameters:

other – A numeric value.

arctan2(other)[source]

This method provides an interface for numpy.arctan2.

Parameters:

other – A numeric value.

hypot(other)[source]

This method provides an interface for numpy.hypot.

Parameters:

other – A numeric value.

__sub__(other)[source]

This method substracts the argument from this instance. it will be converted using UncertainComponent.value_of.

Parameters:

other – A numeric value.

__mul__(other)[source]

This method multiplies the argument by this instance. it will be converted using UncertainComponent.value_of.

Parameters:

other – A numeric value.

__truediv__(other)[source]

This method divides this instance by the argument. it will be converted using UncertainComponent.value_of.

Parameters:

other – A numeric value.

__pow__(other)[source]

This method raises this to the power of the argument. it will be converted using UncertainComponent.value_of.

Parameters:

other – A numeric value.

__radd__(other)[source]

This method adds this instance to the argument. it will be converted using UncertainComponent.value_of.

Parameters:

other – A numeric value.

__rsub__(other)[source]

This method substracts this instance from the argument. it will be converted using UncertainComponent.value_of.

Parameters:

other – A numeric value.

__rmul__(other)[source]

This method multiplies the argument by this instance. it will be converted using UncertainComponent.value_of.

Parameters:

other – A numeric value.

__rtruediv__(other)[source]

This method divides the argument by this instance. it will be converted using UncertainComponent.value_of.

Parameters:

other – A numeric value.

__rpow__(other)[source]

This method raises the argument to the power of this instance. it will be converted using UncertainComponent.value_of.

Parameters:

other – A numeric value.

__neg__()[source]

This method negates this instance.

__invert__()[source]

Inverts this instance.

__abs__()[source]

This method returs the absolute value of this instance.

set_context(context)[source]

Assign a context to this component. This method is only used in combination with __str__. If a context is assigned to the instance, the correlation coefficients will be considered for __str__. Otherwise __str__ assumes that there is no correlation among the inputs.

Parameters:

context – An instance of Context.

eval()[source]

Factory method to get get an object with evaluated uncertainties.

Returns:

object with <value> and <uncertainty>

__str__()[source]

This method returs the absolute value of this instance.

Returns:

A string of the form “<value> +- <uncertainty>” or “<value> +- <uncertainty> [NC]”, if no context was provided.

arccos()[source]

This method provides the broadcast interface for numpy.arccos.

Returns:

The inverse Cosine of this component.

arccosh()[source]

This method provides the broadcast interface for numpy.arccosh.

Returns:

The inverse hyperbolic Cosine of this component.

arcsin()[source]

This method provides the broadcast interface for numpy.arcsin.

Returns:

The inverse Sine of this component.

arcsinh()[source]

This method provides the broadcast interface for numpy.arcsinh.

Returns:

The inverse hyperbolic Sine of this component.

arctan()[source]

This method provides the broadcast interface for numpy.arctan.

Returns:

The inverse Tangent of this component.

arctanh()[source]

This method provides the broadcast interface for numpy.arctanh.

Returns:

The inverse hyperbolic Tangent of this component.

cos()[source]

This method provides the broadcast interface for numpy.cos.

Returns:

The Cosine of this component.

cosh()[source]

This method provides the broadcast interface for numpy.cosh.

Returns:

The hyperbolic Cosine of this component.

tan()[source]

This method provides the broadcast interface for numpy.tan.

Returns:

The Tangent of this component.

tanh()[source]

This method provides the broadcast interface for numpy.tanh.

Returns:

The hyperbolic Tangent of this component.

log10()[source]

This method provides the broadcast interface for numpy.log10.

Returns:

The decadic Logarithm of this component.

log2()[source]

This method provides the broadcast interface for numpy.log2.

Returns:

The decadic Logarithm of this component.

sin()[source]

This method provides the broadcast interface for numpy.sin.

Returns:

The Sine of this component.

sinh()[source]

This method provides the broadcast interface for numpy.sinh.

Returns:

The hyperbolic Sine of this component.

sqrt()[source]

This method provides the broadcast interface for numpy.sqrt.

Returns:

The Square Root of this component.

square()[source]

This method provides the broadcast interface for numpy.sqrt.

Returns:

The Square Root of this component.

fabs()[source]

This method provides the broadcast interface for numpy.fabs.

Returns:

The absolute value of this component.

absolute()[source]

This method provides the broadcast interface for numpy.absolute.

Returns:

The absolute value of this component.

exp()[source]

This method provides the broadcast interface for numpy.exp.

Returns:

The Exponential of this component.

log()[source]

This method provides the broadcast interface for numpy.log.

Returns:

The Natural Logarithm of this component.

__coerce__(other)[source]

Implementation of coercion rules. See also: Coercion - The page describing the coercion rules.

class scuq.ucomponents.UncertainInput(value, uncertainty, dof='inf')[source]

Bases: UncertainComponent

This class provides the model for uncertain inputs, that are referred to as “Leafs” in “The GUM tree”. measurement uncertainty”; B. D. Hall; Industrial Research Report 1291; Measurements Standards Laboratory New Zealand (2003).

__init__(value, uncertainty, dof='inf')[source]

Default constructor. UncertainComponent nor quantities.Quantity. Create quantities, having an UncertainInput as numeric argument instead.

Parameters:
  • value – The numeric value of the input.

  • dof – The assigned component of degrees of freedom.

  • uncertainty – The standard uncertainty of the input.

get_value()[source]

Returns the assigned value.

Returns:

A numeric value, representing the value.

get_dof()[source]

Returns the assigned degrees of freedom.

Returns:

A numeric value or arithmetic.INFINITY, representing the value.

conjugate()[source]
get_uncertainty(component)[source]

Returns the assigned uncertainty.

Parameters:

component – Another component of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

depends_on()[source]

Returns a list containing this element.

Returns:

A list of the components of uncertainty.

__getstate__()[source]

Serialization using pickle.

Returns:

A string that represents the serialized form of this instance.

__setstate__(state)[source]

Deserialization using pickle.

Parameters:

state – The state of the object.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

__hash__()[source]

Hash this instance.

class scuq.ucomponents.BinaryOperation(left, right)[source]

Bases: UncertainComponent

The abstract base class for modelling binary operations. This class provides the abstract interface for GUM-tree-nodes that have two silblings.

__init__(left, right)[source]

Default constructor. constructor explicitly in order to initialize the silblings!

Parameters:
  • left – Left silbling of this instance.

  • right – Right silbling of this instance.

depends_on()[source]

Get the components of uncertainty, that this class depends on.

Returns:

A list of the components of uncertainty.

get_right()[source]

Return the right silbling.

Returns:

The right silbling.

get_left()[source]

Return the left silbling.

Returns:

The left silbling.

__getstate__()[source]

Serialization using pickle.

Returns:

A string that represents the serialized form of this instance.

__setstate__(state)[source]

Deserialization using pickle.

Parameters:

state – The state of the object.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.UnaryOperation(right)[source]

Bases: UncertainComponent

The abstract base class for modelling unary operations. This class provides the abstract interface for GUM-tree-nodes that have one silbling.

__init__(right)[source]

Default constructor.

Parameters:

right – The silbling of this instance.

depends_on()[source]

Abstract method: The implementation should return a list of the components of uncertainty, that this component depends on.

Returns:

A list of the components of uncertainty.

get_silbling()[source]

Return the silbling.

Returns:

The silbling.

__getstate__()[source]

Serialization using pickle.

Returns:

A string that represents the serialized form of this instance.

__setstate__(state)[source]

Deserialization using pickle.

Parameters:

state – The state of the object.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Add(left, right)[source]

Bases: BinaryOperation

This class models GUM-tree nodes that add two silblings.

__init__(left, right)[source]

Default constructor.

Parameters:
  • left – Left silbling of this instance.

  • right – Right silbling of this instance.

get_value()[source]

Returns the sum of the silblings assigned.

Returns:

A numeric value, representing the sum of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = x_1 + x_2 then the resulting uncertainty is u(y) = u(x_1) + u(x_2) .

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.ArcTan2(left, right)[source]

Bases: BinaryOperation

This class models the inverse two-argument tangent.

__init__(left, right)[source]

Default constructor.

Parameters:
  • left – Left silbling of this instance.

  • right – Right silbling of this instance.

get_value()[source]

Returns the sum of the silblings assigned.

Returns:

A numeric value, representing the inverse two-argument tangent of the inputs.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = x_1 + x_2 then the resulting uncertainty is u(y) = u(x_1) + u(x_2) .

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Mul(left, right)[source]

Bases: BinaryOperation

This class models GUM-tree nodes that multiply two silblings.

__init__(left, right)[source]

Default constructor.

Parameters:
  • left – Left silbling of this instance.

  • right – Right silbling of this instance.

get_value()[source]

Returns the product of the silblings assigned.

Returns:

A numeric value, representing the product of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = x_1 times x_2 then the resulting uncertainty is

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Div(left, right)[source]

Bases: BinaryOperation

This class models GUM-tree nodes that divide two silblings.

__init__(left, right)[source]

Default constructor.

Parameters:
  • left – Left silbling of this instance.

  • right – Right silbling of this instance.

arithmetic_check()[source]

Checks for divide by zero. as value.

get_value()[source]

Returns the fraction of the silblings assigned.

Returns:

A numeric value, representing the fraction of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = frac{x_1}{x_2} then the resulting uncertainty is

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Sub(left, right)[source]

Bases: BinaryOperation

This class models GUM-tree nodes that take the difference of the two silblings.

__init__(left, right)[source]

Default constructor.

Parameters:
  • left – Left silbling of this instance.

  • right – Right silbling of this instance.

get_value()[source]

Returns the difference of the silblings assigned.

Returns:

A numeric value, representing the difference of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = x_1 - x_2 then the resulting uncertainty is u(y) = u(x_1) - u(x_2) .

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Pow(left, right)[source]

Bases: BinaryOperation

This class models GUM-tree nodes that raise the left silbling to the power of the right one.

__init__(left, right)[source]

Default constructor.

Parameters:
  • left – Left silbling of this instance.

  • right – Right silbling of this instance.

get_value()[source]

Returns the power pow(left,right) of the silblings assigned.

Returns:

A numeric value, representing the power of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation

y = x_1^{x_2}

then the resulting uncertainty is

u(y) = x_2 \times x_1^{x_2-1} \times u(x_1) + x_1^{x_2} \times ln(x_1) \times u(x_2) .
Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Cos(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the Cosine of a silbling.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

get_value()[source]

Returns the Cosine of the silbling.

Returns:

A numeric value, representing the Cosine of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = cos(x) then the resulting uncertainty is u(y) = -sin(x) imes u(x) .

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Sin(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the Sine of a silbling.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

get_value()[source]

Returns the Sine of the silbling.

Returns:

A numeric value, representing the Sine of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = sin(x) then the resulting uncertainty is u(y) = cos(x) imes u(x) .

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Tan(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the Tangent of a silbling. this class may return invalid values instead of raising an OverflowError for values close to ntimesfrac{pi}{2}.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

get_value()[source]

Returns the Tangent of the silbling.

Returns:

A numeric value, representing the Tangent of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = tan(x) then the resulting uncertainty is u(y) = rac{u(x)}{cos^2(x)}.

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Sqrt(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the square root of a silbling.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

arithmetic_check()[source]

Checks for undefined arguments.

get_value()[source]

Returns the square root of the silbling.

Returns:

A numeric value, representing the square root of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = sqrt{x} then the resulting uncertainty is u(y) = frac{1}{2sqrt{x}}u(x).

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Log(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the Natural Logarithm of a silbling.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

arithmetic_check()[source]

Checks for undefined arguments.

get_value()[source]

Returns the Natural Logarithm of the silbling.

Returns:

A numeric value, representing the Natural Logarithm of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = ln(x) then the resulting uncertainty is u(y) = rac{1}{x}u(x).

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.ArcSin(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the Arc Sine of a silbling.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

arithmetic_check()[source]

Checks for undefined arguments.

get_value()[source]

Returns the Arc Sine of the silbling.

Returns:

A numeric value, representing the Arc Sine of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = arcsin(x) then the resulting uncertainty is u(y) = frac{1}{sqrt{1-x^2}}u(x).

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.ArcSinh(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the inverse Hyperbolic Sine of a silbling.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

get_value()[source]

Returns the inverse Hyperbolic Sine of a silbling.

Returns:

A numeric value, representing the inverse Hyperbolic Sine of a silbling.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = arcsinh(x) then the resulting uncertainty is

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.ArcCos(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the Arcus Cosine of a silbling.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

arithmetic_check()[source]

Checks for undefined arguments.

get_value()[source]

Returns the Arc Cosine of the silbling.

Returns:

A numeric value, representing the Arc Cosine of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = arccos(x) then the resulting uncertainty is u(y) = -frac{1}{sqrt{1-x^2}}u(x).

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.ArcCosh(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the inverse Hyperbolic Cosine.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

arithmetic_check()[source]

Checks for undefined arguments. within (1,infty].

get_value()[source]

Returns the Arc Cosine of the silbling.

Returns:

A numeric value, representing the Arc Cosine of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = arccosh(x) then the resulting uncertainty is

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.ArcTan(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the Arcus Tangent of a silbling.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

get_value()[source]

Returns the Arc Tangent of the silbling.

Returns:

A numeric value, representing the Arc Tangent of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = arcsin(x) then the resulting uncertainty is u(y) = - rac{1}{1+x^2}u(x).

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.ArcTanh(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the inverse Hyperbolic Tangent of a silbling.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

arithmetic_check()[source]

Checks for undefined arguments. within (-1,1).

get_value()[source]

Returns the Arc Tangent of the silbling.

Returns:

A numeric value, representing the inverse hyperbolic Tangent of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = arctanh(x) then the resulting uncertainty is u(y) = rac{1}{1-x^2}u(x).

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Cosh(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the Hyperbolic Cosine of a silbling.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

get_value()[source]

Returns the Hyperbolic Cosine of the silbling.

Returns:

A numeric value, representing the Hyperbolic Cosine of the silblings.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = cosh(x) then the resulting uncertainty is u(y) = sinh(x) u(x).

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Sinh(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the Hyperbolic Sine of a silbling.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

get_value()[source]

Returns the Hyperbolic Sine of the silbling.

Returns:

A numeric value, representing the Hyperbolic Sine of the silbling.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = sinh(x) then the resulting uncertainty is u(y) = cosh(x)u(x).

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Tanh(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the Hyperbolic Tangent of a silbling.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

get_value()[source]

Returns the Hyperbolic Tangent of the silbling.

Returns:

A numeric value, representing the Hyperbolic Sine of the silbling.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = tanh(x) then the resulting uncertainty is u(y) = (1 - tanh^{2}(x)) u(x).

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Exp(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the exponential of a silbling.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

get_value()[source]

Returns the exponential of the silbling.

Returns:

A numeric value, representing the exponential of the silbling.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = e^x then the resulting uncertainty is u(y) = x imes e^x imes u(x).

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Abs(right)[source]

Bases: UnaryOperation

This class models the GUM-tree-nodes that take the absolute value of a silbling.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

get_value()[source]

Returns the exponential of the silbling.

Returns:

A numeric value, representing the absolute value of the silbling.

get_uncertainty(component)[source]

Return the uncertainty of this node. For y = |x|, this returns u(y) = |u(x)|.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Neg(right)[source]

Bases: UnaryOperation

This class models the unary negation as GUM-tree-element.

__init__(right)[source]

Default constructor.

Parameters:

right – Right silbling of this instance.

get_value()[source]

Returns the exponential of the silbling.

Returns:

A numeric value, representing the negative value of the silbling.

get_uncertainty(component)[source]

Returns the uncertainty of this node. Let the node represent the operation y = -x then the resulting uncertainty is u(y) = - u(x) .

Parameters:

component – Another instance of uncertainty.

Returns:

A numeric value, representing the standard uncertainty.

equal_debug(other)[source]

A method that is only used for serialization checking.

Parameters:

other – Another instance of UncertainComponent

Returns:

True, if the instance has the same attribute values as the argument

class scuq.ucomponents.Context[source]

Bases: object

This class provides the context for an uncertainty evaluation. It maintains the correlation between the inputs and can be used to evaluate the combined standard uncertainty, as shown below. Let your model be y = f(x_1,x_2,ldots,x_N), then left(frac{delta f}{delta x_i} right)^2 u^2(x_i) + 2 sum_{i=1}^{N}sum_{j=i+1}^{N} frac{delta f}{delta x_i}frac{delta f}{delta x_j} u(x_i,x_j).

__init__()[source]

This method initializes the correlation matrix of this context. contexts. Thus, you could maintain various correlation models.

set_correlation(firstItem, secondItem, corr)[source]

This method sets the correlation coefficient r(x_1,x_2) of two inputs. Where

Parameters:
  • firstItem – Is x_1 as denoted above.

  • secondItem – Is x_2 as denoted above.

  • corr – The correlation as described by r(x_1,x_2) .

get_correlation(firstItem, secondItem)[source]

This method returns the correlation coefficient r(x_1,x_2) of two inputs. Where If no correlation has been defined before, this method returns 0.0, except for x_1 = x_2. In the last case this method returns 1.0.

Parameters:
  • firstItem – Is x_1 as denoted above.

  • secondItem – Is x_2 as denoted above.

uncertainty(component)[source]

This method returns the combined standard uncertainty of an uncertain value.

Parameters:

component – The component of uncertainty to evaluate.

Returns:

The standard uncertainty.

value_uncertainty_unit(component)[source]

This method returns the value, combined standard uncertainty, and unit of an uncertain value.

Parameters:

component – The component of uncertainty to evaluate.

Returns:

(value, The standard uncertainty,unit).

dof(component)[source]

This method calculates the effective degrees of freedom using the Welch-Satterthwaite formulae:

{\sum_{i=1}^N \frac{\left(
\frac{\delta f}{\delta x_i}\right)^4 u^4(x_i)}{\nu_i}}

Where u_c(y) is the combined standard uncertainty, no standard procedure in python to declare infinity, we use our own constant for it.

Parameters:

component – The component of uncertainty.

Returns:

The effective degrees of freedom nu_{eff} .

value_of(component)[source]