def uarray(nominal_values, std_devs=None): """ Return a NumPy array of numbers with uncertainties initialized with the given nominal values and standard deviations. nominal_values, std_devs -- valid arguments for numpy.array, with identical shapes (list of numbers, list of lists, numpy.ndarray, etc.). std_devs=None is only used for supporting legacy code, where nominal_values can be the tuple of nominal values and standard deviations. """ if std_devs is None: # Obsolete, single tuple argument call deprecation('uarray() should now be called with two arguments.') (nominal_values, std_devs) = nominal_values return (numpy.vectorize( # ! Looking up uncert_core.Variable beforehand through # '_Variable = uncert_core.Variable' does not result in a # significant speed up: lambda v, s: uncert_core.Variable(v, s), otypes=[object])(nominal_values, std_devs))
def uarray(nominal_values, std_devs=None): """ Return a NumPy array of numbers with uncertainties initialized with the given nominal values and standard deviations. nominal_values, std_devs -- valid arguments for numpy.array, with identical shapes (list of numbers, list of lists, numpy.ndarray, etc.). std_devs=None is only used for supporting legacy code, where nominal_values can be the tuple of nominal values and standard deviations. """ if std_devs is None: # Obsolete, single tuple argument call deprecation('uarray() should now be called with two arguments.') (nominal_values, std_devs) = nominal_values return (numpy.vectorize( # ! Looking up uncert_core.Variable beforehand through # '_Variable = uncert_core.Variable' does not result in a # significant speed up: lambda v, s: uncert_core.Variable(v, s), otypes=[object]) (nominal_values, std_devs))
def umatrix(nominal_values, std_devs=None): """ Constructs a matrix that contains numbers with uncertainties. The arguments are the same as for uarray(...): nominal values, and standard deviations. The returned matrix can be inverted, thanks to the fact that it is a unumpy.matrix object instead of a numpy.matrix one. """ if std_devs is None: # Obsolete, single tuple argument call deprecation('umatrix() should now be called with two arguments.') (nominal_values, std_devs) = nominal_values return uarray(nominal_values, std_devs).view(matrix)
def __call__(self): deprecation('the std_devs attribute should not be called' ' anymore: use .std_devs instead of .std_devs().') return self
def __call__ (self): deprecation('the std_devs attribute should not be called' ' anymore: use .std_devs instead of .std_devs().') return self