convert value, unc, unit input to output in value, unit and relative unc #12
Replies: 3 comments 3 replies
-
@bytelinker I need more explanation here. Your example code is a confusing mix of things that will work with and without any changes to
One multipart question:
|
Beta Was this translation helpful? Give feedback.
-
|
Beta Was this translation helpful? Give feedback.
-
There might be more examples like: https://deanza.edu/faculty/lunaeduardo/documents/UncertaintyandSignificantFig.pdf page 5/5. There are more examples in tables, but the value und unc are written in separate columns. Case 7.10.3 could be covered by a strict option, which is true by default and disables 7.10.3, so the used could enable it. |
Beta Was this translation helpful? Give feedback.
-
sform = sciform.Formatter(precision=2, unicode_pm=True)
#input
a_value = 1.23456789
a_unc = 0.056789
#sform = sciform.Formatter(precision=2, unicode_pm=True, output_unc='percent'|'ppm', unit_str='unit)
a_unc_rel_percent = 100 * a_unc/a_value
#round a_value by precision and a_unc, calculate a_unc_rel_percent|ppm, round result by precision
print(f'unc_rel = {a_unc_rel_percent:.1f} %')
print(f'({sform(a_value, a_unc)}) unit')
print(f'{a_value:.3f} unit ± {4.6} %')
#output:
'''
unc_rel = 4.6 %
(1.235 ± 0.057) unit
1.235 unit ± 4.6 %
'''
Beta Was this translation helpful? Give feedback.
All reactions