skip to navigation
skip to content

Not Logged In

sigfig 0.1

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

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!
 
File Type Py Version Uploaded on Size
sigfig-0.1.tar.gz (md5) Source 2014-01-24 5KB
  • Downloads (All Versions):
  • 4 downloads in the last day
  • 27 downloads in the last week
  • 157 downloads in the last month