Weights for image combination to roughly match legacy viewer?

25 views
Skip to first unread message

Imad Pasha

unread,
Oct 16, 2023, 1:05:05 PM10/16/23
to DECam Legacy Survey
Hi, 

Apologies if this information exists somewhere as I have been unable to find it. I am using legacy cutouts for finder charts, and thus need the fits download in order to properly match wcs's and place slitmasks/etc. down. But I would like if possible to combine my g-r-z fits extensions into one color image that looks close to what one would see on legacyviewer for consistency. 

The make_lupton_rgb() function from astropy works to combine the bands (as does my own weighted sum), but I have not found a set of parameters that nicely matches legacy (or even looks "good"). Does anyone have advice on what weights to use for the three bands and/or another functional combination of them that looks similar to what legacyviewer uses? 

Cheers, 
Imad

Dustin Lang

unread,
Oct 16, 2023, 1:17:24 PM10/16/23
to Imad Pasha, DECam Legacy Survey
Hi,

Here's the code that the viewer uses to make its RGB images:
(which calls the function just above,)

cheers,
dustin


--
You received this message because you are subscribed to the Google Groups "DECam Legacy Survey" group.
To unsubscribe from this group and stop receiving emails from it, send an email to decam-legacy-su...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/decam-legacy-survey/0e7b0b56-9868-4ade-93c9-d3179ba090ecn%40googlegroups.com.

Imad Pasha

unread,
Oct 16, 2023, 1:58:57 PM10/16/23
to DECam Legacy Survey
Dustin, 

Thanks for the quick reply, this will be awesome! 

I tried running a fits cutout from legacy through the function

from astropy.io import fits
im = hdu[0].data
out = dr2_rgb(im,bands=['g','r','z'])

where the `im` shape is that standard (3,256,256) and I get out an array (256,256,3) for which all pixels have a single value of 0.12719311. 

Any ideas why? Am I feeding in the bands wrong, or otherwise have something else wrong in usage? There's some sections commented out in the sdss_rgb() function as well, not sure if they should be turned on for this case?

Dustin Lang

unread,
Oct 16, 2023, 2:59:53 PM10/16/23
to Imad Pasha, DECam Legacy Survey
Hi Imad,

The `dr2_rgb` function wants a list of images, so I think you could do:

out = dr2_rgb([im[:,:,i] for i in range(3)], bands=['g','r','z'])

cheers,
dustin

Reply all
Reply to author
Forward
0 new messages