null_model_*_sign has bugs
clbarnes opened this issue · 1 comments
clbarnes commented
b02a306 fixed one bug in bct.algorithms.reference.null_model_und_sign
, but the directed equivalent has the same bug. Neither are exercised in unit tests, and fail for other reasons (on py37) when that bug is fixed:
Traceback (most recent call last):
File "/home/barnesc/.pyenv/versions/3.6.5/envs/bctpy/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
self.test(*self.arg)
File "/home/barnesc/work/code/bctpy/test/reference_tests.py", line 14, in test_null_model_und_sign
bct.null_model_und_sign(x)
File "/home/barnesc/work/code/bctpy/bct/algorithms/reference.py", line 1067, in null_model_und_sign
R = rng.permutation(m)[:np.min((m, wei_period))]
TypeError: slice indices must be integers or None or have an __index__ method
Then when that slice bound is wrapped in int()
,
Traceback (most recent call last):
File "/home/barnesc/.pyenv/versions/3.6.5/envs/bctpy/lib/python3.6/site-packages/nose/case.py", line 198, in runTest
self.test(*self.arg)
File "/home/barnesc/work/code/bctpy/test/reference_tests.py", line 14, in test_null_model_und_sign
bct.null_model_und_sign(x)
File "/home/barnesc/work/code/bctpy/bct/algorithms/reference.py", line 1075, in null_model_und_sign
P[i[o], :] *= f
TypeError: Cannot cast ufunc multiply output from dtype('float64') to dtype('int64') with casting rule 'same_kind'