The onCells array is filled mostly with β0.0β and if all values are zero the activeCoincIndices array would be empty. On python 3 that is the case whereas on python 2.7 there are some non zero values. The things is that all the non zero values are very small, I mean small as β2.1219957909652723e-314β. I have checked:
if(len([x for x in onCells if abs(x) > 0.00000000001]) > 0):
print 'good values'
and onCells never seem to have anything useful in it. Is that a correct observation?
In any event, when there are only 0.0 in onCells the code will fault because of division by zero.
factor = max(summ)*len(summ)/sum(summ)
Is it correct to fix the test like this:
if(len([x for x in summ if x!=0]) > 0):
zeros = len([x for x in summ if x==0])
factor = max(summ)*len(summ)/sum(summ)
OK, I just saw there was a nupic bug fix from 2018/1/16 which is related to this issue. At least now the values make sense that are returned from the SpatialPooler compute().