Wiki

Clone wiki

Sunrise / MakingColorImages

Making color composite images

To make color composite images like those shown in CoolImagesAndMovies, you can use code in Patrik's python repository at BitBucket. Clone the python repository and import the module make_color. The module docstring has more info.

Examples

Here are a few examples that illustrate the most common use cases:

Showing an image

To show an image interactively, load the image data with pyfits and use matplotlib's imshow. This works best if you use ipython --pylab:

import make_color, pyfits
f=pyfits.open("broadband_010.fits")
im=transpose(f['CAMERA0-BROADBAND'].data, axes=(1,2,0))
imshow(make_color.make_image(im, band=(6,4,2), scale="auto", return_jpeg=False))
Write jpeg images of all Sunrise output in a directory

Once you know good values for the scale, it's easy to make jpegs for all images.

import make_color, glob
files=glob.glob("broadband_*.fits")
[ make_color.write_all(f, "-BROADBAND", f+"-%d.jpg", band=(6,4,2), scale=(1.5,1,1.5), overwrite=True) for f in files ]

Updated