Skip to main content

A library of functions that help present numerical data in a specified format

Project description

Module: Sigfig v0.1
Developed by: Michael Busuttil, Travis Valdez
Last Updated: Friday, January 10, 2014

Usage:

roundit(number, unc, **kwds):
*Possible Keywords:
a) "form = ____"
i) "SI" **default** : numbertosigfigs(uncertainty)
ii) "plusminus": numbertosigfigs +/- uncertainty
iii) "tuple": [numbertosigfigs,uncertainty]
b) crop: specifies the number under which the uncertainty is
rounded to two significant figures, and over which the uncer-
tainty is rounded to one significant figure.
- NOTE: DEFAULT IS 0

- Used to round an uncertainty (unc) to the proper crop value, round
the number (number) to match the uncertainty, and return the number
and the uncertainty in the proper form
- NOTE: THIS FUNCTION IS PERFORMED ONLY IF THE UNCERTAINTY
VALUE IS NOT AN INTEGER. IF THE UNCERTAINTY IS AN INTEGER
VALUE, ENTER IT AS A STRING (Ex. 1 --> '1')
- Used to round a number (number) to a specified amount of significant
figures (unc)
- NOTE: THIS FUNCTION IS PERFORMED ONLY IF THE UNCERTAINTY
VALUE IS AN INTEGER

*Examples:
>>> roundit(1234,1)
**WARNING:: INTEGER UNCERTAINTY VALUE --> ROUNDED TO**
**1 SIGNIFICANT FIGURE(S)**
'1 000'

>>> roundit(1234,'1')
'1 234(1)'

>>> roundit(1.234567,0.0001234)
'1.234 6(1)'

>>> roundit(1.234567,0.0001234,crop=30)
'1.234 57(12)'

>>> roundit(1.234567,0.0001234,crop=30,form="plusminus")
'1.234 57 +/- 0.00012'

>>> roundit(1.234567,0.0001234,crop=30,form="tuple")
['1.234 57', '0.00012']

PLEASE DIRECT ANY COMMENTS/SUGGESTIONS/BUGS TO: drake@pcxftw.com. THANK YOU FOR DOWNLOADING!

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sigfig-0.1.tar.gz (5.7 kB view hashes)

Uploaded Source

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page