From 818d67ed460b73b652e813cd1fb1985cf231d4a8 Mon Sep 17 00:00:00 2001 From: Ricardo Zanmar Date: Wed, 22 Jun 2011 17:57:42 +0200 Subject: [PATCH] The script I used to format ds9's SLS color table --- formatsls.py | 53 ++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100755 formatsls.py diff --git a/formatsls.py b/formatsls.py new file mode 100755 index 0000000..5cf3cff --- /dev/null +++ b/formatsls.py @@ -0,0 +1,53 @@ +#!/usr/bin/python2 + +# format the sls file so it is compact in C + +f = open( 'sls.lut', 'r' ) +line = f.readlines() +f.close() + +r = [] +g = [] +b = [] + +for i in line: + val = i.split() + r.append( float( val[ 0 ] ) ) + g.append( float( val[ 1 ] ) ) + b.append( float( val[ 2 ] ) ) + +print "const float slsR[] ={", +for x in r: + #x = x * 255 ) + if( x == 0 ): + print "0,", + elif( x == 1.0 ): + print "1,", + else: + print "%8.6f," %( x ), + +print + +print "const float slsG[] ={", +for x in g: + #x = x * 255 ) + if( x == 0 ): + print "0,", + elif( x == 1.0 ): + print "1,", + else: + print "%8.6f," %( x ), + +print +print "const float slsB[] ={", +for x in b: + #x = x * 255 ) + if( x == 0 ): + print "0,", + elif( x == 1.0 ): + print "1,", + else: + print "%8.6f," %( x ), + +print + -- 2.32.0.93.g670b81a890