Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CalculateMoments run error #207

Open
ErinWeisbart opened this issue Jun 7, 2023 · 1 comment · May be fixed by #228
Open

CalculateMoments run error #207

ErinWeisbart opened this issue Jun 7, 2023 · 1 comment · May be fixed by #228
Labels

Comments

@ErinWeisbart
Copy link
Member

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

@wllgrnt
Copy link

wllgrnt commented Dec 17, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants