[AstroPy] DS9 color tables in Python

John Zuhone jzuhone at gmail.com
Tue Mar 31 09:36:04 EDT 2015


It's definitely do-able, I did it for a couple of ds9 colormaps by hand for
yt, actually. I can try seeing if I can script it up.

On Tue, Mar 31, 2015 at 9:01 AM, Peter Teuben <teuben at astro.umd.edu> wrote:

> On 03/31/2015 08:25 AM, Thomas Robitaille wrote:
> > On 31 March 2015 at 14:00, Peter Weilbacher <pweilbacher at aip.de> wrote:
> >> Dear all,
> >>
> >> has anyone succeeded to set up DS9-like color tables for plotting in
> >> Python? I'm specifically interested in "heat", "sls", "hsv", and "b".
> >>
> >> I know that matplotlib defines somewhat similar tables, but e.g.
> >> "gist_heat" is just too different from DS9's (and skycat's) heat...
> > If this doesn't exist, this might be a good addition to
> > astropy.visualization or pyds9!
> >
> > Tom
>
>
> Since I had done something similar in a long ago past, I had a quick peek
> at the source distro of ds9.   I was surprised to see this part documented
> very lightly (if at all), but the "obvious" code to look at is in
>     saods9/saotk/colorbar/default.C
> where a series of
>
>   red.append(new LIColor(0,0));
>   red.append(new LIColor(1,1));
>
>   green.append(new LIColor(0,0));
>   green.append(new LIColor(1,1));
>
>   blue.append(new LIColor(0,0));
>   blue.append(new LIColor(1,1));
>
> create a colortable.   The SLS color scheme, which happens to
> be my favorite, does this in RGB space:
>
>   colors.append(new RGBColor(0.000000, 0.000000, 0.000000));
>   colors.append(new RGBColor(0.043442, 0.000000, 0.052883));
>   colors.append(new RGBColor(0.086883, 0.000000, 0.105767));
>   colors.append(new RGBColor(0.130325, 0.000000, 0.158650));
> ...
>   colors.append(new RGBColor(1.000000, 1.000000, 1.000000));
>   colors.append(new RGBColor(1.000000, 1.000000, 1.000000));
>   colors.append(new RGBColor(1.000000, 1.000000, 1.000000));
>
> others are done programmatically (check out HSV )
>
> I NEMO and GIPSY these live as ascii tables with 256 entries of RGB
> scaled 0..1, and I checked a few and the ds9 ones seem to match
> the ones I see in GIPSY or NEMO. (NEMO/data/lut or GIPSY/dat/lut)
>
> The ds9 codebase also has some yacc & lex parsing, i'm not clear
> if that's still used. Clearly the distribution doesn't contain these
> LUT ascii type files. If we're interested in persuing this, we should
> check with Bill Joye about the best approach to scrape it the right
> way.
>
> My old notes from 2003 tell me that ds9 can read my LUT/RGB ascii tables,
> but I cannot find this in the current ds9 (7.3.x)
> http://carma.astro.umd.edu/nemo/man_html/lut.5.html
>
> peter
>
>
>
>
>
> _______________________________________________
> AstroPy mailing list
> AstroPy at scipy.org
> http://mail.scipy.org/mailman/listinfo/astropy
>



-- 
John ZuHone

Postdoctoral Researcher
NASA/Goddard Space Flight Center

jzuhone at gmail.com
john.zuhone at nasa.gov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20150331/329b524a/attachment.html>


More information about the AstroPy mailing list