;+ ; ; NAME: ; HXISLIFE ; ; PURPOSE: ; Calculate the lifetime function ; ; CATEGORY: ; HXIS display ; ; CALLING SEQUENCE: ; HXISLIFE ; ; CALLED BY: ; HXISWIDGET ; ; CALLS TO: ; UTPLOT, RESPOND_WIDG, HXISGETWINDOW, HXISHARD ; ; INPUTS: ; none explicit, only through commons ; ; OPTIONAL INPUTS: ; none ; ; OUTPUTS: ; none explicit, only through commons ; ; OPTIONAL OUTPUTS: ; none ; ; COMMON BLOCKS: ; hxisasread.common ; hxiscolor.common ; hxisdata_info.common ; hxislife_fnc.common ; hxistime.common ; hxiswidget.common ; hxiswindow.common ; ; SIDE EFFECTS: ; If info.hard is set the plot is printed ; ; RESTRICTIONS: ; none ; ; PROCEDURE: ; Plot the flare mode, prompt user for two cursor clicks to form ; a line. Other routines use the following equation to apply the ; lifetime function: LIFEFNC(SI)/( LF1+RC*(TIMG(SI)-T1)) ; where SI are the images selected and LF1,RC and ; T1 are determined in the routine. ; ; MODIFICATION HISTORY: ; OCT-1990, Paul Hick (ARC) ; DEC-1992, Elaine Einfalt (HSTX) - converted to widgets ;- pro hxislife @hxisasread.common @hxiscolor.common @hxisdata_info.common @hxislife_fnc.common @hxistime.common @hxiswidget.common @hxiswindow.common colors = my_colors ; ; When doing hard copy to grayscale printer lines should be in black ; if info.hard and not(info.colo) then colors = colors * 0 FMODE = where(FLR_MOD ne 0, FIMG) ; Flare mode 1 or 2 if FIMG eq 0 then begin widget_control, comment, set_value='Only normal mode images', /append return endif info.cplot_up = 0 ; about to erase current window if not(info.hard) then hxisgetwindow $ else hxishard, /fileopen, colo=info.colo if not(info.hard) then csize = 1.7 else csize=1 ; ; Plot the lifetime function ; utplot, timg(fmode)*3600., dfm(fmode), atime((364+info.doy)*86400.), $ xmargin=[10,19+(5*info.hard)], /yohkoh, $ charsize=CSIZE, $ xcharsize=1., $ ycharsize=1., $ title='HXIS Flare Mode 1 and 2',$ ytitle="LIFETIME FNC" , $ xtitle='Universal Time (DOY ' + strtrim(info.doy,2) + ')', $ ytype=info.scal, $ /nolabel if not(info.hard) then begin result = respond_widg(message=['Select the smoothing value ', $ 'for the live time function '], $ buttons= ['0 seconds','5 seconds',$ '10 seconds','30 seconds', $ '1 minute','5 minutes', $ '10 minutes','30 minutes'], $ /column) factor = [0., 5., 10., 30., 60., 300., 600., 1800.] ; in seconds tsmooth = factor(result) ; user's choice oldts = tsmooth ; remember for hardcopy endif else tsmooth = oldts ; ; So get a smoothed the lifetime function ; LIFEFNC = replicate(-1.,info.nimg) for I=0,FIMG-1 do begin a = where( abs(timg(fmode(i))-timg(fmode)) le tsmooth/7200.,b) LIFEFNC(FMODE(I)) = total(dfm(fmode(a)))/b endfor ; ; Over plot the smoothed livetime function ; oplot, TIMG(FMODE)*3600., LIFEFNC(FMODE), thick=2, color=colors(7) if not(info.hard) then begin lifefnc(fmode) = lifefnc(fmode) > 0 if min(lifefnc(fmode))/max(lifefnc(fmode)) lt .75 then $ widget_control, comment, set_value='Lifetime drops ' + $ 'below 75%.', /append endif ; ; Prompt for first and second achor point for 100% live time level ; if not(info.hard) then begin widget_control, comment, set_value='Use mouse click ' + $ 'to select first anchor point.', /append wshow, current_window ; ; Get 1st cursor location ; XSC = !X.S cursor, time, a, /up, /normal time = ((time-xsc(0))/xsc(1)) ; in seconds time1 = time/3600. ; in units of doy ; oplot, [time1,time1], crange('Y') a1 = abs(timg(fmode)-time1) a1 = min(a1, nimg) m1 = fmode(nimg) ; find valid image closest to click oplot, [time,time], [lifefnc(m1),lifefnc(m1)], psym=2, color=colors(1) widget_control, comment, set_value='Thank you. Use mouse click ' + $ 'to select second anchor point.', /append ; ; Get 1st cursor location ; cursor, time, a, /up, /normal widget_control, comment, set_value='Thank you. ', /append time = ((time-xsc(0))/xsc(1)) ; in seconds time2 = time/3600. ; in units of doy ; oplot, [time2,time2], crange('Y') widget_control, comment, set_value='Thank you for your second ' + $ 'anchor point.', /append a2 = abs(timg(fmode)-time2) a2 = min(a2, nimg) m2 = fmode(nimg) ; find valid image closest to click oplot, [time,time], [lifefnc(m2),lifefnc(m2)], psym=2, color=colors(1) ; Nearest flare mode 1-2 images if m1 gt m2 then begin a = m1 & m1 = m2 & m2 = a & endif a = min(abs(m1-fmode), n1) & a = min(abs(m2-fmode), n2) n1 = fmode(n1) & n2 = fmode(n2) T1 = timg(n1) & t2 = timg(n2) ; time of image closest to click LF1 = lifefnc(n1) & lf2 = lifefnc(n2) if n1 ne n2 then RC = (LF2-LF1)/(T2-T1) else RC = 0 endif ; ; Write out applicable program parameter(s) ; left = 0.80 ; where the legend is positioned A = .50 & B = 0.03 xyouts, LEFT,A,/normal,'Start time : ', size=CSIZE A = A-B xyouts, LEFT,A,/normal, usestart, size=CSIZE A = A-1.5*B xyouts, LEFT,A,/normal,'Stop time : ', size=CSIZE A = A-B xyouts, LEFT,A,/normal, useend, size=CSIZE A = A-1.5*B xyouts, LEFT, A, /normal,'Average : ', size=CSIZE A = A-B xyouts, LEFT, A, /normal, strtrim(string(format='(F10.1)',oldts),1) + $ ' sec', size=CSIZE ; ; Plot the line through the two anchor points. ; This is the dead time correction used in other routines ; plots, [timg(info.bot_img),timg(info.top_img)]*3600., $ LF1+RC*([timg(info.bot_img),timg(info.top_img)]-T1), $ color=colors(1) ; ; Plot complete, close and print. ; if info.hard then hxishard, /fileclose, colo=info.colo info.life = 1 !y.type = 0 ; in case a used /YTYPE above return end