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

[NEW FEATURE] Weight Handling #604

Open
lbaumo opened this issue Jan 11, 2023 · 4 comments
Open

[NEW FEATURE] Weight Handling #604

lbaumo opened this issue Jan 11, 2023 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@lbaumo
Copy link

lbaumo commented Jan 11, 2023

Ngmix requires variance maps (or inverse variance maps, I can't ever remember which) as input. Theli weights need to be rescaled by the inverse sky variance. Megapipe weights are mysterious, so non-zero pixels are set to 1 then scaled by the inverse background variance. This inverse variance is currently calculated per postage stamp. I think this should be updated to the sextractor value (which should be already present in the psfex run) in the vignet step. Also, we need to find out what the megapipe weights actually contain.

@lbaumo lbaumo added the enhancement New feature or request label Jan 11, 2023
@lbaumo
Copy link
Author

lbaumo commented Jan 11, 2023

I found this "The values of a weight map pixel is proportional to the inverse of the variance of that pixel in the main image." This documentation is for an older version of megapipe when cfht had 36 ccds. However, the images themselves seem to have pixel values of 1 or zero. Time to email Stephen Gwyn to make sure.

@lbaumo
Copy link
Author

lbaumo commented Jan 11, 2023

from Stephen Gwyn "The weight images for the individual images are, strictly speaking, masks (0 or 1)"

@aguinot
Copy link
Contributor

aguinot commented Jan 19, 2023

What ngmix needs are inverse variance weights.
Those maps can almost be created for free with the pipeline as it is. The procedure that is used to get the background images can be applied to create an rms map. Basically by just adding BACKGROUND_RMS to the list of CHECKIMAGE_TYPE. Then, just like we do with the background, the pipeline can creates postage stamps with the vignet_maker at galaxy positions. Finally there will be a little bit of work in the ngmix_runner to read those files as input and compute the 1/(BACKGROUND_RMS)^2 which should be very easy to do.

Side note: I just noticed that SExtractor can actually produce a background subtracted image by adding -BACKGROUND to the list of check images. We could consider doing that instead of computing it in the ngmix_runner. Results should be identical though.

@martinkilbinger
Copy link
Contributor

Would be good to use the THELI weight images.

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

No branches or pull requests

4 participants