CellProfiler-plugins icon indicating copy to clipboard operation
CellProfiler-plugins copied to clipboard

CalculateMoments run error

Open ErinWeisbart opened this issue 2 years ago • 1 comments

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

ErinWeisbart avatar Jun 07 '23 20:06 ErinWeisbart

This is happening for us too, in the below code on line 53 of calculatemoments.py:

def get_object_moment(pixels, func):
    labs = np.unique(pixels)
    moms = np.zeros([np.max(labs) + 1, 1])
    for l in labs:
        if l != 0:
            px = pixels[np.where(pixels == l)]
            moms[l] = func(px)
    return moms

pixels is an array of floats 0-1, so np.max(labs) is a float and the np.zeros falls over.

wllgrnt avatar Dec 17 '23 19:12 wllgrnt