hyloa.utils.err_format module
Code to ensure correct print format for error
- hyloa.utils.err_format.format_value_error(val, err)[source]
A function that returns the formatting of the measurement with error in the form: value(error). Therefore, the error refers to the last digit of the value. Only one significant digit for the error is displayed. If the error is smalle than 1e-3 or bigger 1e3 the scientific notation will be used.
- Parameters:
val (float) – central values
err (float) – error associated to val
- Return type:
string
Examples
>>> print(format_value_error(1.234598, 0.01631) 1.23(2) >>> print(format_value_error(1234.523, 12.0) 1235(12) >>> print(format_value_error(12300000.0 ± 340000.0) 1.23(3)e7 >>> print(format_value_error(5.6e-05, 1.2e-06) 5.6(1)e-5