; EPHIPLOT.PRO ;=========================================================================== ; ;--------------------------Program Version Number------------------------- ; common version ,vers ; vers='V4.02, Feb-2000' !!!!! to be updated in Pro L2labcom ;--------------------------Program Version Number------------------------- ; ; vers V3.03, Dec-1997: new subroutine: FINDPATHL2.PRO set input and output paths ; vers V3.04, Jan-1998: write_gif button in plot_menu subroutine ! ; vers V4.01, Oct-1998: adapted to Windows 95 IDL ; vers V4.02, Feb-2000: adapted to both PseudoColor and TrueColor displays, ; year 2000 update, minor debugging ; vers V4.03, May-2003: findfile does not return filenames in L2_nam in alphabetical ; sequence when reading from fileserver Asterix. IDL SORT inserted. ;=========================================================================== ; The Program is coded to plot EPHIN Level-2 Data, generated by ; University of Kiel, Extraterrestrial Physics Group ; Coded by Holger Boll, boll@astrophysik.uni-kiel.de ; Adapted by Reinhold Müller-Mellin, mueller-mellin@physik.uni-kiel.de ;=========================================================================== ; This is a "library file" of the IDL program >EPHIPLOT<. All procedures, ; needed to run it, should be included in this file. ; To run >EPHIPLOT< compile first the whole file by typing ; ; IDL> .compile EPHIPLOT ; ; Now, all routines will be translated in one step. ; Then type in: ; IDL> main ; ; and the program will start up. ; ; Note: on PC platforms: in order to place output files (e.g. *.sve, *.ps) in your working directory: ; 1. before executing EPHIPLOT, clear the field 'Working Directory' in IDL Menu ; 'File', 'Preferences', 'Startup' ; 2. after starting EPHIPLOT, do not specify output path in window 'File Path Selection' ; ; Note: When entering path information, use ony 8 characters per (sub)directory. If actual directory ; names are longer, truncate to 6 characters and append "~1" without quotes. ;--------------------------------------------------------------------------- ; see EPHISPEC.DOC and USERGUID.DOC for further details ;--------------------------------------------------------------------------- pro l2labcom ;------------ ;--------------------------Program Version Number------------------------- common version ,vers vers='V4.02, Feb-2000' ;--------------------------Program Version Number------------------------- common l2lab, l2label Intlab=[ 'E150','E300','E1300','E3000' $ ;-- Intensity plot labels 0:3 ,'P4','P8','P25','P41' $ ;-- 4:7 ,'H4','H8','H25','H41','Integral' ] ;-- 8:12 CNTLAB=[ 'P4M','P4R','P4S' $ ;--Counts plot labels 13:15 ,'P8M','P8R','P8S' $ ;-- 16:18 ,'P25M','P25R','P25S' $ ;-- 19:21 ,'P41M','P41R','P41S' $ ;-- 22:24 ,'H4M','H4R','H4S1','H4S2' $ ;-- 25:28 ,'H8M','H8R','H8S1','H4S2' $ ;-- 29:32 ,'H25M','H25R','H25S1','H25S2' $ ;-- 33:36 ,'H41M','H41R','H41S1','H41S2' ] ;-- 37:40 L2label=[intlab,cntlab] ;--total label for cnts and intensities return end ;=========================================================================== ;=========================================================================== pro plotcom ;---------------------------------------------------------------------------- ; plot parameter initialisation ;---------------------------------------------------------------------------- loadct,0,/silent common ncolor,ncol ;-- plot color setting ncol=0 common plotdev, pdev ;-- plot device type pdev=!d.name common plottitle, smtitle $ ; selfmade title , sxtitle $ ; selfmade xtitle , sytitle ; selfmade ytitle smtitle='' sxtitle='' sytitle='' common plotpar, pflag $ ; pflag 0=no period set 1=period set , yrmmdm $ ; string start date: year, month , noday $ ; number of days to plot , avgm ; averageing interval in minutes common korfac, kfacs ;--corection factor selection kfacs=0 ;..0=no corr, 1=tot, ;..2=grader Einfall 3=grader Einfall common filepath $ ;-- init in Log_set , inpath $ ;-- input science file directory , outpath ;-- output PostScript file directory pflag=0 ; plottime setting flag, (no flag, no plot) yrmmdm='19951207' noday=1l avgm=15 !x.style=1 !x.ticks=8 ;-----y-axe parameter: y range setting ;----------------------------------------------------------------------------- common ypar, yran,yrplt,rin ;--yrangedefault, in plot used yran, ;.. index to yran yrplt=fltarr(2) yrplt(*)=0 rin=0 ;-- pntr to yran(*,*,0) (default) or yran(*,*,1) (selfmade) ;-- use idl automatic scaling yran=fltarr(2,41,3) yran(*,0:40,0)= [ $ 1.e-2, 100., 1.e-4,1., 1.e-4,1., 1.e-4,1. $ ;-- 'E150','E300','E1300','E3000' ,1.e-4, 1., 1.e-4,1., 1.e-4,1., 1.e-4,1. $ ;-- 'P4','P8','P25','P41' ,1.e-5, 0.1, 1.e-5,0.1, 1.e-5,0.1, 1.e-5,0.1 $ ;-- 'H4','H8','H25','H41' ,1.e-2, 10. $ ;-- 'Integral' ,1.e-5, 1., 1.e-5,1., 1.e-5,1. $ ;-- 'P4M','P4R','P4S' ,1.e-5, 1., 1.e-5,1., 1.e-5,1. $ ;-- 'P8M','P8R','P8S' ,1.e-5, 1., 1.e-5,1., 1.e-5,1. $ ;-- 'P25M','P25R','P25S' ,1.e-5, 1., 1.e-5,1., 1.e-5,1. $ ;-- 'P41M','P41R','P41S' ,1.e-5, 1., 1.e-5,1., 1.e-5,1., 1.e-5,1. $ ;-- 'H4M','H4R','H4S1','H4S2' ,1.e-5, 1., 1.e-5,1., 1.e-5,1., 1.e-5,1. $ ;-- 'H8M','H8R','H8S1','H4S2' ,1.e-5, 1., 1.e-5,1., 1.e-5,1., 1.e-5,1. $ ;- 'H25M','H25R','H25S1','H25S2' ,1.e-5, 1., 1.e-5,1., 1.e-5,1., 1.e-5,1. ] ;- 'H41M','H41R','H41S1','H41S2' yran(*,*,1)=yran(*,*,0) ;-- init selfmade y-ranges x=findfile('YRANL2.SVE',count=cnt) if(cnt gt 0)then x=findfile('yranl2.sve',count=cnt) if(cnt gt 0)then begin restore,x(0) ;-- if a selfmade yrange file exists: load it yran(*,*,1)=yrange endif yran(*,*,2)=0 ;- IDL automatic yrange return end ;=========================================================================== ;=========================================================================== pro readl2com ;---------------------------------------------------------------------- common readpar $ ;-- all file info ,in_file $ ;-- L2 input-file-array ,fptr $ ;-- index pointer to in_file ,eof $ ;-- end of file flag ,ostat $ ;-- open status flag ,fpos ;-- position in input-file in bytes in_file='' ;-- all file info fptr=0 ;-- index pointer to in_file eof=-1 ;-- end of file flag ostat=-1 ;-- open status flag fpos=0 ;-- position in input-file in bytes return end ;=========================================================================== ;=========================================================================== pro syscom ;---------------------------------------------------------------------------- ; ;-- save sysvars for later resettings --; ; ;---------------------------------------------------------------------------- common syspar , resetp $ , resetd $ , resetx $ , resety resetp=!P resetd=!D resetx=!X resety=!Y return end ;=========================================================================== ;=========================================================================== pro xpscom ; Var definitions of general interest ;---------------------------------------------------------------------------- common psfile $ ,psfina $ ;-- postscript filename ,psopen $ ;-- flags open / not open status of PS file ,psopenlab $ ;-- label for psopenflag ,xps $ ;-- flags if output to ps file is desired ,xpslab $ ;-- label for xps ,Xmulti $ ;-- save !p.multi for X-window ,PSmulti ;-- save !p.multi for PS file xmulti=!p.multi PSmulti=!p.multi psfina='none' ; postscript file name xps=0 ; plot output to ps file =1/x-window=0 xpslab=['X-Window','Post-Script-File'] psopen=0 ; ps file open/ not open flag psopenlab=['not open','open'] common cntplot, cntX,cntPS ; plot counter for x-win & ps-file cntPS=0 ; count # plot in ps file cntX=0 ; count no plots in X window common panptr, ptrx,ptrps ; Panel pointer (saves !p.multi) ptrx=intarr(8) & ptrx(*) =0 ; .. in case of oplots ptrps=intarr(8) & ptrps(*)=0 common pmulti, px, py ;-- save !p.multi settings from px=0 ;.. set_plotwin.pro py=0 common pform $ ;-- plot paper config ,DinA $ ;-- Papersize 1=DinA-4, 2=DinA-3, 3=Us ,Pfmt ;-- protrait / landscape DinA=1 Pfmt=1 common printdev,devices,pdevice ; print device selection, selected device devices=['PS86 ','PSHP ','PS '] pdevice='PS86 ' return end ;=========================================================================== ;=========================================================================== function epoch_print,epoch ;---------------------------------------------------------------------- ; character function gives back a formatted string of time ; yyyy-mon-mod hh:mm:ss ;---------------------------------------------------------------------- cdf_epoch,epoch,yy,mo,dd,hh,mi,ss,/breakdown_epoch ctime=strtrim(string(yy,format='(I4)'),2)+'-' $ ; year +strtrim(string(mo,format='(I2.2)'),2)+'-' $ ; month +strtrim(string(dd,format='(I2.2)'),2)+' ' $ ; day of month +strtrim(string(hh,format='(I2.2)'),2)+':' $ ; hour +strtrim(string(mi,format='(I2.2)'),2)+':' $ ; minute +strtrim(string(ss,format='(I2.2)'),2) ; second RETURN,CTIME END ;=========================================================================== function ep_to_int,epoch ;------------------------------------------------------ ; compress EPOCH real*8 to int4, ms will be lost ;------------------------------------------------------ ep_ref=62900000000000.d iepoch=long( (epoch - 62900000000000.d)/1000.) return,iepoch end ;=========================================================================== ;=========================================================================== function int_to_ep,iepoch ;---------------------------------------------------------------------- ; decompress int*4 iepoch to real*8 ;---------------------------------------------------------------------- ep_ref=62900000000000.d epoch=(iepoch*1000.d)+ep_ref return,epoch end ;=========================================================================== ;=========================================================================== function date_to_doy,year,month,dom ;---------------------------------------------------------------------- ; conversion from year, month, day of month to day of year (doy) ;---------------------------------------------------------------------- monthday=[31,28,31,30,31,30,31,31,30,31,30,31] if ( (year mod 4) eq 0)then monthday(1)=29 if(month eq 1)then begin doy=dom endif else begin doy=total(monthday(0:month-2))+dom endelse return,fix(doy) end ;=========================================================================== ;=========================================================================== function doy_to_date,year,doy ;---------------------------------------------------------------------- ; conversion day of year to month and day of month ; input: year for digits [yyyy] ; doy day of year [doy] ; output int array(2): month,day of month ;---------------------------------------------------------------------- ;------------! eval # month and day of month !------------------------ monthday=[31,28,31,30,31,30,31,31,30,31,30,31,10] if ( (year mod 4) eq 0)then monthday(1)=29 ;! SCHALTJAHR leap isum=0 i=-1 if(doy le 31)then begin ; January dom=doy month=1 endif else begin while(isum lt doy )do begin i=i+1 isum=isum+monthday(i) ;! SUM UP DAYS if ( isum ge doy)then begin dom=doy-total(monthday(0:i-1)) month=i+1 endif endwhile endelse ;------------! eval # month and day of month !------------------------ if(month ge 13 )then begin month=-1 dom=-1 endif return,[fix(month),fix(dom)] end ;=========================================================================== ;=========================================================================== pro datedefault common plotpar, pflag $ ; pflag 0=no period set 1=period set , yrmmdm $ ; string start date: year, month , noday $ ; number of days to plot , avgm ; averageing interval in minutes common filepath $ ;-- init in Log_set , inpath $ ;-- input science file directory , outpath ;-- output PostScript file directory x=findfile(strcompress(inpath, /remove_all)+'EP*.RL2',count=cnt) if(cnt le 0)then x=findfile(strcompress(inpath, /remove_all)+'ep*.rl2',count=cnt) if(cnt gt 0)then begin npos=strpos(strupcase(x(0)),'.RL2')-5 if strupcase(strmid(x(0),npos-3,3)) eq 'EPH' then $ yr='19'+strmid(x(0),npos,2) else yr='20'+strmid(x(0),npos,2) doy=strmid(x(0),npos+2,3) dat=doy_to_date(yr,doy) yrmmdm=string(yr,format='(I4.4)')+string(dat,format='(2i2.2)') endif else begin wx=widget_message([' There is something wrong ' $ ,' with the Input-File Path ' $ ,' I could not find one file ' $ ,' I advise to set a new path ']) endelse x='' return end ;=========================================================================== ;=========================================================================== pro save_dat,pl_tim,pl_dat ;-------------------------------------------------------------------- ; write selected data into a file ;-------------------------------------------------------------------- common dataformat, dset x=size(dset) if(x(1) eq 0)then dset=[1,1,0,0] ;-- init start config mset=dset ;-- save start config wb=widget_base(/column,title='Save Data in ASCII') wlb=widget_label(wb,xsize=150,ysize=30,/frame $ ,value='Select Time Tag(s)') cw=cw_bgroup(wb $ ,['1997-05-21:12:48' $ ,'EPOCH (ms since year 0)' $ ,'PB5 (yyyy doy ms)' $ ,'Std (since plot start)'] $ ,/nonexclusive,/column $ ,/return_index $ ,set_value=dset ) wbt1=widget_button(wb,value='ok') wbt2=widget_button(wb,value='cancel') widget_control,wb,/realize form='(x' loop=0 while( loop eq 0)do begin ev=widget_event(wb) widget_control,cw,get_value=dset if(ev.id eq cw) then form='(x' if(dset(0) eq 1)then form=form+',A19,x' else form=form+',a,x' if(dset(1) eq 1)then form=form+',D15.0,x' else form=form+',a,x' if(dset(2) eq 1)then form=form+',I4,x,I3,x,I8,x' else form=form+',a,x' if(dset(3) eq 1)then form=form+',f15.2,x' else form=form+',a,x' if(ev.id eq wbt1)then begin ;-- ok loop=2 widget_control,get_value=dset widget_control,wb,/destroy endif if(ev.id eq wbt2)then begin ;-- cancel loop=2 dset=mset widget_control,wb,/destroy endif endwhile ;pl_dat=indgen(6)*200 ;pl_tim=[104089664,104099664,104109664,104119664,104129664,104139664] vs=size(pl_dat) form=form+','+ strtrim(vs(2),2) +'(E15.5,x))' openw,13,'l2plot.dat' ep=int_to_ep(pl_tim(0)) cdf_epoch,ep,ryr,rmo,md,rhh,rmm,rss,/breakdown_epoch jd=julday(rmo,md,ryr) for i=0,vs(1)-1 do begin ep=int_to_ep(pl_tim(i)) eps=int_to_ep(pl_tim(i)) if(dset(0) eq 1)then begin ;--datum dt=epoch_print(eps) endif else dt=' ' if(dset(2) eq 1)then begin ;--pb5 pb5=ep_to_pb5(eps) ;warning: ep_to_pb5 undefined !!!! do not use this option! endif else pb5=' ' if(dset(3) eq 1)then begin ;--std seit plot start cdf_epoch,eps,yr,mo,md,hh,mm,ss,/breakdown_epoch jda=julday(mo,md,yr) std=float(jda-jd)*24.+ float(hh) +float(mm)/60.+float(ss)/3600. endif else std=' ' if(dset(1) eq 1)then begin ;--epoch endif else ep=' ' if(pl_dat(i,0) gt -1)then begin printf,13,strtrim( $ strcompress( $ string(dt,ep,pb5,std,pl_dat(i,*),format=form) $ ) $ ,2) endif endfor close,13 dms=widget_message('Your data are saved in file: L2PLOT.DAT') return end ;=========================================================================== ;=========================================================================== pro set_yrange ;---------------------------------------------------------------------- ; set y range for single channels ;---------------------------------------------------------------------- common L2lab, L2label common ypar, yran,yrplt,rin ;--yrangedefault, in plot used yran, index to yran wb=widget_base(/row,title='Set your personal Y-axe ranges') wb1=widget_base(wb,/column) wb2=widget_base(wb,/column) wla01=widget_label(wb1,value='select channel',xsize=300,ysize=30) wli=widget_list(wb1,value=L2label,scr_xsize=70,scr_ysize=10*28) wla11=widget_label(wb2,value='channel default values ' $ ,xsize=300,ysize=30,/frame) wla12=widget_label(wb2,value='default values ' $ ,xsize=300,ysize=30,/frame) wt11=cw_field(wb2,ysize=1,xsize=26,/float,title='Lower value' $ ,/column ) wt12=cw_field(wb2,ysize=1,xsize=26,/float,title='Upper value' $ ,/column ) wbt=widget_button(wb2,value=' ----Done----') wbc=widget_button(wb2,value=' ----cancel----') widget_control,wb,/realize loop=0 while(loop eq 0) do begin x=size(cindx) ev=widget_event(wb) ;-- select channel in list widget if(ev.id eq wli)then begin if(x(1) ne 0)then begin widget_control,wt11,get_value=yranl widget_control,wt12,get_value=yranu if(yranl ne yran(0,cindx,1)) then yran(0,cindx,1)=yranl ;-- save yran low if(yranu ne yran(1,cindx,1)) then yran(1,cindx,1)=yranu ;-- save yran up endif widget_control,wla11,set_value=L2label(ev.index)+': default values' widget_control,wla12,set_value=string(yran(0,ev.index,0))+' - ' $ +string(yran(1,ev.index,0)) cindx=ev.index ;-- save channel index widget_control,wt11,set_value=yran(0,cindx,1) widget_control,wt12,set_value=yran(1,cindx,1) endif if(ev.id eq wbt)then begin ;---done--- button if(x(1) ne 0)then begin widget_control,wt11,get_value=yranl widget_control,wt12,get_value=yranu if(yranl ne yran(0,cindx,1)) then yran(0,cindx,1)=yranl ;-- save yran low if(yranu ne yran(1,cindx,1)) then yran(1,cindx,1)=yranu ;-- save yran up endif widget_control,wb,/destroy loop=2 ;-- end loop yrange=yran(*,*,1) ;-- get selfmade y-range values save,filename='YRANL2.SVE',yrange ;-- save them into file endif if(ev.id eq wbc)then begin ;---cancel--- button widget_control,wb,/destroy loop=2 ;-- end loop endif endwhile return end ;=========================================================================== ;=========================================================================== pro plot_title ;---------------------------------------------------------------------- ; widget procedure to set plot title ;---------------------------------------------------------------------- common plottitle, smtitle $ ; selfmade title , sxtitle $ ; selfmade xtitle , sytitle ; selfmade ytitle ;---------------------------------------------------------------------- wb=widget_base(/column,title='Put-in Panel Plot Title') wtm=widget_text(wb,value=smtitle,xsize=40,ysize=1,/edit) wl1=widget_label(wb,value='Main Plot Title',xsize=150,ysize=15,/frame) wtx=widget_text(wb,value=sxtitle,xsize=40,ysize=1,/edit) wl2=widget_label(wb,value='X-Title',xsize=150,ysize=15,/frame) wty=widget_text(wb,value=sytitle,xsize=40,ysize=1,/edit) wl3=widget_label(wb,value='Y-Title',xsize=150,ysize=15,/frame) wbta=widget_button(wb,value='Reset All') wbtm=widget_button(wb,value='Reset Main Title') wbtx=widget_button(wb,value='Reset X-Title') wbty=widget_button(wb,value='Reset y-Title') wbtexit=widget_button(wb,value='Done') widget_control,wb,/realize loop=0 while(loop eq 0) do begin ev=widget_event(wb) if(ev.id eq wbta)then begin ;-- reset all title smtitle='' sxtitle='' sytitle='' widget_control,wtm,set_value=smtitle widget_control,wtx,set_value=sxtitle widget_control,wty,set_value=sytitle endif if(ev.id eq wbtm)then begin ;-- reset main title smtitle='' widget_control,wtm,set_value=smtitle endif if(ev.id eq wbtx)then begin ;-- reset x title sxtitle='' widget_control,wtx,set_value=sxtitle endif if(ev.id eq wbty)then begin ;-- reset y title sytitle='' widget_control,wty,set_value=sytitle endif if(ev.id eq wbtexit)then begin ;-- end loop loop=1 endif widget_control,wtm,get_value=mt smtitle=mt(0) widget_control,wtx,get_value=xt sxtitle=xt(0) widget_control,wty,get_value=yt sytitle=yt(0) widget_control,wtm,set_value=smtitle widget_control,wtx,set_value=sxtitle widget_control,wty,set_value=sytitle endwhile widget_control,wb,/destroy return end ;=========================================================================== ;=========================================================================== pro findpathl2,new ;---------------------------------------------------------------------- ; looks for a path to restore path information and set default path ; new: there are 2 situtations: 1. new=0: initial call ; 2. new=1: extra call for new path setting ;---------------------------------------------------------------------- common filepath,inpath,outpath in_stat=0 ipath=' ' ;warning: contains space opath=' ' ;warning: contains spce x=findfile('l2path.sve',count=cnt) if(cnt eq 0)then x=findfile('L2PATH.SVE',count=cnt) if(cnt ge 1)then begin restore,x(0) ;--restore dpath variable inpath=ipath(0) outpath=opath(0) endif if(cnt eq 0 and new eq 0)then begin xm=widget_message(['Before the program starts,' $ ,'enter the correct paths' $ ,'for input and output files']) endif if(cnt eq 0 or new eq 1)then begin ;====================================================widget construct======= WB=widget_base(title='SOHO EPHIN File Path Selection',/column) WB1=widget_base(WB,/row) WB01=widget_base(WB1,/column) WB02=widget_base(WB1,/column) ;----input file path wlabi=widget_label(wb01,xsize=200,ysize=20,value='Input File Selection') wlisi=widget_list(wb01,xsize=75,ysize=5,value=ipath) wlabi=widget_label(wb01,xsize=200,ysize=20,value='(Set) Actual Input Path') wtexi=widget_text(wb01,/edit,value=ipath(0)) wclri=widget_button(wb01,value='-----Clear-----') wdeli=widget_button(wb01,value='-Delete from List-') waddi=widget_button(wb01,value='---Add to List---') wseeli=widget_button(wb01,value='-See File List-') ;----output file path wlabo=widget_label(wb02,xsize=200,ysize=20,value='Output File Selection') wliso=widget_list(wb02,xsize=75,ysize=5,value=opath) wlabo=widget_label(wb02,xsize=200,ysize=20,value='(Set) Actual Output Path') wtexo=widget_text(wb02,/edit,value=opath(0)) wclro=widget_button(wb02,value='-----Clear-----') wdelo=widget_button(wb02,value='-Delete from List-') waddo=widget_button(wb02,value='---Add to List---') wseelo=widget_button(wb02,value='-See File List-') wdon=widget_button(wb,value='--Done--') widget_control,wb,/realize ;====================================================widget construct======= loop0=0 while(loop0 eq 0) do begin ;--loop as long input file are not found widget_control,wlisi,set_value=ipath widget_control,wliso,set_value=opath loop=0 while( loop eq 0) do begin ev=widget_event(wb) ;-- input list click ;--input---------------------------------------------------------------------- if(ev.id eq wlisi)then begin widget_control,wtexi,set_value=ipath(ev.index) ;--update actual input endif if(ev.id eq wclri)then begin ;--clear input widget widget_control,wtexi,set_value=' ',/input_focus endif if(ev.id eq wdeli)then begin ;--delete from list (input) widget_control,wtexi,get_value=idel x=where(ipath ne idel(0),cnt) if(cnt ge 1) then ipath=ipath(x) else ipath=' ' widget_control,wlisi,set_value=ipath ;--update list widget_control,wtexi,set_value=' ',/input_focus ;--clear input widget endif if(ev.id eq waddi)then begin ;--update list widget_control,wtexi,get_value=iadd if(iadd(0) ne ' ')then begin x=where(ipath eq iadd(0),cnt) if(cnt eq 0 ) then ipath=[iadd,ipath] widget_control,wlisi,set_value=ipath ;--update list endif endif if(ev.id eq wseeli)then begin ;--File List- (input) widget_control,wtexi,get_value=iadd x=findfile(strcompress(iadd(0), /remove_all)+'*.RL2',count=cnt) if(cnt eq 0)then x=findfile(strcompress(iadd(0), /remove_all)+'*.rl2',count=cnt) if(cnt ge 1)then begin wl=widget_base(/column,title=' Input file list ') wld=widget_list(wl,value=x,scr_xsize=250,scr_ysize=200) done=widget_button(wl,value='---done---') widget_control,wl,/realize loopl=0 while(loopl eq 0)do begin ev=widget_event(wl) if(ev.id eq done)then loopl=1 endwhile widget_control,wl,/destroy endif else begin x=widget_message('No input files found') endelse wl=0 wld=0 done=0 endif ;--output------------------------------------------------------------------ if(ev.id eq wliso)then begin ;-- output list click widget_control,wtexo,set_value=opath(ev.index) ;--update actual output endif if(ev.id eq wclro)then begin ;--clear input widget (output) widget_control,wtexo,set_value=' ',/input_focus endif if(ev.id eq wdelo)then begin ;--delete from list (output) widget_control,wtexo,get_value=odel x=where(opath ne odel(0),cnt) if(cnt ge 1) then opath=opath(x) else opath=' ' widget_control,wliso,set_value=opath ;--update actual output widget_control,wtexo,set_value=' ',/input_focus ;--clear input window endif if(ev.id eq waddo )then begin ;--update list (output) widget_control,wtexo,get_value=oadd if(oadd(0) ne ' ')then begin x=where(opath eq oadd(0),cnt) if(cnt eq 0 ) then opath=[oadd,opath] widget_control,wliso,set_value=opath ;--update list (output) endif endif if(ev.id eq wseelo)then begin ;--File List- (input) widget_control,wtexo,get_value=oadd x=findfile(strcompress(oadd(0), /remove_all)+'*.PS',count=cnt) if(cnt eq 0)then x=findfile(strcompress(oadd(0), /remove_all)+'*.ps',count=cnt) if(cnt ge 1)then begin wl=widget_base(/column,title=' Output File List ') wld=widget_list(wl,value=x,scr_xsize=250,scr_ysize=200) done=widget_button(wl,value='---done---') widget_control,wl,/realize loopl=0 while(loopl eq 0)do begin ev=widget_event(wl) if(ev.id eq done)then loopl=1 endwhile endif else begin x=widget_message('No output files found, try another path') endelse widget_control,wl,/destroy wl=0 wld=0 done=0 endif if(ev.id eq wdon)then begin ;--done button loop=1 ;-----------------------------------------re-organize input path array widget_control,wtexi,get_value=iact inpath=iact(0) if(iact(0) ne ' ')then begin ipath=[iact,ipath] x=where(ipath eq iact(0),cnt) y=where(ipath ne iact(0)) if(cnt gt 1)then ipath=[ipath(0),ipath(y)] endif ;-----------------------------------------re-organize output path array widget_control,wtexo,get_value=oact outpath=oact(0) if(oact(0) ne ' ')then begin opath=[oact,opath] x=where(opath eq oact(0),cnt) y=where(opath ne oact(0)) if(cnt gt 1)then opath=[opath(0),opath(y)] endif ;---------------------------------------------------------------------- endif ;--wdon endwhile loop0=1 ;------------------------------------check actual directory-------- fina=findfile(strcompress(inpath, /remove_all)+'*.RL2*',count=cnt) if(cnt eq 0)then fina=findfile(strcompress(inpath, /remove_all)+'*.rl2*',count=cnt) print, 'Pfadname ', inpath, ' Pfad und Datei ', fina(0) if(fina(0) eq '')then begin txt=['No files found in input directory ' $ ,' Are all logicals defined? ' $ ,' exit IDL? '] ok=widget_message(txt,/question) if(ok eq 'Yes')then exit else loop0=0 endif endwhile widget_control,wb,/destroy save,filename='l2path.sve',ipath,opath endif return end ;=========================================================================== ;=========================================================================== pro open_psfile,psok ;---------------------------------------------------------------------- ; asks for detailed postscript file output desires ;---------------------------------------------------------------------- common plotdev, pdev ;-- plot device type common filepath, inpath, outpath ;--init in log_set common psfile $ ;-- def in PLOTCOM.PRO ,psfina $ ;-- postscript filename ,psopen $ ;-- flags open / not open status of PS file ,psopenlab $ ;-- label for psopenflag ,xps $ ;-- flags if output to ps file is desired ,xpslab $ ;-- label for xps ,Xmulti $ ;-- save !p.multi for X-window ,PSmulti ;-- save !p.multi for PS file common pform $ ;-- def in XPSCOM.PRO ,DinA $ ;-- Papersize 1=DinA-4, 2=DinA-3, 3=Us ,plfmt ;-- protrait / landscape common size_w $ ;-- def in OPEN_PSFILE.PRO , psize $ ;-- papersize widget switch status , plori ;-- plot orientation widget switch status ;======================================================================= xsize=fltarr(3,2) ; [a4/p, a3/p, us/p, a4/l, a3/l, us/l] xsize(*)=[17.5, 27.5, 18.5, 27.5, 35., 26.] ysize=fltarr(3,2) ; [a4/p, a3/p, us/p, a4/l, a3/l, us/l] ysize(*)=[26.5, 35. ,26. , 17.5, 27.5, 18.5] yoffset=fltarr(3,2) ; [a4/p, a3/p, us/p, a4/l, a3/l, us/l] yoffset(*)=[ 0.5, 1., 1. , 28.5 ,40. ,26.] papsize=['Din-A4: ','Din-A3: ','US-Format: '] plorient=['Portrait','Landscape'] ;============================================================================= psok=0 ;-- 0: opening of file was ok / 1: not ok if(psfina(0) eq 'none')then psfina='idl.ps' x=size(psize) if(x(1) eq 0)then psize=0 ;-- init paper size x=size(plori) if(x(1) eq 0)then plori=0 ;-- init plot orientation ;============================================================================= ;-start---------------- widget construct------------------------------------- if(psopen ne 1)then begin ;--if no other psfile was opened wb = WIDGET_BASE(title='Open Your Personal Postscript File' $ ,/column $ ,SPACE = 20 $ ,YPAD = 10) wlb1=widget_label(wb,xsize=350,ysize=30,/frame $ ,value='Open Your Personal Postscript File') wb1 = WIDGET_BASE(wb,/row) ;---Paper Size widget--- bg1=cw_bgroup(wb1,['A4','A3','USF'] $ ,/exclusive,/frame,set_value=psize $ ,/return_index,/column,LABEL_TOP=' Paper Size Selection') ;---plot orientation widget--- bg2=cw_bgroup(wb1,['Portrait','Landscape'] $ ,/exclusive,/frame,set_value=plori $ ,/return_index,/column,LABEL_TOP=' Plot Orientation') ;---filename widget--- wlb1=widget_label(wb,xsize=300,ysize=30,value='Change File Name here') wt=widget_text(wb, value=psfina,XSIZE = 45 ,YSIZE = 1,/edit ) wbc = WIDGET_BUTTON(wb, VALUE = "not open") wbt = WIDGET_BUTTON(wb, VALUE = "Open PS File") widget_control,wb,/realize ;-end---------------- widget construct------------------------------------- ;======================================================================= loop=0 while(loop eq 0) do begin we=widget_event(wb) if(we.id eq bg1)then psize=we.value ;--get papersize if(we.id eq bg2)then plori=we.value ;--get plot orientation widget_control,wt,get_value=psfina ;--get filename DinA=psize(0) plfmt=plori(0) ;======================================================================= if(we.id eq wbt)then begin ;--exit and open-- button loop=1 psopen=1 ;-- open-ps-file flag: 0=close, 1=open set_plot,/copy,'PS' device,filename=strcompress(outpath, /remove_all)+psfina(0) $ ,/color $ ,landscape=plfmt $ ,xoffset=1. $ ,yoffset=yoffset(DinA,plfmt) $ ,xsize=xsize(DinA,plfmt) $ ,ysize=ysize(DinA,plfmt) mx=widget_message( ['Open PostScript File: '+psfina(0) $ ,'Format: '+papsize(dinA) $ +': '+string(xsize(DinA,plfmt)) $ +' x '+string(ysize(DinA,plfmt)) $ ,'Orient: '+plorient(plfmt) $ ,'!! Do not forget to toggle the output' $ ,'to PS output'] ) set_plot,/copy,pdev endif ;======================================================================= if(we.id eq wbc)then begin ;--cancel and not open--- loop=1 psopen=0 endif ;======================================================================= endwhile widget_control,wb,/destroy ;--if no other psfile was openedend endif else begin mx=widget_message('Sorry, but there is already a PS file open') psok=1 endelse ;======================================================================= return end ;=========================================================================== ;=========================================================================== pro panfig ;------------------------------------- ; Panel configurations ;------------------------------------- common plotdev, pdev ;-- plot device type common syspar , resetp $ , resetd $ , resetx $ , resety common plotpar, pflag $ ;-- 0=no period set 1=period set , yrmmdm $ ;-- string start date: year, month , noday $ ;-- number of days to plot , avgm ;-- averageing interval in minutes ;--------------------------------initial tick settings------------------------ wcnt=0 ;--init x-window pmulti=!p.multi !p.multi=[0,0,0] mth='' & dm='' & yr='' reads,yrmmdm,yr,mth,dm,format='(i4,i2,i2)' jul=julday(mth,dm,yr) ; get julday for plot start cdf_epoch,epoch,yr,mth,dm,/compute_epoch ; eval int-epoch for plot start sepoch=ep_to_int(epoch) jul=jul+long(noday) ; make julday for plot end caldat,jul,emth,edm,eyr ; eval date for plot end cdf_epoch,epoch,eyr,emth,edm,/compute_epoch ; eval int-epoch for plot end cdf_epoch,epoch,eyr,emth,edm,/breakdown_epoch ; eval int-epoch for plot end eepoch=ep_to_int(epoch) !x.range=[sepoch,eepoch] !x.style=1 plt=[10,100,1000] plttim=[sepoch,sepoch+(eepoch-sepoch)/2,eepoch] ;-null plot-- !x.tickv(*)=0 set_plot,/copy,'null' plot,plttim,plt,xtick_get=v ; dummy plot to get values of the ticks !x.tickv=v nel=n_elements(v) ticks=strarr(nel) for i=0,nel-1 do begin epo=int_to_ep(v(i)) cdf_epoch,epo,yy,mm,dd,hh,mi,/breakdown_epoch date=string(date_to_doy(yy,mm,dd)) $ +'-'+string(hh,format='(i2.2)') $ +':'+string(mi,format='(i2.2)') ticks(i)=strcompress(date,/remove_all) endfor !x.tickname(*)='' !x.tickname=ticks set_plot,/copy,pdev ;--------------------------------initial tick settings------------------------ axetype=[' linear ',' logarithmic '] xi=size(init) if(xi(1) eq 0)then init=0 if(init eq 0)then begin init=1 endif plts=['point to point' $ ,'Plus sign (+)' $ ,'Asterix (*)' $ ,'Period (.)' $ ,'Diamond' $ ,'Triangle' $ ,'Square' $ ,'X' $ ,'undefined' $ ,'undefined' $ ,'Histogr. mode'] ;======================================================================= wb=widget_base(/column,title='Set Panel Configuration') wtx=widget_text(wb,value=' Set Panel Configuration & Plot symbol' $ ,xsize=40,ysize=1) wb1=widget_base(wb,/row) wsl11=widget_slider(wb1,minimum=0,maximum=20,value=!y.ticks $ ,title='set major tick number y-axe',/vertical) wsl12=widget_slider(wb1,minimum=0,maximum=20,value=!x.ticks $ ,title='set major tick number x-axe' ) wb2=widget_base(wb,/row) wsl21=widget_slider(wb2,minimum=0,maximum=20,value=!y.minor $ ,title='set minor tick number y-axe',/vertical) wsl22=widget_slider(wb2,minimum=0,maximum=20,value=!x.minor $ ,title='set minor tick number x-axe' ) wb3=widget_base(wb,/row) wl31=widget_list(wb3,value=plts,scr_xsize=200,scr_ysize=200) wtx31=widget_text(wb3,value= $ [' present config: ' $ ,' y-major: '+string(!y.ticks) $ ,' x-major: '+string(!x.ticks) $ ,' y-minor: '+string(!y.minor) $ ,' x-minor: '+string(!x.minor) $ ,' Plott symbol: '+plts(!p.psym) $ ,' P symbol size: '+string(!p.symsize) $ ,' y-axe type: '+axetype(!y.type)] $ ,xsize=25,ysize=6) wsl01=cw_fslider(wb,minimum=0.,maximum=6.,value=!P.symsize $ ,title='Plot symbol size',/drag) wb4=widget_base(wb,/row) wbt40=widget_button(wb,value='show tick settings') wbt41=widget_button(wb4,value='reset all ') wbt42=widget_button(wb4,value='done with Panel config') widget_control,wb,/realize ;======================================================================= loop=0 while(loop eq 0) do begin ;======================================================================= ev=widget_event(wb) ;======================================================================= widget_control,wsl01,get_value=psize widget_control,wsl01,set_value=psize !P.symsize=psize(0) widget_control,wtx31,set_value= $ [' present config: ' $ ,' y-major: '+string(!y.ticks) $ ,' x-major: '+string(!x.ticks) $ ,' y-minor: '+string(!y.minor) $ ,' x-minor: '+string(!x.minor) $ ,' Plot symbol: '+plts(!p.psym) $ ,' P symbol size: '+string(!p.symsize) $ ,' y-axe type: '+axetype(!y.type)] if(ev.id eq wsl11)then !y.ticks=ev.value ; y-axe major ticks if(ev.id eq wsl12)then !x.ticks=ev.value ; x-axe major ticks if(ev.id eq wsl21)then !y.minor=ev.value ; y-axe minor ticks if(ev.id eq wsl22)then !x.minor=ev.value ; x-axe minor ticks if(ev.id eq wl31)then !p.psym=ev.index ; plot symbol if(ev.id eq wbt41)then begin ; reset !p=resetp ; !x=resetx ; !y=resety widget_control,wsl11,set_value=!y.ticks widget_control,wsl12,set_value=!x.ticks widget_control,wsl21,set_value=!y.minor widget_control,wsl22,set_value=!x.minor widget_control,wsl01,set_value=!P.symsize endif ;======================================================================= ;---set x-range, show tick setting-------------- if(ev.id eq wsl12)then begin mth='' & dm='' & yr='' reads,yrmmdm,yr,mth,dm,format='(i4,i2,i2)' jul=julday(mth,dm,yr) ; get julday for plot start cdf_epoch,epoch,yr,mth,dm,/compute_epoch ; eval int-epoch for plot start sepoch=ep_to_int(epoch) jul=jul+long(noday) ; make julday for plot end caldat,jul,emth,edm,eyr ; eval date for plot end cdf_epoch,epoch,eyr,emth,edm,/compute_epoch ; eval int-epoch for plot end cdf_epoch,epoch,eyr,emth,edm,/breakdown_epoch ; eval int-epoch for plot end eepoch=ep_to_int(epoch) !x.range=[sepoch,eepoch] !x.style=1 plttim=[sepoch,sepoch+(eepoch-sepoch)/2,eepoch] ;-null plot-- !x.tickv(*)=0 set_plot,/copy,'null' plot,plttim,plt,xtick_get=v ; dummy plot to get values of the ticks !x.tickv=v nel=n_elements(v) ticks=strarr(nel) for i=0,nel-1 do begin epo=int_to_ep(v(i)) cdf_epoch,epo,yy,mm,dd,hh,mi,/breakdown_epoch date=string(date_to_doy(yy,mm,dd)) $ +'-'+string(hh,format='(i2.2)') $ +':'+string(mi,format='(i2.2)') ticks(i)=strcompress(date,/remove_all) endfor !x.tickname(*)='' !x.tickname=ticks set_plot,/copy,pdev endif if(ev.id eq wbt40)then begin ;--show tickmark settings set_plot,/copy,pdev if(wcnt ne 5)then window,5 plot,plttim,plt,ytype=!y.type ; dummy plot to show ticksettings wcnt=5 endif ;======================================================================= ;--- if(ev.id eq wbt42)then loop=1 endwhile !p.multi=pmulti if !D.window eq 5 then wdelete,5 widget_control,wb,/destroy return end ;=========================================================================== ;=========================================================================== pro plot_l2d,lindx,pindx,pl_tim,pl_dat,pl_kfac,bdat ;-- plot L-2 data ;---------------------------------------------------------------------- ; input : lindx: indeces to intensity and counter arrays ; : pl_tim plot time array, contains (averaged) mid of intervals ; : pl_dat plot data array, depending on number of channels to ; plot, a 1-dim or a 2-dim array ; values of -707 flag data gaps ; output: bdat last data plot array: later used in oplot ;---------------------------------------------------------------------- common korfac, kfacs ;--corection factor selection ;..0=no corr, 1=tot, ;..2=grader Einfall 3=grader Einfall common ncolor,ncol ;-- plot color setting common ypar, yran,yrplt,rin ;-- yrange default, in plot used yran, ;.. index to yran common korfac, kfacs ;--corection factor selection ;..0=no corr, 1=tot, ;..2=grader Einfall 3=grader Einfall common plotdev, pdev ;-- plot device type common plotpar, pflag $ ; pflag 0=no period set 1=period set , yrmmdm $ ; string start date: year, month , noday $ ; number of days to plot , avgm ; averageing interval in minutes common plottitle, smtitle $ ; selfmade title , sxtitle $ ; selfmade xtitle , sytitle ; selfmade ytitle common psfile $ ,psfina $ ;-- postscript filename ,psopen $ ;-- flags open / not open status of PS file ,psopenlab $ ;-- label for psopenflag ,xps $ ;-- flags if output to ps file is desired ,xpslab $ ;-- label for xps ,Xmulti $ ;-- save !p.multi for X-window ,PSmulti ;-- save !p.multi for PS file common l2lab, l2label common cntplot, cntX,cntPS ; plot counter for x-win & ps-file common panptr, ptrx,ptrps ; Panel pointer (saves !p.multi) datatyp=strarr(41) datatyp(0:12)='Intensity' datatyp(13:*)='Counts' ytit=strarr(41) ytit(0:7)='/cm**2 s sr MeV ' +strtrim(string(avgm),2)+' min averaged' ytit(8:11)='/cm**2 s sr MeV/n ' +strtrim(string(avgm),2)+' min averaged' ytit(12)='/cm**2 s sr ' +strtrim(string(avgm),2)+' min averaged' ytit(13:*)='Counts/min ' +strtrim(string(avgm),2)+' min averaged' xs=size(lindx) if(lindx(0) eq -1)then lindx=lindx(1:*) ;-- shrink array if(xs(0) eq 0)then ploop=0 ;-- 0-dim data array if(xs(0) ge 1)then ploop=xs(1)-1 ;-- n-dim data array nex=n_elements(pl_dat(*,0)) ;-- number of data records for j=0,xps do begin ;--x/ps loop if(j eq 1)then set_plot,/copy,'PS' for i=0,ploop do begin ;-- channel loop pl_hlp=pl_dat(*,pindx(i)) pl_hlp=reform(pl_hlp) ;--generate 0-dim plot array xn=where(pl_hlp ne -707,cntn) pltim=pl_tim(xn) ;--kick -707 out pl_hlp=pl_hlp(xn) pl_hlp=pl_hlp *pl_kfac(xn,pindx(i),kfacs) ;------------data gap detector------------ px=where([pltim,0] - [0,pltim] gt avgm*65, cnt) ;-------------y-range setting------------- yrplt=[yran(0,lindx(i),rin), yran(1,lindx(i),rin)] ;--Yrange pmtitle='SOHO EPHIN '+ l2label(lindx(i)) +' '+datatyp(lindx(i)) if(smtitle ne '')then pmtitle=smtitle pxtitle='Start Date:'+yrmmdm if(sxtitle ne '')then pxtitle=sxtitle pytitle=ytit(lindx(i)) if(sytitle ne '')then pytitle=sytitle ;------------plot device pannel pointer if(!D.name eq pdev)then !p.multi=Xmulti if(!D.name eq 'PS')then !p.multi=PSmulti ;-- no-data plot to get frame, o-plot follows plot,pltim,pl_hlp $ ,title=pmtitle $ ,xtitle=pxtitle $ ,ytitle=pytitle $ ,ytype=!y.type $ ,yrange=yrplt $ ,background=255 $ ,color=0 $ ,/nodata if(!D.name eq 'PS')then begin PSmulti=!p.multi cntPS=cntPS+1 ;--plot-counter PS-file endif if(!D.name eq pdev)then begin Xmulti=!p.multi cntX=cntX+1 ;--plot-counter x-window endif s=0 if(px(0) eq 0 and cnt eq 1)then cnt=0 if(cnt eq 0)then begin ;-- if no data gaps, prepare px and cnt cnt=1 ;.. to loop once for a complete plot px(0)=n_elements(pltim)-1 endif for p=0,cnt-1 do begin ;--plot in intervals from gap to gap e=px(p)-1 if(s lt e)then begin oplot,pltim(s:e),pl_hlp(s:e),color=ncol endif s=px(p) endfor if(((n_elements(pltim)-1) -e) gt 1)then begin ;--rest plot e=e+1 oplot,pltim(e:*),pl_hlp(e:*),color=ncol endif endfor ;--channel loop endfor ;--x/ps loop if(!D.name eq 'PS')then set_plot,/copy,pdev bdat=[min(pl_hlp),max(pl_hlp)] return end ;=========================================================================== ;=========================================================================== pro oplot_l2d,lindx,pindx,pl_tim,pl_dat,pl_kfac,pin,sran,bdat ;-- plot L-2 data ;---------------------------------------------------------------------- ; input : lindx: indeces to intensity and counter arrays ; : pl_tim plot time array, contains (averaged) mid of intervals ; : pl_dat plot data array, depending on number of channels to ; plot, a 1-dim or a 2-dim array ; values of -707 flag data gaps ; : pin channel index, to save y-range from the basic plot ;---------------------------------------------------------------------- common korfac, kfacs ;--corection factor selection ;..0=no corr, 1=tot, ;..2=grader Einfall 3=grader Einfall common oplotfac,ofac common ncolor,ncol ;-- color settings common ypar, yran,yrplt,rin ;--yrangedefault, in plot used yran, ;.. index to yran common plotdev, pdev ;-- plot device type common plotpar, pflag $ ; pflag 0=no period set 1=period set , yrmmdm $ ; string start date: year, month , noday $ ; number of days to plot , avgm ; averageing interval in minutes common psfile $ ,psfina $ ;-- postscript filename ,psopen $ ;-- flags open / not open status of PS file ,psopenlab $ ;-- label for psopenflag ,xps $ ;-- flags if output to ps file is desired ,xpslab $ ;-- label for xps ,Xmulti $ ;-- save !p.multi for X-window ,PSmulti ;-- save !p.multi for PS file common l2lab, l2label common cntplot, cntX,cntPS ;-- plot counter for x-win & ps-file common panptr, ptrx,ptrps ;-- Panel pointer (saves !p.multi) ;---- xsmulti=xmulti ;--save in local variable panel counter pssmulti=psmulti ;---- ;----set !P.multi back for plot/noerase-(o-plot)----x-window smul= indgen(max([xsmulti(1),1]) * max([xsmulti(2),1]) ) ;-- [0,1,2,..] smul=shift(smul,-1) ;-- help array to correct panel counter xsmulti(0)=smul(xsmulti(0)) ;-- set !p.multi counter back ;----set !P.multi back for plot/noerase-(o-plot)----ps-file psmul= indgen(max([pssmulti(1),1])*max([pssmulti(2),1]) ) psmul=shift(psmul,-1) pssmulti(0)=psmul(pssmulti(0)) ;---- ; datatyp=strarr(41) ;--- y & y title datatyp(0:12)='Intensity' datatyp(13:*)='Counts' ytit=strarr(41) ytit(0:7)='/cm**2 s sr MeV' ytit(8:11)='/cm**2 s sr MeV/n' ytit(12)='/cm**2 s sr ' ytit(13:*)='Counts/minute' xs=size(lindx) if(lindx(0) eq -1)then lindx=lindx(1:*) ;-- shrink array if(xs(0) eq 0)then ploop=0 ;-- 0-dim data array if(xs(0) ge 1)then ploop=xs(1)-1 ;-- n-dim data array nex=n_elements(pl_dat(*,0)) ;-- number of data records for j=0,xps do begin ;--x/ps loop if(j eq 1)then set_plot,'PS' for i=0,ploop do begin ;-- channel loop pl_hlp=pl_dat(*,pindx(i)) pl_hlp=reform(pl_hlp) ;--generate 0-dim plot array xn=where(pl_hlp ne -707,cntn) pltim=pl_tim(xn) ;--kick -707 out pl_hlp=pl_hlp(xn) pl_hlp=pl_hlp *pl_kfac(xn,pindx(i),kfacs) ;------------data gap detector------------ px=where([pltim,0] - [0,pltim] gt avgm*65, cnt) if(!D.name eq pdev)then !p.multi=Xsmulti if(!D.name eq 'PS')then !p.multi=PSsmulti ; yrplt=[yran(0,pin,rin), yran(1,pin,rin)] ;--Yrange yrplt=sran ;--plot frame first---- plot,[min(pltim),max(pltim)],bdat $ ;-- no-data plot for the Panel ,yrange=yrplt $ ;..with data from last plot ,ytype=!y.type $ ;--lin/log ,background=255 $ ,color=0 $ ,xstyle=5 $ ;--exact range, suppress x-axe ,/noerase $ ,/nodata if(!D.name eq 'PS')then begin psmul=shift(psmul,2) !p.multi(0)=psmul(pssmulti(0)) PSmulti=!p.multi ; cntPS=cntPS+1 ;--plot-counter PS-file endif if(!D.name eq pdev)then begin smul=shift(smul,2) !p.multi(0)=smul(xsmulti(0)) Xmulti=!p.multi ; cntX=cntX+1 ;--plot-counter x-window endif s=0 if(px(0) eq 0 and cnt eq 1)then cnt=0 if(cnt eq 0)then begin ;-- if no data gaps, prepare px and cnt cnt=1 ;.. to loop once for a complete plot px(0)=n_elements(pltim)-1 endif ;--check if y-axe logarithm (1) or linear(0) scaled if(!y.type eq 0) then pl_hlp=pl_hlp +ofac(0) else begin if(ofac(0) eq 0)then msg=widget_message('The o-fac is zero') pl_hlp=pl_hlp*ofac(0) endelse for p=0,cnt-1 do begin ;--plot in intervals from gap to gap e=px(p)-1 if(s lt e)then begin oplot,pltim(s:e),pl_hlp(s:e),color=ncol endif s=px(p) endfor if( (n_elements(pltim)-1) - e gt 1 )then begin e=e+1 oplot,pltim(e:*),pl_hlp(e:*),color=ncol endif endfor ;--channel loop endfor ;--x/ps loop if(!D.name eq 'PS')then set_plot,pdev return end ;=========================================================================== pro plot_menl2,lindx,pl_tim,pl_dat,pl_kfac ;---------------------------------------------------------------------- ; input lindx: index in l2label-array (contains intensity and counter labels) ; pl_tim: plot time array ; pl_dat: plot data array ;---------------------------------------------------------------------- common ypar, yran,yrplt,rin ;--yrangedefault, in plot used yran, index to yran common korfac, kfacs ;--corection factor selection ;..0=no corr, 1=tot, ;..2=grader Einfall 3=grader Einfall common plotdev, pdev ;-- plot device type common psfile $ ,psfina $ ;-- postscript filename ,psopen $ ;-- flags open / not open status of PS file ,psopenlab $ ;-- label for psopenflag ,xps $ ;-- flags if output to ps file is desired ,xpslab $ ;-- label for xps ,Xmulti $ ;-- save !p.multi for X-window ,PSmulti ;-- save !p.multi for PS file common l2lab, l2label common cntplot, cntX,cntPS ; plot counter for x-win & ps-file common panptr, ptrx,ptrps ; Panel pointer (saves !p.multi) common pmulti, px,py ; window config (Panel dispersion) common oplotfac,ofac ; -- overplot factor cofac=string(!y.type) ;--overplot factor ylab=['default','selfmade','IDL-autom'] axetype=['---linear---','-logarithmic-'] plotmode=['Plot Mode: Plot','Plot Mode: O-plot'] pmode=0 pin=-1 ;--plot basic index for o-plots if(lindx(0) eq -1)then lindx=lindx(1:*) ;-- shrink array to delete -1 flag ;====================================================================== ;-----------------! widget construct !--------------------------------- wb = WIDGET_BASE(title='EPHIN L2 Plot-Menu ', $ ;create the base /row) wb1=widget_base(wb,/column) mchoice=l2label(lindx) ;--preset list widget with selected channels lnel=n_elements(lindx) wt=widget_text(wb1,value=['To plot single channels' $ ,'double-click on list, else use' $ ,'>--Plot All--< Button'] $ ,ysize=3,xsize=26 ) wl=widget_list(wb1,value=mchoice,scr_xsize=70,scr_ysize=lnel*28) wbt=widget_button(wb1,value='---Plot All---') wbt1=widget_droplist(wb1,value=['Y-Scaling: linear' $ ,'Y-Scaling: logarithmic'] ) ; wbt1=widget_button(wb1,value='---y-linear--') wbt2=widget_droplist(wb1,value=['Y-Range: default','Y-Range: selfmade' $ ,'Y-Range: IDL-autom']) ; wbt2=widget_button(wb1,value='y-range: '+ylab(rin)) wbt3=widget_button(wb1,value='---Save Data in ASCII File---') wla=widget_label(wb1,value='! Watch Info Boxes !',xsize=200,ysize=26) wt12=widget_text(wb1,ysize=2,xsize=30 $ ,value=['Output goes to :'+xpslab(xps) $ ,'PS File is: '+psopenlab(psopen)]) wt13=widget_text(wb1,value=['PostScript Filename:',psfina] $ ,ysize=2,xsize=30) wt21=widget_text(wb1,value=['Plot Window Config:' $ ,'X-Directn.: '+string(!p.multi(1)) $ ,'Y-Directn.: '+string(!p.multi(2))] $ ,ysize=3,xsize=20) wt23=widget_text(wb1,value=['X-win counter: '+string(cntX) $ ,'PS-File count: ',+string(cntPS)] $ ,ysize=2,xsize=20) nb=widget_base(wb1,/row) bg01=cw_bgroup(nb,[ $ 'clear plotwindow','destroy plotwindow'] $ ,/column,/return_index) bg02=cw_bgroup(nb,[ $ 'config plotwindow ','config pltpanel'] $ ,/column,/return_index) ;----syn version, use not in EPHIN single plot mode -------- bg03=777 ; ; bg03=cw_bgroup(nb,[ $ ; 'Call LION','Recall LION'] $ ; ,/column,/return_index) ;----syn version-------------------------------------------- wb2=widget_base(wb,/column) bg20=widget_button(wb2,value='--set color--') bg200=widget_button(wb2,value=plotmode(pmode)) ;--plot/oplot switch bg202=widget_button(wb2,value='+HELP O-plot fac+') ;--over plot help wt20=widget_text(wb2,value=cofac,XSIZE = 11 ,YSIZE = 1,/edit) bg201=widget_button(wb2,value='Annotations') bg203=widget_button(wb2,value='Plot Title') bg204=widget_button(wb2,value='+HELP Corr fac+') wdl205=widget_droplist(wb2,value=['no corrct','arbit incidnc' $ ,'paral incidnc-1','paral incidnc-2']) bg206=widget_button(wb2,value='Write GiF') bg21=cw_bgroup(wb2, ['open PS ', 'close PS','toggle x/ps ' ,'-' $ ,'set Y-range','set X-range' $ ,'BACK TO MAIN MENU'] $ ,/column,/return_index) widget_conTRol,wb,/realize ;-----------------! widget construct !--------------------------------- ;====================================================================== ;====================================================================== ;-----------------! widget loop !-------------------------------------- loop=0 while(loop eq 0 ) do begin widget_conTRol,wb,/show pe=widget_event(wb) ; check widget base event ;==================================================================== if(pe.id eq wbt)then begin ;--- plot all channel pmultx=Xmulti pmultPs=Psmulti xmulti=[0,0,lnel] psmulti=[0,0,lnel] pindx=indgen(lnel) ;--index list of left list ;... widget in main menu plot_l2d,lindx,pindx,pl_tim,pl_dat,pl_kfac,bdat pin=-1 pmode=0 widget_control,bg200,set_value=plotmode(pmode) xmulti=pmultx & xmulti(0)=0 psmulti=pmultps & psmulti(0)=0 endif ;==================================================================== if(pe.id eq wbt1)then begin ;--- linear/ logarithmic scaling !y.type=pe.index ; if(!y.type eq 0) then !y.type=1 else !y.type=0 ; widget_control,wbt1,set_value='y-scaling: '+axetype(!y.type) endif ;==================================================================== if(pe.id eq wbt2)then begin ;--- select y-range if(pmode eq 0)then begin rin=pe.index ; rin=rin+1 ;-- rin: range index default: 0 ; ;.. selfmade: 1 ; ;.. idl automat: 2 ; if(rin eq 3)then rin=0 ; widget_control,wbt2,set_value='y-Range: '+ylab(rin) endif else begin pmsg=widget_message(' you cannot change Y-ranging in O-plot mode') endelse endif ;==================================================================== if(pe.id eq wbt3)then begin ;--- save data save_dat,pl_tim,pl_dat endif ;==================================================================== ;--widget_list, coincidence and SDC choice------ plot single channel if(pe.id eq wl)then begin ;--- widget list choice xmulti(1:2)=[px,py] psmulti(1:2)=[px,py] if(pe.clicks eq 2 )then begin if(pmode eq 0)then begin plot_l2d,lindx(pe.index),pe.index,pl_tim,pl_dat,pl_kfac,bdat pin=lindx(pe.index) ;-- save channel index for o-plots sran=yrplt if(rin eq 2)then sran=!y.crange endif else begin if(pin gt -1) then begin ;-- start O-plot widget_control,wt20,get_value=cofac ofac=float(cofac) oplot_L2d,lindx(pe.index),pe.index,pl_tim,pl_dat,pl_kfac,pin,sran $ ,bdat endif else begin wms=widget_message( ['Dont o-plot an empty or PLOT-ALL sheets' $ ,' ' $ ,'set plot mode to >PLOT< and repeat'] ) endelse endelse endif endif ;=== BG01 ============================================================== if(pe.id eq bg01)then begin ;----left button group BG01 ;=-0-=== BG01 ======================================================== if(pe.value eq 0 )then begin ;-- clear plotwindow erase,color=255 ; reset all plot counter cntX=0 !p.multi(0)=0 endif ;=-1-=== BG01 ======================================================== if(pe.value eq 1)then begin ;---destr. plotwin wdelete cntX=0 !p.multi(0)=0 endif endif ;--BG01 end ;======================================================================= ;==== BG02 ============================================================= if(pe.id eq bg02)then begin ;----left button group BG02 ;=-0-=== BG02 ======================================================== if(pe.value eq 0)then begin ;---config plotwin set_plotwin cntX=0 pin=-1 endif ;=-1-=== BG02 ======================================================== if(pe.value eq 1)then begin ;---config plot Panel--- panfig endif endif ;--bg02 end ;==================================================================== ;----syn version, use not in EPHIN single plot mode -------- ;=== BG03 ============================================================== if(pe.id eq bg03)then begin ;----left bottom button group BG03 ;=-0-=== BG03 ======================================================== if(pe.value eq 0 )then begin ;-- Call LION plot ; widget_control,wb,iconify=1 ; lio2plot,llindx,lplabel,lprange,lpl_tim,lpl_dat ; widget_control,wb,iconify=0 endif ;=-1-=== BG03 ======================================================== if(pe.value eq 1)then begin ;---Recall LION ; widget_control,wb,iconify=1 ; lplot_menl2,llindx,lplabel,lprange,lpl_tim,lpl_dat ; widget_control,wb,iconify=0 endif endif ;--BG03 end ;======================================================================= ;----syn version, use not in EPHIN single plot mode -------- ;======================================================================= ;---set plot mode plot/oplot if(pe.id eq bg200)then begin ;--plot-mode: 0 / o-plot mode:1 if(pmode eq 0)then pmode=1 else pmode=0 widget_control,bg200,set_value=plotmode(pmode) ofac=!y.type widget_control,wt20,set_value=string(ofac) endif ;==================================================================== ;---annotations if(pe.id eq bg201)then begin anots,xps endif ;==================================================================== ;---overplot factor help if(pe.id eq bg202)then begin omsg=widget_message($ ['The ''factor'' below this button is multiplicated '$ ,'with the data in case of logarithmic scaling,' $ ,'it is added to the data in case of linear scaling']) endif ;==================================================================== ;---Plot Title if(pe.id eq bg203)then begin plot_title endif ;==================================================================== ;---Help correction factor if(pe.id eq bg204)then begin ktxt=[ $ 'Correction factor help! ' $ ,'==========================' $ ,'!! Only Proton and He channels may be plotted with PHA correction !!' $ ,' ' $ ,' 1. selection:> no corrct <: ' $ ,' plot data without PHA correction' $ ,' 2. selection:> arbit incidnc <: (arbitrary incidence)'$ ,' data plot corrected with: ' $ ,' # particles in proton+deuterium box / total # particles in p PHA ' $ ,' resp. ' $ ,' # particles in 3He+4He box / total # particles in He PHA' $ ,' relation ' $ ,' 3. selection:> paral incidnc-1 <: (parallel incidence) ' $ ,' data plot corrected with: ' $ ,' # particles in proton box / total # particles in p PHA' $ ,' resp. ' $ ,' # particles in 3He box / total # particles in He PHA' $ ,' relation ' $ ,' 4. selection:> paral incidnc-2 <: (parallel incidence' $ ,' data plot corrected with: ' $ ,' # particles in deuterium box / total # particles in p PHA' $ ,' resp. ' $ ,' # particles in 4He box / total # particles in He PHA ' $ ,' relation ' $ ,' ( see L2 documentation too ) ' ] hmsg=widget_message(ktxt,/information) endif ;==================================================================== ;---select correction factor if(pe.id eq wdl205)then begin kfacs=pe.index endif ;==================================================================== ;---set color if(pe.id eq bg20)then set_col ;==================================================================== ;---write GIF file if(pe.id eq bg206)then begin write_gif,'l2plot.gif',tvrd() mgif=widget_message('New GIF file: L2PLOT.GIF') endif ;====cw_button_group==================================================== if(pe.id eq bg21)then begin ;----left button group ;=-0-=== BG21 ========================================================== if(pe.value eq 0)then begin ;---open PostScript file open_psfile,psok if(psok eq 0)then begin cntPS=0 ;-- reset plot Panel counter for PS file endif widget_control,wt12 $ ,set_value=['Output goes to: '+xpslab(xps) $ ,'PS File is : '+psopenlab(psopen)] endif ;=-1-====BG21 ========================================================== if(pe.value eq 1)then begin ;---close PostScript file if(psopen eq 0)then begin txt='no PS file open ' mes=widget_message(txt,/information) endif else begin set_plot,/copy,'PS' xps=0 device,/close set_plot,/copy,pdev psopen=0 txt='close PS file: '+psfina mes=widget_message(txt,/information) widget_control,wt12 $ ,set_value=['Output goes to:'+xpslab(xps) $ ,'PS File is : '+psopenlab(psopen)] endelse endif ;=-2-========BG21 ==================================================== if(pe.value eq 2)then begin ;---set output to PS file if(xps eq 1) then xps=0 else xps=1 ;-- toggle switch X/PS if(xps eq 1) then begin if(psopen eq 0)then begin txt='You must first open a PS File' mes=widget_message(txt,/information) xps=0 endif else begin xps=1 ;-- set plot output to X and PS endelse endif else begin xps=0 ;-- set plot output to X endelse widget_control,wt12 $ ,set_value=['output:'+xpslab(xps),'PS File is : '+psopenlab(psopen)] endif ;=-3-================================================================= ;=-4-================================================================= if(pe.value eq 4)then begin ;---yrange setting set_yrange endif ;=-5-================================================================= if(pe.value eq 5)then begin ;---x sub range setting set_newxran widget_control,wb,/show endif ;=-6-================================================================= if(pe.value eq 6)then begin ;---back to outputmanager loop=2 endif ;====================================================================== ;--show plotwindow config-- widget_control,wt21,set_value=['Plot Window Config:' $ ,'X-Directn.: '+string(!p.multi(1)) $ ,'Y-Directn.: '+string(!p.multi(2))] endif ;====cw_button_group=end================================================ widget_control,wt13,set_value=['PostScript Filename:',psfina] widget_control,wt23,set_value=['X-win counter: ' $ +strcompress(string(cntX)) $ ,'PS-File count: ' $ +strcompress(string(cntPS))] endwhile ende: widget_control,wb,/destroy return end ;=========================================================================== ;=========================================================================== pro readr_l2,posflag,L2dat,l2nam ;---------------------------------------------------------------------- ;posflag: ;-- file position flag ; ;.. 0=read from actual position ; ;.. 1=read from preceding position ;l2nam ;.. name of actual opend L2-file ;--L2 rate structure---------------------------- L2dat={L2 $ , pb5:lonarr(3) $ ; year [yyyy], doy [ddd], ms of day [ss sss sss] , epoch:0.d $ ; ms sinc ad , stat:lonarr(2) $ ; EPHIN status information ,intst:fltarr(13) $ ; intensity of coincidence channel ,cnts:lonarr(28) $ ; counts of coincidence channels ,tbd:lonarr(4) } ; spare common readpar, in_file,fptr,eof,ostat,fpos ;-- all file info common units, sc_un,ph_un common plotpar, pflag $ ;-- 0=no period set 1=period set , yrmmdm $ ;-- string start date: year, month , noday $ ;-- number of days to plot , avgm ;-- averageing interval in minutes xs=size(fpos) if(xs(1) eq 0)then fpos=0 loop=0 while (loop eq 0) do begin loop=1 !err=0 if(eof eq -1)then begin ;--open new file ix=size(sc_un) if(ix(1) ne 0 )then begin if(sc_un ne 0)then free_lun,sc_un ;--init filepointer endif on_ioerror,ioerr if(fptr ge noday)then begin print,'End of read-in period reached' ostat=-2 ;--end of last file , end of read-in period goto, enderr endif sc_un=10 openr,sc_un,in_file(fptr) ;,/get_lun print,'readr_l2:: open: ',in_file(fptr) l2nam=in_file(fptr) fptr=fptr+1 ;--increment filepointer fpos=0 ostat=0 ;-- open status = ok goto,noerr ioerr: print,strcompress(!err_string) ostat=-1 ;-- open status = not ok goto,enderr noerr: endif ;print,' read:: ',strcompress(!err_string),' ostat',ostat,' pos ',posflag if(ostat eq 0)then begin on_ioerror,rerr ;-- on read error goto r-error: mark if(posflag eq 1)then point_lun,sc_un,fpos point_lun,-sc_un,fpos readf,sc_un,L2dat ;-- read data set eof=0 goto,norerr rerr: print,strcompress(!err_string) if(strpos(!err_string,'End of file') gt -1) then begin eof=-1 fpos=0 loop=0 ;-- second loop with new file to open endif norerr: endif ;---- hier evtl error interrupt endwhile enderr: return end ;=========================================================================== ;=========================================================================== ;=========================================================================== ;=========================================================================== pro readko_l2,lepoch,lindx,l2nam,kofac ;---------------------------------------------------------------------- ; input parameter ; lepoch: epoch time from L2-data record ; lindx: indeces from L2-data channels, which have to be corrected ; l2nam: name of actual opened L2-file ; output parameter ; kofac: correction factors, in the same sequence than the L2-data ;------------------------------------------------------------------------ ; this routine searches for proton and helium coincidence channels ; time correlated correction factors ;------------------------------------------------------------------------ common korstat, fpos,kostat,epochs kofac=fltarr(4,51) ;--0:nofac, 1:gesHe, 2:He^4, 3:He^3 kofac(*)=1 ;-- init kofac dx=where(lindx le 11 and (lindx gt 3)) if(dx(0) eq -1)then goto,enderr ;-- if no corective channel selected leave pro kindx=lindx(dx) ;--extract knel=n_elements(kindx) kfindx=intarr(51) kfindx(*)=50 ;-dummy ;--pointer into kodat.kof array for i=4,11 do begin kfindx(i)=(i-4)*5 endfor ;-- example: channel index 4 (=P4) has kofac ;.. index 0 (see table below ) ; chan-id index korfac index ;------------------------------- ;-- P4 4 0 ;-- P8 5 5 ;-- P25 6 10 ;-- P41 7 15 ;-- H4 8 20 ;-- H8 9 25 ;-- H25 10 30 ;-- H41 11 35 kodat={ko $ , pb5:lonarr(3) $ ; year [yyyy], doy [ddd], ms of day [ss sss sss] , epoch:0.d $ ; ms sinc ad , kof:fltarr(40) } ; correction factors ko_un=15 ;-- correction file unit common plotpar, pflag $ ;-- 0=no period set 1=period set , yrmmdm $ ;-- string start date: year, month , noday $ ;-- number of days to plot , avgm ;-- averageing interval in minutes common korfile, lastl2 xs=size(lastl2) ;-- save last l2-filename if(xs(1) eq 0)then lastl2='x' ;-- init it with dummy to force open ;--------------------------------new file open------------------------------- if(lastl2 ne l2nam)then begin ;-- if new L2 file was open, open new l2len=strlen(l2nam) ;.. korr file loop=0 while(loop eq 0) do begin ;-- eval correction file name l2len=l2len-1 ;-- find extension position ptr=strmid(l2nam,l2len,1) if(ptr eq '.')then loop=1 endwhile knam=strmid(l2nam,0,l2len)+'.kor' ;-- attach new extension on_ioerror,nix kostat=-1 close,ko_un openr,ko_un,knam ;-- open new correction file goto, nixnix nix: print,'KO-READ:: ',!err_string ;--file open error kofac(*)=0 print,'KO-READ:: correction factor set to 0' goto,enderr nixnix: print,' KO_RAD:: Open new correction file: ',knam kostat=0 endif ;--------------------------read kor file & synchronize------------------------- if(kostat eq 0)then begin on_ioerror,rerr ;-- on read error goto r-error: mark point_lun,-ko_un,kfpos readf,ko_un,kodat ;-- read data set if(kodat.epoch gt lepoch)then begin ;-- if time does not fit point_lun,ko_un,kfpos ;-- jump back on old position ;.. wait for next lepoch print,' KO_read:: no correction factor at: ',epoch_print(lepoch) kofac(*)=-1 endif else begin if(kodat.epoch lt lepoch)then begin ;-- if time does not fit loop=0 ;.. contiue reading while(loop eq 0) do begin point_lun,-ko_un,kfpos readf,ko_un,kodat if(kodat.epoch gt lepoch)then begin ;- data-korfac correlatn failed print,' KO_read:: no correction factor at: ',epoch_print(lepoch) kofac(*)=-1 loop=1 point_lun,ko_un,kfpos endif if(kodat.epoch eq lepoch)then loop=1 endwhile endif endelse if(kodat.epoch eq lepoch)then begin ;-- data corelated with korfac for i=0,n_elements(kindx)-1 do begin kofac(0,kindx(i))=1 if( kodat.kof(kfindx(kindx(i))+1) + kodat.kof(kfindx(kindx(i))) eq 0 )then $ kodat.kof(kfindx(kindx(i)))=1 kofac(1,kindx(i))=kodat.kof(kfindx(kindx(i))+1)/kodat.kof(kfindx(kindx(i))) if( kodat.kof(kfindx(kindx(i))+3) + kodat.kof(kfindx(kindx(i))+2) eq 0 )then $ kodat.kof(kfindx(kindx(i))+2)=1 kofac(2,kindx(i))=kodat.kof(kfindx(kindx(i))+3)/kodat.kof(kfindx(kindx(i))+2) if( kodat.kof(kfindx(kindx(i))+4) + kodat.kof(kfindx(kindx(i))+2) eq 0 )then $ kodat.kof(kfindx(kindx(i))+2)=1 kofac(3,kindx(i))=kodat.kof(kfindx(kindx(i))+4)/kodat.kof(kfindx(kindx(i))+2) endfor endif ;-- synchronization successful endif ;--no openerr, kostat=0 rerr: lastl2=l2nam enderr: return end ;=========================================================================== ;=========================================================================== pro anots,xps ;-------------------------------------------------------------------------- ;simple tool to annotate the plots ;input xps flags whether output goes to postscript file or not ;-------------------------------------------------------------------------- common ncolor,ncol common plotdev, pdev ;-- plot device type peh=!p !p.background=255 atext=' ' chsiz=1. orient=0 xfon=3 cfont=['','','' $ ,' 3 Simplex Roman' $ ,' 4 Simplex Greek' $ ,' 5 Duplex Roman' $ ,' 6 Complex Roman' $ ,' 7 Complex Greek' $ ,' 8 Complex Italic' $ ,' 9 Math & Special' $ ,'10 Special Char' $ ,'11 Gothic English' $ ,'12 Simplex Script' $ ,'13 Complex Script' $ ,'14 Gothic Italian' $ ,'15 Gothic German' $ ,'16 Cyrillic' $ ,'17 Triplex Roman' $ ,'18 Triplex Italic'] wb=widget_base(/column) wt1=widget_text(wb,value= ['Put in your annotation: ' $ ,'- text, size, orientation - first,' $ ,'then click on >Start Mouse<' $ ,'then move mouse over X-Window' $ ,'then click, and your text appears'] $ ,ysize=6,xsize=40) wt2=widget_text(wb,/editable,/frame,ysize=1,xsize=30) wsl1=cw_fslider(wb,minimum=1.0,maximum=4.0 $ ,title='set text character size' ,value=1.,/drag) wsl2=widget_slider(wb,minimum=0,maximum=360,title='set text orientation' $ ,value=0) wsl3=widget_slider(wb,minimum=3,maximum=18,title='set vector font' $ ,value=3) wbt1=widget_button(wb,value='font help') wbt2=widget_button(wb,value='start mouse') wbt3=widget_button(wb,value='done with annots') widget_control,wb,/realize xx=indgen(100) yy=indgen(100) loop=0 while(loop eq 0) do begin ev=widget_event(wb) widget_control,wt2,get_value=atext ; get annotation text widget_control,wsl1,get_value=chsiz ; get charactersize widget_control,wsl2,get_value=orient ; get orientation widget_control,wsl3,get_value=xfon ; get font widget_control,wsl1,set_value=chsiz ; get charactersize ; wdelete,2 if(ev.id eq wbt1)then begin ; --- help vector font window,2 mult=!p.multi ; save x window config !p.multi(*)=0 ; reset x window config plot,xx,yy,/nodata,title='Font help' ; dummy plot frame cnt=2 for i=0.95,0.05,-0.057 do begin cnt=cnt+1 xyouts,0.05,i,'!'+strcompress(string(cnt),/remove_all ) $ +cfont(cnt),charsize=2. $ ,color=ncol,/norm endfor !p.multi=mult endif if(ev.id eq wbt2)then begin cursor,x,y,/wait,/data,/up atext='!'+strcompress(string(xfon),/remove_all)+atext+'!X' xyouts,x,y,atext,charsize=chsiz,orientation=orient,color=ncol if(xps eq 1)then begin set_plot,/copy,'ps' xyouts,x,y,atext,charsize=chsiz,orientation=orient,color=ncol set_plot,/copy,pdev endif endif if(ev.id eq wbt3)then loop=1 endwhile widget_control,wb,/destroy ;wdelete,2 !p=peh return end ;=========================================================================== ;=========================================================================== pro set_col ;-------------------------------------------------------------------------- ; set plot colors. background is set to white, line color can be selected ; by draging a slider button ;------------------------------------------------------------------------- red= [0,255, 0, 0,255,255, 0,125,225,125,125] green=[0, 0,255, 0, 0,255,255, 0,125,125,125] blue= [0, 0, 0,255,255, 0,255,125, 0, 0,125] pmul=!p.multi ;--save window config !p.multi(*)=0 sp=!p sx=!x sy=!y common ncolor, ncol x=size(ncol) if(x(1) eq 0)then ncol=0 uwin=!D.window ;-- save window nr wb=widget_base(/column,title='Plot Color Setting Menu') wd=widget_draw(wb,xsize=255,ysize=150) ws=widget_slider(wb,minimum=0,maximum=10,/drag,xsize=255,value=ncol $ ,title='drag slider to change plot color') wbt0=widget_button(wb,value='color') wbt1=widget_button(wb,value='black & white') wbt2=widget_button(wb,value='done') widget_control,wb,/realize widget_control,wd,get_value=wnr wset=wnr x=indgen(100) !x.range=[0,100] !x.tickv(*)=0 plot,background=255,color=0,x,x/cos(x),yrange=[3000,-3000],xrange=[0,100] $ ,ystyle=0,xstyle=0 oplot,x,x/cos(x),color=ncol,thick=3. loop=0 while(loop eq 0)do begin widget_control,ws,get_value=ncol ev=widget_event(wb) if(ev.id eq wbt0)then begin ;-- load color table tvlct,red,green,blue oplot,x,x/cos(x),color=ncol,thick=3. ; loadct,12,/silent endif if(ev.id eq wbt1)then begin ;-- load black and white loadct,0,/silent oplot,x,x/cos(x),color=ncol,thick=3. endif if(ev.id eq wbt2)then begin ;-- done loop=2 widget_control,ws,get_value=ncol widget_control,wb,/destroy if(uwin gt -1)then wset, uwin endif if(ev.id eq ws)then begin ;-- slider widget_control,ws,get_value=ncol oplot,x,x/cos(x),color=ncol,thick=3. endif endwhile !p=sp !x=sx !y=sy return end ;=========================================================================== ;=========================================================================== pro set_plotrange,cancel ;------------------------------------------------------------------------ ; simple input widget for plot time parameter ; startdate in [yrmmdm] : year, month , day of month ; noday : number of days to plot ; avgm : average period in minutes ; ; cancel: 0= no cancel 1=cancel ;------------------------------------------------------------------------ ; --- plotparameter (to be initialized by rtn >plotcom.pro< common plotdev, pdev ;-- plot device type common plotpar, pflag $ ; pflag 0=no period set 1=period set , yrmmdm $ ; string start date: year, month , noday $ ; number of days to plot , avgm ; averageing interval in minutes cancel=0 wcnt=0 savet=yrmmdm saven=noday savea=avgm pflag=1 ;----widget construct ----- wb=widget_base(/column,title=' Plot Period Settings ') wlb0=widget_label(wb,xsize=400,ysize=20 $ ,value='Set Plottime Period ! ',/frame) wlb1=widget_label(wb,xsize=400,ysize=20 $ ,value=' Enter Start Time, Format [yyyymmdd]') wlb11=widget_label(wb,xsize=400,ysize=20 $ ,value=' yyyy=year, mm=month, dd=day of month ') wt1=widget_text(wb,/editable,/frame,ysize=1,xsize=8,value=yrmmdm) wlb2=widget_label(wb,xsize=400,ysize=20 $ ,value=' Number of Days to plot') wt2=widget_text(wb,/editable,/frame,ysize=1,xsize=4,value=strtrim(noday,2)) wlb3=widget_label(wb,xsize=400,ysize=20 $ ,value='Averaging Time in Minutes ') wt3=widget_text(wb,/editable,/frame,ysize=1,xsize=5,value=strtrim(avgm,2)) ;-- wbt3=widget_button(wb,value='---no! cancel') wbt2=widget_button(wb,value='-ok-start-read-in-') widget_control,wb,/realize loop=0 while(loop eq 0)do begin ev=widget_event(wb) ;----event tracking ;-- if(ev.id eq wbt2)then begin ;-- EXIT button clicked-------- pflag=1 loop=2 ;-- widget_control,wt1,get_value=yrdat ;--- get start date if( yrdat(0) ne '' and strlen(yrdat(0)) eq 8 )then yrmmdm=yrdat(0) if( strlen(yrdat(0)) ne 8 or long(yrmmdm) lt 19951207)then begin x=widget_message('wrong start date format') loop=0 endif ;-- widget_control,wt2,get_value=nod ;--- get number of days to plot if( nod(0) ne '')then noday=long(nod(0)) ;-- widget_control,wt3,get_value=avg ;--- get desired average interval avgm=long(avg(0)) if(avg(0) eq '0')then avgm=1 ;-- endif ;--- if(ev.id eq wbt3)then begin ;-- cancel yrmmdm=savet noday=saven avgm=savea widget_control,wt1,set_value=yrmmdm ;--- reset start year ;--- reset number of days widget_control,wt2,set_value=strtrim(noday,2) ;--- reset average time period widget_control,wt3,set_value=strtrim(avgm,2) loop=2 cancel=1 endif ;--- endwhile widget_control,wb,/destroy ;--- mth='' & dm='' & yr='' reads,yrmmdm,yr,mth,dm,format='(i4,i2,i2)' jul=julday(mth,dm,yr) ; get julday for plot start cdf_epoch,epoch,yr,mth,dm,/compute_epoch ; eval int-epoch for plot start sepoch=ep_to_int(epoch) jul=jul+long(noday) ; make julday for plot end caldat,jul,emth,edm,eyr ; eval date for plot end cdf_epoch,epoch,eyr,emth,edm,/compute_epoch ; eval int-epoch for plot end cdf_epoch,epoch,eyr,emth,edm,/breakdown_epoch ; eval int-epoch for plot end eepoch=ep_to_int(epoch) !x.range=[sepoch,eepoch] !x.style=1 plt=[10,10] plttim=[sepoch,eepoch] ;-null plot-- !x.tickv(*)=0 set_plot,/copy,'null' plot,plttim,plt,xtick_get=v ;-- dummy plot !x.tickv=v ;... to get values of the ticks nel=n_elements(v) ticks=strarr(nel) for i=0,nel-1 do begin ;--then convert epoch values of ticks epo=int_to_ep(v(i)) ;--into date cdf_epoch,epo,yy,mm,dd,hh,mi,/breakdown_epoch date=string(date_to_doy(yy,mm,dd)) $ +'-'+string(hh,format='(i2.2)') $ +':'+string(mi,format='(i2.2)') ticks(i)=strcompress(date,/remove_all) endfor !x.tickname(*)='' !x.tickname=ticks set_plot,/copy,pdev return end ;=========================================================================== ;=========================================================================== pro set_newxran ;------------------------------------------------------------------------ ; simple input widget for plot time parameter ; startdate in [yymmdmhhmm] : year, month , day of month ; enddate in [yymmdmhhmm] : year, month , day of month ; ; cancel: 0= no cancel 1=cancel ;------------------------------------------------------------------------ ; --- plotparameter (to be initialized by rtn >plotcom.pro< common plotdev, pdev ;-- plot device type common plotpar, pflag $ ; pflag 0=no period set 1=period set , yrmmdm $ ; string start date: year, month , noday $ ; number of days to plot , avgm ; averageing interval in minutes common newplotpar $ , start $ ; start time of new plot , ende ; endtime of newplot x=size(start) if(x(1) eq 0)then begin ;-- compute start end date values start=yrmmdm+'0000' juld=julday(strmid(yrmmdm,4,2),strmid(yrmmdm,6,2),strmid(yrmmdm,0,4)) juld=juld+noday caldat,juld,month,day,year cend= string(year,format='(i4)') $ + string(month,format='(i2.2)') $ + string(day,format='(i2.2)') ende=strcompress(strtrim(cend)+'0000') endif cancel=0 wcnt=0 savet=yrmmdm saven=noday savea=avgm pflag=1 ;------------------------------------------------widget construct start----- wb=widget_base(/column,title=' Plot Period Settings ') wlb0=widget_label(wb,xsize=600,ysize=20 $ ,value='Default values: ',/frame) lab1=widget_label(wb,xsize=600,ysize=20,value='Start: '+yrmmdm) lab2=widget_label(wb,xsize=600,ysize=20,value='Nod: '+string(noday)) wlb1=widget_label(wb,xsize=600,ysize=20 $ ,value=' Enter Start Time, Format [yyyymmddhhmm]') wlb11=widget_label(wb,xsize=600,ysize=20 $ ,value=' yyyy=year, mm=month, dm=day of month, hh=hour,mm=minute ') wt1=widget_text(wb,/editable,/frame,ysize=1,xsize=8,value=start) wlb2=widget_label(wb,xsize=600,ysize=20 $ ,value=' Enter End Time, Format [yyyymmddhhmm]') wlb22=widget_label(wb,xsize=600,ysize=20 $ ,value=' yyyy=year, mm=month, dm=day of month, hh=hour,mm=minute ') wt2=widget_text(wb,/editable,/frame,ysize=1,xsize=8,value=ende) ;-- cancel=widget_button(wb,value='---cancel---') reset =widget_button(wb,value='---reset---') okexit=widget_button(wb,value='--ok--back--') widget_control,wb,/realize ;-----------------------------------------------------widget construct end--- ;---------------------------------------------widget loop start-------------- loop=0 while(loop eq 0)do begin wdf=0 ;-- wrong data format flag 0: ok: -1 not ok ev=widget_event(wb) if(ev.id eq okexit)then begin ;-- exit loop=2 ;-- widget_control,wt1,get_value=start ;--- get start date if( start(0) ne '' and strlen(start(0)) eq 12 )then start=start(0) if( strlen(start(0)) ne 12 or start(0) lt '199512070000')then begin x=widget_message('WRONG START DATE FORMAT !') loop=0 wdf=-1 endif ;-- widget_control,wt2,get_value=ende ;--- get number of days to plot if( ende(0) ne '' and strlen(ende(0)) eq 12 )then ende=ende(0) if( strlen(ende(0)) ne 12 or ende(0) lt '199512070000')then begin x=widget_message('WRONG END DATE FORMAT !') loop=0 wdf=-1 endif ;-- ; okexit=0 endif ;--- if(ev.id eq cancel)then begin ;-- cancel loop=2 cancel=0 endif ;--- if(ev.id eq reset)then begin ;-- reset loop=2 reset=0 endif ;--- endwhile widget_control,wb,/destroy ;--- if(wdf eq 0)then begin mth='' & dm='' & yr='' & hh='' & mm='' reads,start,yr,mth,dm,hh,mm,format='(i4,i2,i2,i2,i2)' cdf_epoch,epoch,yr,mth,dm,hh,mm,/compute_epoch ; eval epoch for plot start sepoch=ep_to_int(epoch) reads,ende,yr,mth,dm,hh,mm,format='(i4,i2,i2,i2,i2)' cdf_epoch,epoch,yr,mth,dm,hh,mm,/compute_epoch ; eval epoch for plot start eepoch=ep_to_int(epoch) !x.range=[sepoch,eepoch] !x.style=1 plttim=[sepoch,eepoch] endif ;--- if( reset eq 0)then begin ;-- set plot period to original values mth='' & dm='' & yr='' reads,yrmmdm,yr,mth,dm,format='(i4,i2,i2)' jul=julday(mth,dm,yr) ; get julday for plot start cdf_epoch,epoch,yr,mth,dm,/compute_epoch ; eval int-epoch for plot start sepoch=ep_to_int(epoch) jul=jul+long(noday) ; make julday for plot end caldat,jul,emth,edm,eyr ; eval date for plot end cdf_epoch,epoch,eyr,emth,edm,/compute_epoch ; eval int-epoch for plot end cdf_epoch,epoch,eyr,emth,edm,/breakdown_epoch ; eval int-epoch for plot end eepoch=ep_to_int(epoch) !x.range=[sepoch,eepoch] !x.style=1 plttim=[sepoch,eepoch] endif ;--- if( cancel eq 0 )then goto, bye plt=[10,10] ;-null plot-- !x.tickv(*)=0 set_plot,/copy,'null' plot,plttim,plt,xtick_get=v ;-- dummy plot !x.tickv=v ;... to get values of the ticks nel=n_elements(v) ticks=strarr(nel) for i=0,nel-1 do begin ;--then convert epoch values of ticks epo=int_to_ep(v(i)) ;--into date cdf_epoch,epo,yy,mm,dd,hh,mi,/breakdown_epoch date=string(date_to_doy(yy,mm,dd)) $ +'-'+string(hh,format='(i2.2)') $ +':'+string(mi,format='(i2.2)') ticks(i)=strcompress(date,/remove_all) endfor !x.tickname(*)='' !x.tickname=ticks set_plot,/copy,pdev bye: return end ;=========================================================================== pro set_plotwin ;---------------------------------------------------------------------- ; configueres the plot window: with the help of slider widgets ; the number of plots in x and or y direction is determined ;---------------------------------------------------------------------- ;---------------- widget construct------------------------------------- common pmulti,px,py x=size(px) if(x(1) eq 0)then px=1 ;-- initialize no plots in x-direction x=size(py) if(x(1) eq 0)then py=1 ;-- initialize no plots in y-direction wb = WIDGET_BASE(title='Set Plot-Window Configuration' $ ;create the base ,/column $ ,SPACE = 20 $ ,YPAD = 10) wt=widget_text(wb, $ value=['To config. plot window ' $ ,'move slider with mouse','into desired position'] $ ,XSIZE = 45 $ ,YSIZE = 3 ) wsl1=widget_slider(wb,minimum=0,maximum=10,title='no plots in X dir' $ ,value=px) wsl2=widget_slider(wb,minimum=0,maximum=10,title='no plots in y dir' $ ,value=py) wbt = WIDGET_BUTTON(wb, $ ;create a Done Button VALUE = "done", $ UVALUE = "EXIT") ;--------------- widget construct------------------------------------- ;--------------------------------------------------------------------- widget_control,wb,/realize loop=0 while(loop eq 0) do begin we=widget_event(wb) if(we.id eq wbt) then loop=1 ; when done button was clicked widget_control,wsl1,get_value=px widget_control,wsl2,get_value=py ; if(we.id eq wsl1)then px=we.value ; if(we.id eq wsl2)then py=we.value endwhile !p.multi=[0,px,py] ; set plotscreen division widget_control,wb,/destroy return end ;=========================================================================== ;=========================================================================== pro sum_l2,lindx,pl_tim,pl_dat,pl_kfac ;---------------------------------------------------------------------- ; L2dat={L2 $ ; , pb5:lonarr(3) $ ; year [yyyy], doy [ddd], ms of day [ss sss sss] ; , epoch:0.d $ ; ms sinc ad ; , stat:lonarr(2) $ ; EPHIN status information ; ,intst:fltarr(13) $ ; intensity of coincidence channel ; ,cnts:lonarr(28) $ ; counts of coincidence channels ; ,tbd:lonarr(4) } ; spare ; ; lindx : pointer to L2 data, cnts and intensities ; pl_dat : averaged plot data ;---------------------------------------------------------------------- common initsum, sinit ;-- start-of-summing-up flag common plotpar, pflag $ ;-- 0=no period set 1=period set , yrmmdm $ ;-- string start date: year, month , noday $ ;-- number of days to plot , avgm ;-- averageing interval in minutes common readpar , in_file $ ;-- input file names , fptr $ ;-- pointer to in_file , eof $ ;-- End-of-File flag , ostat ;-- file open status nex=n_elements(lindx) ;-- number of channel to plot if(avgm eq 0)then begin ;-- no summing up, full resolution ; call readf_l2,L2dat endif else begin ix=size(sinit) ;-- initialize start of summing up if(ix(1) eq 0)then sinit=0 ;--init summings if(sinit eq 0)then begin ;--find first intervaltime posflag=0 ;-- file position flag ;.. 0=read from actual position ;.. 1=read from preceding position fptr=0 eof=-1 nint=(noday*1440)/avgm ;--number of intervals if(((noday*1440)/avgm) ne 0)then nint=nint+1 pl_tim=fltarr(nint) ;--init plot time array pl_dat=fltarr(nint,nex) ;--init plot data array pl_kfac=fltarr(nint,nex,4) ;-- kor fac arr reads,yrmmdm,syr,smm,sdm,format='(i4,i2,i2)' ;--split up start date cdf_epoch,sepoch,syr,smm,sdm,0,0,/compute_epoch ;--intvl start in epoch eepoch=sepoch+avgm*60000 ;--intvl end in epoch mepoch=sepoch+(avgm*30000) ;--mid of interval jul=julday(smm,sdm,syr)+noday ;-- get julday for final plot time caldat,jul,fmm,fdm,fyr ;-- eval date for final plot time cdf_epoch,fepoch,fyr,fmm,fdm,0,0,/compute_epoch ;-- final epoch ;---print,'first int: ',epoch_print(sepoch),' - ',epoch_print(eepoch) endif ;--init summings --end-- for i=0,nint-1 do begin ;-- all-interval loop------------------------- loop=0 ;-- interval time loop switch intcnt=0 ;-- count number of elements in intcl kintcnt=0 ;--interval fill loop pl_dat(i,*)=0. ;-- init pl_dat while(loop eq 0) do begin ;-- read input until interval is full loopl=0 while(loopl eq 0) do begin ;-- read input file until time fits loopl=1 readr_l2,posflag,l2dat,l2nam ;-- read 1 set of L2 data from *.RL2 if(ostat eq -1) then begin msx=widget_message(['Error opening input file', in_file(fptr) $ ,'----File path wrong???----']) goto,enderr endif posflag=0 ;-- next read from actual file position if(l2dat.epoch le sepoch)then loopl=0 ;proceed until start epoch if(ostat eq -2)then loopl=1 ;-- ostat-2: end of last file endwhile if((l2dat.epoch gt sepoch) and (L2dat.epoch le eepoch) $ and (L2dat.epoch le fepoch)) then begin ;-- data in good time interval, --summing up readko_l2,l2dat.epoch,lindx,l2nam,kofac ;--get correction factors intcnt=intcnt+1 ;-- count number of elements per intvl ktot=total(kofac) if(ktot ge 0)then kintcnt=kintcnt+1 for j=0,nex-1 do begin ;-- get L2 data, shift them to helpbuff if(lindx(j) gt 12)then begin ;-- no intensities but counts ix=lindx(j)-13 ;-- index correction for the counts pl_dat(i,j)=pl_dat(i,j)+float( L2dat.cnts(ix)) endif else begin ;-- index f. intensities directly taken if(lindx(j) ge 4 and lindx(j) le 11) then begin if(ktot ge 0)then begin pl_dat(i,j)=pl_dat(i,j)+L2dat.intst(lindx(j)) ;--corr channels pl_kfac(i,j,0)=1 pl_kfac(i,j,1)=pl_kfac(i,j,1)+kofac(1,lindx(j)) pl_kfac(i,j,2)=pl_kfac(i,j,2)+kofac(2,lindx(j)) pl_kfac(i,j,3)=pl_kfac(i,j,3)+kofac(3,lindx(j)) endif endif else pl_dat(i,j)=pl_dat(i,j)+L2dat.intst(lindx(j)) ;--E & INT endelse endfor ;-- help-buf shift loop (loop counter=j) endif else begin ;-- L2 time fits into intvl or not for j=0,nex-1 do begin ;-- if(lindx(j) gt 11 or lindx(j) lt 4 )then begin if(intcnt gt 0)then begin pl_dat(i,j)=pl_dat(i,j)/intcnt pl_kfac(i,j,*)=1. endif else pl_dat(i,j)=-707. endif if(lindx(j) ge 4 and lindx(j) le 11 )then begin if(kintcnt gt 0)then begin pl_dat(i,j)=pl_dat(i,j)/kintcnt pl_kfac(i,j,1)=pl_kfac(i,j,1)/kintcnt pl_kfac(i,j,2)=pl_kfac(i,j,2)/kintcnt pl_kfac(i,j,3)=pl_kfac(i,j,3)/kintcnt endif else pl_dat(i,j)=-707. endif endfor loop=1 ;--start next interval posflag=1 ;--next read from preceding record mepoch=sepoch+avgm*30000. pl_tim(i)=ep_to_int(mepoch) ;-- get epoch, convert it to flt*4 sepoch=eepoch ;--set new intvl times eepoch=sepoch+avgm*60000. ;----print,epoch_print(mepoch),' mitte' endelse ;-- new input data fit/ fit not into interval if(ostat eq -2)then loop=1 ;-- ostat-2: end of last file endwhile ;-- fill-intervall loop )loop switch = >loop< endfor ;-- all-interval loop (loop counter =i) endelse enderr: return end ;=========================================================================== ;=========================================================================== pro main device,decomposed=0 ; l2plot is written for standard PseudoColor displays (e.g. DEC, Notebook) ; this command allows use of TrueColor displays (e.g. PC) without modification plotcom ;----------------------------program version number---------------------- ;log_set,0 ;--set file paths for in- and output findpathl2,0 common filepath, inpath, outpath datedefault l2labcom xpscom syscom common l2lab, l2label ;-- Label array (41) common version ,vers common filepath, inpath, outpath ;-- in and output-file paths readl2com common readpar, in_file,fptr,eof,ostat,fpos ;-- all file info common plotpar, pflag $ ;-- 0=no period set 1=period set , yrmmdm $ ;-- string start date: year, month , noday $ ;-- number of days to plot , avgm ;-- averageing interval in minutes lindx=-1 ;--init index array (pointer) for L2label ;--L2 rate structure---------------------------- L2dat={L2 $ , pb5:lonarr(3) $ ; year [yyyy], doy [ddd], ms of day [ss sss sss] , epoch:0.d $ ; ms sinc ad , stat:lonarr(2) $ ; EPHIN status information ,intst:fltarr(13) $ ; intensity of coincidence channel ,cnts:lonarr(28) $ ; counts of coincidence channels ,tbd:lonarr(4) } ; spare ; --- plotparameter---(init in plotcom.pro)------------------------------------ ;--------------------------------------------------------- ;---input file selection & input number of days to convert ;--------------------------------------------------------- wb=widget_base(/column, title='EPHIN Level-2 Main Menu, Version: '+VERS) wt01=widget_text(wb,value=' Welcome to SOHO-EPHIN L-2-plotter ' $ ,ysize=1,xsize=50) wt02=widget_text(wb,value=' select channel (click) ' $ +' unselect channel' $ ,ysize=1,xsize=50 ) varnam=['click on', 'left list', 'to', 'select' $ ,'plotchannel', '(maximal', '8', 'channel permitted)'] wb1=widget_base(wb,/row) wld=widget_list(wb1,value=L2label,scr_xsize=300,scr_ysize=200) wlv=widget_list(wb1,value=varnam,scr_xsize=300,scr_ysize=200) wlab=widget_label(wb,value='! Select channel first, then start read in !' $ ,xsize=330,ysize=25) plr=widget_button(wb,value='-Plot Period Selection & Start Read In -') plo=widget_button(wb,value= '----Restart Plot Menu---- ',/frame) ler=widget_button(wb,value ='------------------------- ') pathf=widget_button(wb,value='-- Set in/output paths -- ') wlab1=widget_label(wb,value='Actual Input Path: '+inpath(0), $ xsize=400,ysize=20,/frame) wlab2=widget_label(wb,value='Actual Output Path: '+outpath(0), $ xsize=400,ysize=20,/frame) don=widget_button(wb,value='-----EXIT SOHO L2-PLOTTER----- ',/frame) widget_control,wb,/realize ;;========================================================widget loop========= loop=0 while (loop eq 0) do begin ;lindx=-1 ;-- reset labelpointer for labelarray L2label ;------------------ ev=widget_event(wb) ;=== event polling of widget construct ;------------------ ;============================================================================== if(ev.id eq wld)then begin ;-- select channel-widget_list xs=size(chlab) ;-- if chlab not defined yet if(xs(1) eq 0)then begin chlab=L2label(ev.index) ;--define chlab endif else begin chlab=[chlab,L2label(ev.index)] ;--concat chlab indx=where(chlab eq '-',cntX) if(cntX gt 0)then begin chlab=shift(chlab,-1) ;--shift all '-' out chlab=chlab(0:n_elements(chlab)-2) endif if(n_elements(chlab) gt 8)then begin ;--reduce size to 8 elements chlab=shift(chlab,-1) chlab=chlab(0:7) endif endelse widget_control,wlv,set_value=chlab endif ;============================================================================== if(ev.id eq wlv)then begin ;-- unselect channel choice chlab(ev.index)='delete' ;-- flag label indx=where(chlab ne 'delete') if(indx(0) eq -1)then begin chlab='-' endif else begin chlab=chlab(indx) ;-- shrink chlab to kick endelse ;.. unselected channels out widget_control,wlv,set_value=chlab endif ;============================================================================== if(ev.id eq plr)then begin ;---read in data, set plotrange --- set_plotrange,cancel ;--return yrmmdm, noday, avgm ;..in common plotpar if(cancel eq 0) then begin ;---input file selection & input number of days to convert L2_nam=findfile(strcompress(inpath,/remove_all)+'EP*.RL2',count=cnt) ; L2 input file names if(cnt eq 0)then L2_nam=findfile(strcompress(inpath,/remove_all)+'ep*.rl2') ; L2 input file names neln=n_elements(L2_nam) L2_nam=L2_nam(sort(L2_nam)) ; sort filenames using ASCII collating sequence ; no effect when reading from VMS or MS Windows disks, but needed for reading from Asterix file server fidat='0' yr=0l & mm=0 & dm=0 reads,yrmmdm,yr,mm,dm,format='(i4,2i2)' ;-- eval doy from first day to plot doy=date_to_doy(yr,mm,dm) doy=string(doy,format='(i3.3)') fidoy=strmid(strtrim(yr,2),2,2)+doy findx=where(strpos(L2_nam,fidoy) gt 0 ) ;-- then look for input files if(findx(0) eq -1)then begin ixm=widget_message(['No file found with this id: ',fidoy ]) in_file=' ' endif else begin if(findx(0)+noday gt neln)then begin noday=neln-findx(0) L2_nam=L2_nam(findx(0):findx(0)+(noday-1)) ;-- truncate L2_filename array xw=widget_message('Number of days reduced to: '+string(noday)) endif else L2_nam=L2_nam(findx(0):findx(0)+(noday-1)) in_file=l2_nam for i=0,n_elements(chlab)-1 do begin ;-- get index of selected channels indx=where(chlab(i) eq L2label,cntX) ;-- identify index by its label if(cntX gt 0)then begin ;--if label found save total index if(lindx(0) eq -1)then begin ;-- init pointer (see rtn start) lindx=indx(0) endif else begin lindx=[lindx,indx(0)] ;-- concat channel pointer endelse endif endfor if(lindx(0) eq -1)then begin ;-- no channels selected ==> warning msgx=widget_message('You must select a channel first') endif else begin ;-- start reading in wbn=widget_base(title='*** Wait Window *** Wait Window ***') wbnt=widget_text(wbn,xsize=60,ysize=5 $ ,value=['>>>',' >>>' $ ,' >>>>>> Please wait, data read-in started<<<<<' $ ,' ',' ! ! ! This window disappears when read-in is finished ! ! ']) widget_control,wbn,/realize sum_l2,lindx,pl_tim,pl_dat,pl_kfac ;-- read and sum up data widget_control,wbn,/destroy ;================================================================== ;if(ev.id eq plo)then begin ;-----PLOT-menu-WIDGET----- ' if(pflag eq 1)then begin widget_control,wb,iconify=1 plot_menl2,lindx,pl_tim,pl_dat,pl_kfac widget_control,wb,iconify=0 lindx=[-1,lindx] endif else begin mx=widget_message(['You must first select channels (click left list)' $ ,'and read in the data']) endelse ;endif endelse ;-- no channel selected endelse ;-- no file with desired id endif ;--cancel endif ;================================================================== if(ev.id eq plo)then begin ;-----PLOT-menu-WIDGET----- ' if(pflag eq 1)then begin widget_control,wb,iconify=1 plot_menl2,lindx,pl_tim,pl_dat,pl_kfac widget_control,wb,iconify=0 lindx=[-1,lindx] endif else begin mx=widget_message(['You must first select channels (click left list)' $ ,'and read in the data']) endelse endif ;============================================================================== if(ev.id eq don) then begin ;--widget_button-EXIT CDFPLOTTER----- ' loop=1 widget_control,wb,/destroy endif ;============================================================================== if(ev.id eq pathf) then begin ;--widget_button- input/output file path ; log_set,1 findpathl2,1 datedefault widget_control,wlab1,set_value='Actual Input Path: '+inpath(0) widget_control,wlab2,set_value='Actual Output Path: '+outpath(0) endif ;======================================================================== endwhile nixda: wdelete end ;=========================================================================== ;===========================================================================