; NAME: ; WRT_DISP_PHA.PRO ; ; PURPOSE: ; DISPLAY IN REAL TIME : ; ACCUMULATIVE COUNTER FOR X-PULSE-HEIGHTS and ; ACCUMULATIVE COUNTER FOR Y-PULSE-HEIGHTS ; ; ; CATEGORY: ; Widgets. ; ; CALLING SEQUENCE: ; ; WRT_DISP_PHA, main_base ; ; INPUTS: ; main_base : name of the main base including phbase ; ; OUTPUTS: ; Display two curves in two widget draw; ; print the display on a postcript printer associated to the ; logical POSTPRINTER ; ; COMMON BLOCKS: ; COMMON wrt_widget_com ; ; RESTRICTIONS: ; The user must start the display by cliking on the START BUTTON ; Then the data are refreshed at interval of 10 seconds ; ; PROCEDURES in this file : ; - print_pha prints the curves on PS printer postprinter ; - plot_pha plots the 2 curves ; - wrt_disp_pha_event manages processing associated to events ; - wrt_disp_pha main procedure : defines the widgets ; MODIFICATION HISTORY: ; Written by: Jacqueline PLATZER May 95 ; June 1995, Integration in WRT_IMAGE ; January 1996 New version ;- pro print_pha ;============================================================================== print,'********** PRINT_PHA *********** ;============================================================================== SET_PLOT,'PS' device,filename='output.ps' cs=1. !P.MULTI = [0,1,2] buf=lonarr(256) bufm1=lonarr(200) xbuf = intarr(200) for i = 0 , 199 do xbuf(i) = i pha_title =' SUMER ' + systime(0) st_pha_read = call_external('img_rdif', $ 'pha_read', $ buf , $ 0 , $ default='RTG:.exe') for i=0,199 do bufm1(i)=buf(i+1) phamax=max(bufm1) print,phamax if phamax ne 0 then $ plot, xbuf , $ bufm1 , $ xmargin = [5,3] , $ xticklen = 0.1 , $ ymargin = [4,3] , $ yticks = 2 , $ PSYM = 10 , $ YSTYLE = 1 , $ TITLE = pha_title , $ XTITLE='Accumulative counter for X-pulse-heights' $ else plot, xbuf , $ bufm1 , $ xmargin=[5,0.5] , $ xticklen =0.1 , $ ymargin=[1.5,0.2] , $ yticks=2 , $ XTITLE='Accumulative counter for X-pulse-heights' st_pha_read = call_external('img_rdif', $ 'pha_read', $ buf , $ 1 , $ default='RTG:.exe') for i=0,199 do bufm1(i)=buf(i+1) phamax=max(bufm1) if phamax ne 0 then $ plot, xbuf , $ bufm1 , $ xmargin=[5,3] , $ xticklen =0.1 , $ ymargin=[4,3] , $ yticks=2 , $ PSYM=10 , $ YSTYLE=1 , $ XTITLE='Accumulative counter for Y-pulse-heights' $ else plot, xbuf , $ bufm1 , $ xmargin=[5,0.5] , $ xticklen =0.1 , $ ymargin=[1.5,0.2] , $ yticks=2 , $ XTITLE='Accumulative counter for Y-pulse-heights' ; xyouts,.05,.97,' SUMER ' + systime(0),charsize=1.5, /normal device,/close cmd='print /que=postprinter/del output.ps' spawn,cmd set_plot,'X' end pro plot_pha ;============================================================================== ; plot_pha plot the both curves ;============================================================================== print,'********** plot_pha **********' COMMON wrt_widget_com buf = lonarr(256) bufm1 = lonarr(200) xbuf = intarr(200) for i = 0 , 199 do xbuf(i) = i !p.multi = 0 st_pha_read = call_external('img_rdif' , $ 'pha_read' , $ buf , $ 0 , $ default='RTG:.exe' ) for i=0,199 do bufm1(i)=buf(i+1) WSET,draw_x_id phamax=max(bufm1) if phamax ne 0 then PLOT,xbuf ,$ bufm1 ,$ xmargin =[5,0.5] ,$ xticklen =0.1 ,$ ymargin =[1.5,0.2] ,$ yticks =2 ,$ psym = 10 ,$ ystyle = 1 ,$ background =230 ,$ color=0 $ else PLOT,xbuf ,$ bufm1 ,$ xmargin=[5,0.5] ,$ xticklen =0.1 ,$ ymargin=[1.5,0.2] ,$ yticks=2 ,$ background=230 ,$ color=0 st_pha_read = call_external('img_rdif', $ 'pha_read', $ buf , $ 1 , $ default='RTG:.exe') for i=0,199 do bufm1(i)=buf(i+1) WSET,draw_y_id phamax=max(bufm1) if phamax ne 0 then PLOT,xbuf ,$ bufm1 ,$ xmargin=[5,0.5] ,$ xticklen =0.1 ,$ ymargin=[1.5,0.2] ,$ yticks=2 ,$ psym =10 ,$ ystyle =1 ,$ background=230 ,$ color=0 $ else plot,xbuf ,$ bufm1 ,$ xmargin=[5,0.5] ,$ xticklen =0.1 ,$ ymargin=[1.5,0.2] ,$ yticks=2 ,$ background=230 ,$ color=0 end PRO wrt_disp_pha_event,ev ;============================================================================== ; wrt_disp_pha_event ; '0' reset ; '2' start this event initialize the timer ;============================================================================== COMMON wrt_widget_com WIDGET_CONTROL, ev.Id,GET_UVALUE=type CASE type OF 0 : BEGIN print,'reset ' st_pha_reset = call_external('img_rdif', $ 'pha_reset', $ default='RTG:.exe') END 2: BEGIN plot_pha WIDGET_CONTROL, ev.id,TIMER=10 END 4: BEGIN print_pha END ENDCASE END PRO wrt_disp_pha, main_base, GROUP=Group ;============================================================================= ;=== PROCEDURE WRT_DISP_PHA ;============================================================================= COMMON wrt_widget_com IF N_ELEMENTS(Group) EQ 0 THEN GROUP=0 junk = { CW_PDMENU_S, flags:0, name:'' } PHBASE = WIDGET_BASE(main_base, GROUP_LEADER=Group , $ /row , $ MAP=1 , $ TITLE='PULSE HEIGHT ANALYSER' , $ UVALUE=1 , $ XOFFSET=10 , $ YOFFSET=10 , $ FRAME = 3 ) BASE_X = WIDGET_BASE(phbase, $ COLUMN=1) DRAW_X = WIDGET_DRAW( BASE_X , $ RETAIN=2 , $ UVALUE='DRAW_X' , $ XSIZE=300 , $ YSIZE=90 ) LABEL_X = WIDGET_LABEL( BASE_X, $ FONT='-adobe-itc avant garde gothic-book-r-normal--10-100-75-75-p-59-iso8859-1', $ UVALUE='LABEL_X' , $ VALUE='Accumulative counter for X-pulse-heights' , $ XSIZE=300 , $ YSIZE=18) BASE_Y = WIDGET_BASE(phbase, $ COLUMN=1 ) DRAW_Y = WIDGET_DRAW( BASE_Y , $ RETAIN=2 , $ UVALUE='DRAW_Y' , $ XSIZE=300 , $ YSIZE=90 ) LABEL_Y = WIDGET_LABEL( BASE_Y, $ FONT='-adobe-itc avant garde gothic-book-r-normal--10-100-75-75-p-59-iso8859-1', $ UVALUE='LABEL_Y' , $ VALUE='Accumulative counter for Y-pulse-heights' , $ XSIZE=300 , $ YSIZE=18) BUTTON2 = WIDGET_BUTTON( phbase , $ UVALUE=2 , $ VALUE='START' ) BUTTON1 = WIDGET_BUTTON( phbase , $ UVALUE=0 , $ VALUE='RESET' ) BUTTON3 = WIDGET_BUTTON( phbase , $ UVALUE=4 , $ VALUE='PRINT' ) XMANAGER, 'WRT_DISP_PHA', phbase END