;+
; NAME:
;     FILT4_SIM
; PURPOSE:
;     Scale an AlMg image to simulate exposures in three other filters.
; CATEGORY:
;     Yohkoh
; CALLING SEQUENCE:
; INPUTS:
;      IMG_INDEX, IMG_DATA, the index and image to use as a base for scaling.
;      The image should be AlMg; for best results pick a well-exposed one with
;      no saturation.
;
;      Program asks for DPE as input. 
;
; OPTIONAL (KEYWORD) INPUT PARAMETERS:
; OUTPUTS:
; COMMON BLOCKS:
; SIDE EFFECTS:  Calls BLEEDER, to simulate saturation from over-exposed images.
;		 Also loads STERN SPECIAL color table.
; RESTRICTIONS:
; MODIFICATION HISTORY:
;     29-may-98, DMcK, written in ad-hoc form
;     02-jun-98, DMcK, put in call to GT_DPE to convert DPE to exptim 
;     05-jun-98, DMcK, adjusted Al12 and Be119 scalings -- were too bright
;-
pro filt4_sim,img_index,img_data 

; I'll assume you're starting with an AlMg image, and that it has 
;  no huge saturation blossoms.

base_exp=gt_expdur(img_index)
baseimg=(float(sxt_decomp(img_data)))/base_exp
xs=n_elements(img_data(*,0))
ys=n_elements(img_data(0,*))

input, '  Pick a DPE value for the simulated exposures:', dpe_in
; dpe=dpe2exptim(dpe_in)
dpe=gt_dpe(dpe_in,/conv)

bleeder,baseimg*dpe,shortdag
; shortdag=baseimg*dpe
bleeder,baseimg*dpe*2.,shortthin
; shortthin=shortdag*2.
bleeder,baseimg*dpe/16.,shortthick
; shortthick=shortdag/16.
bleeder,baseimg*dpe/40.,shortbe
; shortbe=shortdag/40.
wtitle=string('Simulated Images, DPE =',strtrim(fix(dpe_in),1))
; wdef,20,4*xs,ys,title=wtitle
; window,/free,xsize=4*xs,ysize=ys,title=wtitle
 window,/free,xsize=4*xs,ysize=ys


loadct,15
tv,bytscl(shortthin,max=4095.)
xyouts,xs/10,ys/10,'Thin Alum',/dev
tv,bytscl(shortdag,max=4095.),xs,0
xyouts,(xs+xs/10),ys/10,'AlMg',/dev
tv,bytscl(shortthick,max=4095.),2*xs,0
xyouts,(2*xs+xs/10),ys/10,'Thick Alum',/dev
tv,bytscl(shortbe,max=4095.),3*xs,0 
xyouts,(3*xs+xs/10),ys/10,'Be119',/dev

end
 

