rwl / PYPOWER

Port of MATPOWER to Python
http://rwl.github.io/PYPOWER/api/
Other
329 stars 110 forks source link

TypeError: 'numpy.float64' object cannot be interpreted as an integer #39

Closed chengts95 closed 7 years ago

chengts95 commented 7 years ago

It seems that there is a tiny mistake with the current master branch in ext2int.py Line 151 where o["bus"]["e2i"] = zeros(max(o["bus"]["i2e"]) + 1) should be o["bus"]["e2i"] = zeros(max(o["bus"]["i2e"]).astype(int) + 1), or you will get aTypeError: 'numpy.float64' object cannot be interpreted as an integer when you call ext2int().

activeshadow commented 7 years ago

I'm seeing this same issue... though the traceback I'm seeing is reporting the line as 152. Makes me sad panda. :cry:

activeshadow commented 7 years ago

I'll create a pull request once I can test my fix referenced above.

chengts95 commented 7 years ago

Although the bug is easy to fix, it is really weird to see the line as 152 instead of 151 in traceback.

activeshadow commented 7 years ago

Yeah, I agree. However, the line of code printed in the traceback is the same line of code that's at line 151 in the source, so who knows where the extra line break got added in. That did fix the error I was getting though.