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

to_mask for list of regions #318

Open
keflavich opened this issue May 24, 2020 · 1 comment
Open

to_mask for list of regions #318

keflavich opened this issue May 24, 2020 · 1 comment

Comments

@keflavich
Copy link
Contributor

I am sure this is a duplicate of something we already have done, but I can't find it.

How do we make a mask from a list of regions? A convenience function to replace this:

    fullmask = np.zeros(image.shape, dtype='bool')
    for reg in regs:

        preg = reg.to_pixel(image.wcs)
        msk = preg.to_mask()
        mimg = msk.to_reg()
        fullmask |= mimg

would be nice. Does it exist?

@keflavich
Copy link
Contributor Author

the better approach seems to be closer to:

        composite_region = reduce(operator.or_, regs)
        preg = composite_region.to_pixel(ww.celestial)
        msk = preg.to_mask()
        cutout_pixels = msk.cutout(data)[msk.data.astype('bool')]

for what I'm trying to do (in this case, get at the pixel values so I can take their standard deviation...)

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

No branches or pull requests

2 participants