Git Product home page Git Product logo

Comments (8)

clbarnes avatar clbarnes commented on August 24, 2024

I ran the tests with nose and got this trace:

.............F.F......../usr/local/lib/python3.4/dist-packages/bctpy-0.4.0-py3.4.egg/bct/bct.py:187: RuntimeWarning: invalid value encountered in true_divide
  pnm=Snm/(np.tile(S,(m,1)).T)
..EE.....F..F...../usr/local/lib/python3.4/dist-packages/bctpy-0.4.0-py3.4.egg/bct/bct.py:689: RuntimeWarning: invalid value encountered in true_divide
  P=np.ones((n,))-Sc2/np.square(S)
../usr/local/lib/python3.4/dist-packages/bctpy-0.4.0-py3.4.egg/bct/bct.py:2876: RuntimeWarning: invalid value encountered in double_scalars
  dc = (mc - min_mc) / (nc*(nc-1)/2 - min_mc) #community density
E
======================================================================
ERROR: modularity_tests.test_modularity_louvain_und
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/cbarnes/code/lib/bctpy/test/modularity_tests.py", line 17, in test_modularity_louvain_und
    _,q = bct.modularity_louvain_und(x, seed=seed)
  File "/usr/local/lib/python3.4/dist-packages/bctpy-0.4.0-py3.4.egg/bct/bct.py", line 3581, in modularity_louvain_und
    ci[h][np.where(ci[h-1]==i+1)]=mi    #assign new modules
NameError: name 'mi' is not defined

======================================================================
ERROR: modularity_tests.test_modularity_finetune_und
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/cbarnes/code/lib/bctpy/test/modularity_tests.py", line 50, in test_modularity_finetune_und
    ci,oq = bct.modularity_louvain_und(x, seed=seed)
  File "/usr/local/lib/python3.4/dist-packages/bctpy-0.4.0-py3.4.egg/bct/bct.py", line 3581, in modularity_louvain_und
    ci[h][np.where(ci[h-1]==i+1)]=mi    #assign new modules
NameError: name 'mi' is not defined

======================================================================
ERROR: very_long_tests.test_link_communities
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/cbarnes/code/lib/bctpy/test/very_long_tests.py", line 8, in test_link_communities
    M = bct.link_communities(x)
  File "/usr/local/lib/python3.4/dist-packages/bctpy-0.4.0-py3.4.egg/bct/bct.py", line 2892, in link_communities
    u1,u2 = np.where( ES[np.ix_(U,U)]==np.max(ES[np.ix_(U,U)]) )
  File "/usr/local/lib/python3.4/dist-packages/bctpy-0.4.0-py3.4.egg/bct/bct.py", line 2892, in link_communities
    u1,u2 = np.where( ES[np.ix_(U,U)]==np.max(ES[np.ix_(U,U)]) )
  File "/usr/lib/python3.4/bdb.py", line 48, in trace_dispatch
    return self.dispatch_line(frame)
  File "/usr/lib/python3.4/bdb.py", line 66, in dispatch_line
    self.user_line(frame)
  File "/usr/lib/python3.4/pdb.py", line 259, in user_line
    self.interaction(frame, None)
  File "/usr/lib/python3.4/pdb.py", line 346, in interaction
    self._cmdloop()
  File "/usr/lib/python3.4/pdb.py", line 319, in _cmdloop
    self.cmdloop()
  File "/usr/lib/python3.4/cmd.py", line 126, in cmdloop
    line = input(self.prompt)
nose.proxy.TypeError: bad argument type for built-in operation
-------------------- >> begin captured stdout << ---------------------
hierarchy 0
hierarchy 1
hierarchy 2
hierarchy 3
hierarchy 4
hierarchy 5
hierarchy 6
> /usr/local/lib/python3.4/dist-packages/bctpy-0.4.0-py3.4.egg/bct/bct.py(2892)link_communities()
-> u1,u2 = np.where( ES[np.ix_(U,U)]==np.max(ES[np.ix_(U,U)]) )

--------------------- >> end captured stdout << ----------------------

======================================================================
FAIL: core_tests.test_threshold_proportional
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/cbarnes/code/lib/bctpy/test/core_tests.py", line 8, in test_threshold_proportional
    assert np.allclose( np.sum(x), 22548.51206965 )
