PRO cut_col_tab
ncol=(!D.N_COLORS<256)-1
red =INTARR(ncol)
green=INTARR(ncol)
blue =INTARR(ncol)
colour_table=INTARR(4,256)
stack = SCOPE_TRACEBACK(/structure)
filename = stack[SCOPE_LEVEL()-1].filename
dir = FILE_DIRNAME(filename)
fname_cut_coltbl = dir+'/col_tbl/cut_col_tab.dat'
OPENR,colorfile,fname_cut_coltbl,/GET_LUN
READF,colorfile,colour_table
FREE_LUN,colorfile
colour_stretch=INTARR(4,256)
scale_start=65
scale_end=240
skip=(scale_end-scale_start)/256.0
FOR col=0,255 DO BEGIN
colour_stretch(*,col)=colour_table(*,FIX(scale_start+skip*col))
ENDFOR
colour_table=colour_stretch
indx=1.0
skip=255.0/(ncol-1)
FOR col=1,ncol-1 DO BEGIN
red(col) =colour_table(1,FIX(indx))
green(col)=colour_table(3,FIX(indx))
blue(col) =colour_table(2,FIX(indx))
indx=indx+skip
ENDFOR
red_swap =red
blue_swap =blue
green_swap=green
FOR col=1,ncol-1 DO BEGIN
red(ncol-col) =red_swap(col)
blue(ncol-col) =blue_swap(col)
green(ncol-col)=green_swap(col)
ENDFOR
IF !D.NAME NE 'NULL' AND !d.name NE 'HP'THEN BEGIN
TVLCT,red,green,blue
ENDIF
END
PRO cut_col_tab2, bottom_c
if n_params() ne 1 then bottom_c = 7
cut_col_tab
tvlct, r, g, b, /get
top_c = !d.table_size-2
negative_top = bottom_c + fix(ceil((top_c - bottom_c)/2.)) -1
positive_bottom = negative_top + 1
red =INTARR(top_c+2)
green=INTARR(top_c+2)
blue =INTARR(top_c+2)
bot = 1 & top = 110
neg_r = reverse(r[bot:top])
neg_g = reverse(g[bot:top])
neg_b = reverse(b[bot:top])
for i=0, negative_top-bottom_c do begin
idx = fix( float(top-bot) * i / (negative_top-bottom_c) )
red[i+bottom_c] = neg_r[idx]
green[i+bottom_c]=neg_g[idx]
blue[i+bottom_c] =neg_b[idx]
endfor
bot = 160 & top = 225
pos_r = reverse(r[bot:top])
pos_g = reverse(g[bot:top])
pos_b = reverse(b[bot:top])
for i=0, top_c-positive_bottom do begin
idx = fix( float(top-bot) * i / (top_c-positive_bottom) )
red[i+positive_bottom] = pos_r[idx]
green[i+positive_bottom]=pos_g[idx]
blue[i+positive_bottom] =pos_b[idx]
endfor
IF !D.NAME NE 'NULL' AND !d.name NE 'HP'THEN BEGIN
TVLCT,red,green,blue
ENDIF
END
PRO loadct_sd,ct,invert=invert,reverse=revrse,file=file,previous_ct=previous_ct
COMMON colors, r_orig, g_orig, b_orig, r_curr, g_curr, b_curr
@colors_com
deffile = GETENV('IDL_CT_FILE')
IF NOT KEYWORD_SET(deffile) THEN BEGIN
stack = SCOPE_TRACEBACK(/structure)
filename = stack[SCOPE_LEVEL()-1].filename
dir = FILE_DIRNAME(filename)
deffile = FILE_SEARCH(dir+'/col_tbl/'+'colors*.tbl',count=nf)
IF nf GT 0 THEN deffile=deffile[nf-1]
ENDIF
IF NOT KEYWORD_SET(file) AND KEYWORD_SET(deffile) THEN file=deffile
black = 0
magenta=1
blue = 2
cyan = 3
green = 4
grey = 5
red = 6
bottom_c = 7
IF ~KEYWORD_SET(ct) THEN ct = 43
if ct lt 0 or ct gt 45 then begin
print, 'The number of currently available color tables are 0-45.'
print, 'Please specify a table number of the above range.'
return
endif
IF N_ELEMENTS(color_table) EQ 0 THEN color_table=ct
previous_ct = color_table
IF !d.name EQ 'NULL' OR !d.name EQ 'HP' THEN BEGIN
dprint,'Device ',!d.name,' does not support color tables. Command Ignored'
RETURN
ENDIF
IF ct LT 43 THEN BEGIN
loadct,ct,bottom=bottom_c,file=file
ENDIF ELSE IF ct EQ 43 THEN BEGIN
loadct,ct,bottom=bottom_c,file=file,/silent
PRINT, '% Loading table SD-Special'
ENDIF ELSE IF ct EQ 44 THEN BEGIN
cut_col_tab
print, '% Loading table Cutlass color bar for SD'
ENDIF ELSE IF ct EQ 45 THEN BEGIN
cut_col_tab2, bottom_c
print, '% Loading the color bar similar to the default in JHU/APL SD site'
ENDIF
color_table = ct
top_c = !d.table_size-2
white =top_c+1
cols = [black,magenta,blue,cyan,green,grey,red,white]
primary = cols[1:6]
TVLCT,r,g,b,/get
IF KEYWORD_SET(revrse) THEN BEGIN
r[bottom_c:top_c] = reverse(r[bottom_c:top_c])
g[bottom_c:top_c] = reverse(g[bottom_c:top_c])
b[bottom_c:top_c] = reverse(b[bottom_c:top_c])
ENDIF
r[cols] = BYTE([0,1,0,0,0,0.553,1,1]*255)
g[cols] = BYTE([0,0,0,1,1,0.553,0,1]*255)
b[cols] = BYTE([0,1,1,1,0,0.553,0,1]*255)
TVLCT,r,g,b
r_curr = r
g_curr = g
b_curr = b
END