IndEcol / pySUT

Python class for handling supply and use tables
Other
15 stars 8 forks source link

Add setup.py and cleanup code, i.e. make things a bit more pythonic #1

Closed cmutel closed 9 years ago

cmutel commented 10 years ago

I think there is more cleanup to do, but this makes things a bit nicer (IMHO).

Note that this code is not python 3 specific - it works fine in 2.7, except for one test:

emerson:pySUT cmutel$ nosetests-2.7
...F....
======================================================================
FAIL: Test simple balances of SUT
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/cmutel/Code/pySUT/pysut/tests/known_results.py", line 225, in test_SUT_balances
    mySUT.compare_IndustrialUseAndSupply(), IndSupply_Use, 9)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/testing/utils.py", line 842, in assert_array_almost_equal
    precision=decimal)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/testing/utils.py", line 665, in assert_array_compare
    raise AssertionError(msg)
AssertionError:
Arrays are not almost equal to 9 decimals

(mismatch 80.0%)
 x: array([0, 0, 0, 1, 0])
 y: array([ 0.666666667,  0.428571429,  0.5        ,  1.         ,  0.375      ])