Solved by ptrblck in post #4 
              
              
                I guess you might encounter specific data arrays with constant values, so that amin and amax would return the same value and divide by 0: 
data = np.array([0.1, 0.1])
print(np.amin(data) == np.amax(data))
> True
1 / (np.amin(data) - np.amax(data))
> inf