The exposed user class is class PrintableUndarray, but there exists some more-deep guts like class upy.printable.PrintableElement, class upy.printable.Widths, and the upy.decimal2 module.
Prints an undarray. To print subportions, use __getattr__().
Print undarray UNDARRAY or printable array PRINTABLE_ARRAY by giving SIGMAS standard deviations as uncertainty.
To enforce the printing of optional ‘+’ signs in the value and the exponent, use ENFORCE_SIGN_VALUE and ENFORCE_SIGN_EXPONENT.
The three FORMATS supported are ‘float’, e.g. 0.120 +- 0.034, ‘exp’, e.g. (1.20 +- 0.34) 10^-1, and ‘int’, e.g. 12300 +- 4500. By default, the format will be determined from the values and the uncertainties. The ‘int’ mode is choosen upon integer type of values and uncertainties. If the uncertainty is all-zero, the printing mode will be determined from the value alone, else both must be integer to enable int printing mode.
PRECISION influences the precision of the output. Generally, the precision is determined from the uncertainty. With PRECISION = 1, the output will look like (1.0 +- 0.3), with PRECISION = 2, like (1.00 +- 0.23). If the uncertainty is zero, INFINITE_PRECISION will be used instead, giving the number of digits beind the point, either in float or exp mode. In int mode all post-point digits are suppressed. If both the value and the uncertainty are zero, only (0 +- 0) is printed. The default PRECISION is 2.
Note that you can affect the way the array is printed also by calling numpy.set_printoptions().
VALUE is the nominal value, UNCERTAINTY a value proportional to the standard deviation. The proportionality factor depends on what the user intends to print.
To enforce the printing of optional ‘+’ signs in the value and the exponent, use ENFORCE_SIGN_VALUE and ENFORCE_SIGN_EXPONENT.
The three FORMATS supported are ‘float’, e.g. 0.120 +- 0.034, ‘exp’, e.g. (1.20 +- 0.34) 10^-1, and ‘int’, e.g. 12300 +- 4500. By default, the format will be determined from the values and the uncertainties. The ‘int’ mode is choosen upon integer type of values and uncertainties. If the uncertainty of a value is zero, the printing mode will be determined from the value alone, else both must be integer to enable int printing mode.
PRECISION influences the precision of the output. Generally, the precision is determined from the uncertainty. With PRECISION = 1, the output will look like (1.0 +- 0.3), with PRECISION = 2, like (1.00 +- 0.23). If the uncertainty is zero, INFINITE_PRECISION will be used instead, giving the number of digits beind the point, either in float or exp mode. In int mode all post-point digits are suppressed. If both the value and the uncertainty are zero, only (0 +- 0) is printed. The default PRECISION is 2.
Calculates the leftmost digit, and formats real numbers. All values given to __init__() are read-write, except for .precision, which must be set via .set_precision(), and .exponent, which must be set via .set_exponent().
VALUE is the value to be formatted. INFINITE_PRECISION is the number of digits used when emulating infinite precision (default 15). EXPONENT is the power of ten separated up from the VALUE. Example: VALUE = 12.3 and EXPONENT = 1 -> 1.23e1. Strings returned represent .value_without_exponent up to digit with weight 10 ** PRECISION. If ENFORCE_SIGN is True, return a ‘+’ in front of positive numbers. If CEIL is True, discarded portions of the number will always increase the value represented by the string. When calculating the parts of the string, WIDTH_* are used. By default IntPlus(infinite = True) is used as PRECISION. WIDTH_SIGN forces the sign to have a certain width, this means, the sign string will be padded with whitespace, right justified. WIDTH_LEFT is the width of the sign string plus the string before the point, right justified. WIDTH_POINT is the width of the point, center justified. WIDTH_RIGHT is the width of the post-point string, left justified.
Set the precision to PRECISION. If it is an IntPlus instance, it will be taken over, else an IntPlus instance will be created.
The position of the leftmost digit of .value_without_exponent in decimal representation. A position of zero means, that the leftmost digit is the digit with weight 10 ** 0. Other return values RETURN mean, that the leftmost non-zero digit has weight 10 ** RETURN. Thus nonnegative RETURNs are before the point in “fixed-point” representation, and negative RETURNs will be behind the point.
To obtain a real value with the leftmost non-zero digit at weight 1, use the expression VALUE * 10 ** (-RETURN).
Note that the return value is an instance of class IntPlus, which may represent infinity too (in case .value_without_exponent == 0).
You can supply an initial position of the search via GUESS.
Represents number in Z+ = Z + {Infinity}. Read-only attributes:
.z - The number. .infinite - The instance represents Infinity.