CosmoStat / shapepipe

Shape Measurement Pipeline
MIT License
17 stars 13 forks source link

[NEW FEATURE] Weight Handling #604

Open lbaumo opened 1 year ago

lbaumo commented 1 year ago

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 commented 1 year ago

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 commented 1 year ago

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

aguinot commented 1 year ago

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 commented 11 months ago

Would be good to use the THELI weight images.