You are not logged in.

#1 2012-11-29 13:02:38

mpnordland
Member
Registered: 2011-11-29
Posts: 46

pymodcalc: Python MODular CALCulator

I've had this idea for some time, but I decided to implement it today.
You use it like this:

 pymodcalc <module> <module args>

<module> can be any module found in the modules sub directory.


to create your own module, create a python file in the modules directory using this
format:

<your module name>.py

Then, in that file, define these two functions:

printDoc()
    use print() to print out how to use your modules
    currently there are no restrictions on what you can print
   
doCalc(*args)
    you should use the variable argument list
    and raise a CalculationError (availible from helpers.calcerror)
    with your reason. You can use CalculationError for whatever
    problems you encounter while doing the calculation.
    when you have the final result, return it.
   
Once you've done that, you can use it with pymodcalc, and do a pull request on BitBucket to get it included!

Modules availible currently:
add - add all numbers passed to it
subtract - subtract subsequent numbers from the first number
wcf - calculate Wind Chill Factor, may not be working right
complex - does equations in python, must follow python syntax, has math and decimal availible
dd_dms - Convert decimal degrees to degrees, minutes, and seconds, and back.


You can clone it from mecurial here: https://bitbucket.org/mnordland/pymodca … lc.tar.bz2

Last edited by mpnordland (2012-11-30 16:37:10)

Offline

#2 2012-11-30 16:36:36

mpnordland
Member
Registered: 2011-11-29
Posts: 46

Re: pymodcalc: Python MODular CALCulator

New Module: dd_dms
Convert decimal degrees to degrees, minutes, and seconds, and back.

Offline

Board footer

Powered by FluxBB