AssertionError

======================================================================
FAIL: core_tests.test_threshold_proportional_directed
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/cbarnes/code/lib/bctpy/test/core_tests.py", line 18, in test_threshold_proportional_directed
    assert np.allclose( np.sum(x), 32852.72485433 )
AssertionError

======================================================================
FAIL: modularity_tests.test_modularity_finetune_dir_low_modularity
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/cbarnes/code/lib/bctpy/test/modularity_tests.py", line 144, in test_modularity_finetune_dir_low_modularity
    assert q >= oq
nose.proxy.AssertionError: 
-------------------- >> begin captured stdout << ---------------------
0.0692747009074 0.0694071961372

--------------------- >> end captured stdout << ----------------------

======================================================================
FAIL: modularity_tests.test_modularity_finetune_dir
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/usr/local/lib/python3.4/dist-packages/nose/case.py", line 198, in runTest
    self.test(*self.arg)
  File "/home/cbarnes/code/lib/bctpy/test/modularity_tests.py", line 166, in test_modularity_finetune_dir
    assert q >= oq
nose.proxy.AssertionError: 
-------------------- >> begin captured stdout << ---------------------
0.359308571478 0.359820950972

--------------------- >> end captured stdout << ----------------------

----------------------------------------------------------------------
Ran 45 tests in 172.041s

FAILED (errors=3, failures=4)

So it looks like the failures are due to small float inequalities (although you'd know better than me if they're important). The errors may be more tricky as it seems like enumerate is failing to produce a variable...

from bctpy.

aestrivex avatar aestrivex commented on August 24, 2024

A few of the errors are my fault. In fact in one or two of the complex modularity tests, the test case has never passed -- it should in principle pass, but I think the math crumbles in the edge case given.

I created a branch called py3 that you can push to. I'll look at the test cases that are still failing and see what I can do. But, if I can't fix it easily, I have a relatively limited supply of effort to spend on supporting python 3, it is not a huge priority of mine.

from bctpy.

clbarnes avatar clbarnes commented on August 24, 2024

I get that. As the dependencies are pretty thin I suspect there shouldn't be too much to fix (which I can pitch in on once you've zeroed in on the actual red tests), and most 2.7 code can be written in such a way as to be future-compatible if you're still expanding the codebase and don't mind a couple of extra lines to support users of the present and future version of the language.

from bctpy.

aestrivex avatar aestrivex commented on August 24, 2024

I fixed some outstanding bugs in some lesser used modularity functions that were causing some of the errors to be thrown (which were not related to python 3, I just forgot to propagate the fixes to a previous bug).

The errors ostensibly caused by python 3 conversion which I haven't traced down are in threshold_proportional and link_communities.

link_communities is an extremely long-runtime function which I ported directly from the matlab code. It is very inefficient and the python implementation is even slower than the matlab version. Not sure if your test case crashed because it ran too long or for some other system reason. It isn't very important because it is somewhat experimental and redundant; most users would probably opt to use much faster algorithms that accomplishing something similar such as modularity_und.

It makes little sense why threshold_proportional and related would fail with assertion errors. That function is important.

from bctpy.

clbarnes avatar clbarnes commented on August 24, 2024

Thanks, I'll get them merged in to my branches and see if it's anything I can manage.

I've been playing with TravisCI today and have got the build deploying but the tests are crashing out after a long hold (10+ minutes), which is odd as they pass/fail quite quickly on my local machine. I'll raise an issue on my own fork. Do any of the tests use mayavi? That would be tricky to install on travis.

from bctpy.

clbarnes avatar clbarnes commented on August 24, 2024

I can't see a py3 branch - maybe it doesn't make the branch visible if there are no changes?

from bctpy.

aestrivex avatar aestrivex commented on August 24, 2024

No tests use mayavi.

I don't know how branches work very well on github. I tried to make a branch on github but not on my local repository and I guess it did nothing. Anyway now I added a commit to this branch which adds a whitespace character to the readme.

from bctpy.

aestrivex avatar aestrivex commented on August 24, 2024

Remaining python 3 tests pass. Master branched merged with py3 branch.

Old code available under py2-stable branch in case of likely obscure bugs.

from bctpy.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.