-
Notifications
You must be signed in to change notification settings - Fork 2
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
Add CLI for MBC masking #174
Comments
I think a general switch up to this stage might be best now that I look at this. I can also remove some of the older approaches. Can also add something to erode island shapes based on some arbitrary shape. For instance on based on the shape of the restoring beam above a particular level # fits_data is a mask file, made up of 1.0s and 0.0s
beam = Beam.from_fits_header(fits_hdr)
k = beam.as_kernel(pixscale=2.5*u.Unit("arcsec"), x_size=fits_data.shape[1], y_size=fits_data.shape[0])
# Cut the shape based on the 60 percent response level
circ = k.array > (np.max(k.array) * 0.6)
invert_f_data = np.fft.fft2(fits_data)
invert_circ = np.fft.fft2(circ)
deconvolved = invert_f_data * invert_circ
forward = np.fft.fftshift(np.fft.ifft2(deconvolved))
forward = np.floor(np.abs(forward) + 0.5)
mask = forward >= np.sum(circ) The above is almost certainly the same as the binary erosion approaches already in scipy with a particular structure function |
Confirmed that the above code produced a mask with the same shape as using Provided the size of the beam shape kernel is small the scipy erosion is many times faster than the approach above, where the inputs need to have the same set of spatial scales (and hence a lot of padding). |
Working on this in the |
Pull request in #178 |
Merged. Closing. |
Add a cli task to apply the minimum absolute boxcar filter
Requires input options for:
file to mask
inflation factor
optionally output file name
optionally lower limit flood factor
- if provided do flood fill out to this level
The text was updated successfully, but these errors were encountered: