aestrivex/bctpy

name 'rng' is not defined

pavelwood opened this issue · 3 comments

Hello,
I'm trying to use reorder_matrix function but it fails with the following error:


NameError Traceback (most recent call last)
in
----> 1 stability_matrix_reordered ,matindices, matcost =bct.reorder_matrix(stability_matrix,H=1000)

~/opt/anaconda3/lib/python3.8/site-packages/bct/utils/visualization.py in reorder_matrix(m1, cost, verbose, H, Texp, T0, Hbrk)
577 T = T0 * Texp**h
578 atmp = anew.copy()
--> 579 r1, r2 = rng.randint(n, size=(2,))
580 while r1 == r2:
581 r2 = rng.randint(n)

NameError: name 'rng' is not defined

I installed the library through pip install and other functions seem to work nicely.
Thanks a lot
Paolo

Hi, I have the same issue in the same script, but using align_matrices. It looks like rng is np.random, since the script works if I add import np.random as rng into the visualization.py script. @aestrivex is this the correct solution or is there something obvious I'm missing? Thanks!

thanks vss245. I had the same issue and your solution worked for me.

Done