pro scf0process common scf0_block,file1,mn,disp,s2nm,scfmod,signal,xhist,histn,$ file2,file3,file4,file5,thresh,scfmod1,s2nm1 common dev_block common GUI_BLOCK top=widget_base(/column,title='SCF0 Analysis Window',xoffset=100,yoffset=600) go=widget_button(top,value='Analyze SCF Data for Normal Cube',$ uvalue=2) go2=widget_button(top,value='Analyze SCF Data for Randomized Cube',$ uvalue=7) middle=widget_base(top,/row) mn=cw_field(middle,title='Mean Value of SCF:',value=0.) disp=cw_field(middle,title='Disperision:',value=0.) high=widget_base(top,/row) exp=widget_button(high,$ value='Export All Plots to Postscript',$ uvalue=3) file1=cw_field(high,title='Export File Name:',$ value='scf0.graphs.ps') low1=widget_base(top,/row) exp1=widget_button(low1,$ value='Export Non-normalized SCF Plot',$ uvalue=4) file2=cw_field(low1,title='Export File Name:',$ value='scf0.graph1.ps') low2=widget_base(top,/row) exp1=widget_button(low2,value='Export SCF Histogram',$ uvalue=5) file3=cw_field(low2,title='Export File Name:',$ value='scf0.graph2.ps') low3=widget_base(top,/row) exp1=widget_button(low3,value='Export Normalized SCF Plot',$ uvalue=6) file4=cw_field(low3,title='Export File Name:',$ value='scf0.graph3.ps') low4=widget_base(top,/row) exp1=widget_button(low4,value='Export Renormalized SCF Maps',$ uvalue=8) file5=cw_field(low4,title='Export File Name:',$ value='scf0.maps.ps') sets=widget_button(top,value='Renormalize the SCF values.',uvalue=9) thresh=cw_field(top,title='Threshold value for Modified S/N: ',$ value=2.) done=widget_button(top,value='Done.',uvalue=1) widget_control,/realize,top xmanager, 'scf0process', top end ;----------------------- pro scf0process_event,event common scf0_block common dev_block common GUI_BLOCK widget_control, event.id, get_uvalue=buttonpress widget_control,thresh,get_value=s2nth s2nth=s2nth(0) if (buttonpress eq 1) then begin wdelete,0 wdelete,1 wdelete,2 widget_control, event.top, /destroy endif if (buttonpress eq 2) then begin analyze: window,0 window,1 if progress(5) eq 1. then goto,renormed signal=outdata(*,*,7) if total(signal ne 99999.0) eq 0 then begin xyouts,0.2,0.5,'No Valid SCF Data',/normal,charsize=2 goto,skippy endif s2nm=outdata(*,*,13) s2nm(where(signal eq 99999.0))=99999.0 wset,0 plot,s2nm,signal,psym=3,yrange=[0,1],xrange=[0,20],$ xtitle='Modified S/N', ytitle='S!I0!N Value',$ title='Non-normalized relation between SCF and S/N' x=findgen(400)/10+0.1 oplot,x,1-1/x scfmod=signal/(1.-1./s2nm) if total(where(s2nm lt s2nth)) ne -1 then $ scfmod(where(s2nm lt s2nth))=99999.0 renormed: data=scfmod(where(finite(scfmod) eq 1)) if total(where(data le 99998.0) ne -1) then $ data=data(where(data le 99998.0)) mom=moment(data(where(data le 10))) histn=histarray(data,pmin=0.,pmax=2.,x=xhist) histn=float(histn)/total(histn) wset,1 plot,xhist,histn,psym=10,xtitle='Renomalized Value of S!I0!N',$ ytitle='Fraction of Data',$ title='Normalized Histogram of S!I0!N Values' widget_control,mn,set_value=mom(0) widget_control,disp,set_value=sqrt(mom(1)) window,2 wset,2 plot,s2nm,scfmod,psym=3,yrange=[0,2],xrange=[0,20],$ xtitle='Modified S/N', ytitle='Normalized S!I0!N Value',$ title='Normalized relation between SCF and S/N' oplot,findgen(40),replicate(1.,40),linestyle=2 if n_elements(flag1) eq 0 then flag1=0 if flag1 eq 1 then goto,ret skippy: endif if (buttonpress eq 3) then begin if n_elements(scfmod) eq 0 then begin flag1=1 goto,analyze ret: endif widget_control,file1,get_value=filnom set_plot,'ps' device,file=filnom(0) plot,s2nm,signal,psym=3,yrange=[0,1],xrange=[0,20],$ xtitle='Modified S/N', ytitle='S!I0!N Value',$ title='Non-normalized relation between SCF and S/N' x=findgen(400)/10+0.1 oplot,x,1-1/x erase plot,xhist,histn,psym=10,xtitle='Renomalized Value of S!I0!N',$ ytitle='Fraction of Data',$ title='Normalized Histogram of S!I0!N Values' erase plot,s2nm,scfmod,psym=3,yrange=[0,2],xrange=[0,20],$ xtitle='Modified S/N', ytitle='Normalized S!I0!N Value',$ title='Normalized relation between SCF and S/N' oplot,findgen(40),replicate(1.,40),linestyle=2 device,/close set_plot,'x' done=widget_message('File Exported to '+filnom(0)) endif if (buttonpress eq 4) then begin if n_elements(scfmod) eq 0 then begin neh1=widget_message('Please Analyze Data First.') goto,skipout4 endif widget_control,file2,get_value=filnom set_plot,'ps' device,file=filnom(0) plot,s2nm,signal,psym=3,yrange=[0,1],xrange=[0,20],$ xtitle='Modified S/N', ytitle='S!I0!N Value',$ title='Non-normalized relation between SCF and S/N' x=findgen(400)/10+0.1 oplot,x,1-1/x device,/close set_plot,'x' done=widget_message('File Exported to '+filnom(0)) skipout4: endif if (buttonpress eq 5) then begin if n_elements(scfmod) eq 0 then begin neh2=widget_message('Please Analyze Data First.') goto,skipout5 endif widget_control,file3,get_value=filnom set_plot,'ps' device,file=filnom(0) plot,xhist,histn,psym=10,xtitle='Renomalized Value of S!I0!N',$ ytitle='Fraction of Data',$ title='Normalized Histogram of S!I0!N Values' device,/close set_plot,'x' done=widget_message('File Exported to '+filnom(0)) skipout5: endif if (buttonpress eq 6) then begin if n_elements(scfmod) eq 0 then begin neh3=widget_message('Please Analyze Data First.') goto,skipout6 endif widget_control,file4,get_value=filnom set_plot,'ps' device,file=filnom(0) plot,s2nm,scfmod,psym=3,yrange=[0,2],xrange=[0,20],$ xtitle='Modified S/N', ytitle='Normalized S!I0!N Value',$ title='Normalized relation between SCF and S/N' oplot,findgen(40),replicate(1.,40),linestyle=2 device,/close set_plot,'x' done=widget_message('File Exported to '+filnom(0)) skipout6: endif if (buttonpress eq 7) then begin if n_elements(outdata1) eq 0 then begin arg=widget_message('No Randomized Data Loaded.') goto,skipout7 endif window,0 window,1 if progress(5) eq 1 then goto,renormed1 signal1=outdata1(*,*,7) if total(signal1 ne 99999.0) eq 0 then begin xyouts,0.2,0.5,'No Valid SCF Data',/normal,charsize=2 goto,skipout7 endif s2nm1=outdata1(*,*,13) s2nm1(where(signal1 eq 99999.0))=99999.0 wset,0 plot,s2nm1,signal1,psym=3,yrange=[0,1],xrange=[0,20],$ xtitle='Modified S/N', ytitle='S!I0!N Value',$ title='Non-normalized relation between SCF and S/N' x=findgen(400)/10+0.1 oplot,x,1-1/x scfmod1=signal1/(1.-1./s2nm1) if total(where(s2nm1 lt s2nth)) ne -1 then $ scfmod1(where(s2nm1 lt s2nth))=99999.0 renormed1: data=scfmod1(where(finite(scfmod1) eq 1)) if total(where(data le 99998.0) ne -1) then $ data=data(where(data le 99998.0)) mom=moment(data(where(data le 10))) histn=histarray(data,pmin=0.,pmax=2.,x=xhist) histn=float(histn)/total(histn) wset,1 plot,xhist,histn,psym=10,xtitle='Renomalized Value of S!I0!N',$ ytitle='Fraction of Data',$ title='Normalized Histogram of S!I0!N Values' widget_control,mn,set_value=mom(0) widget_control,disp,set_value=sqrt(mom(1)) window,2 wset,2 plot,s2nm1,scfmod1,psym=3,yrange=[0,2],xrange=[0,20],$ xtitle='Modified S/N', ytitle='Normalized S!I0!N Value',$ title='Normalized relation between SCF and S/N' oplot,findgen(40),replicate(1.,40),linestyle=2 skipout7: endif if (buttonpress eq 8) then begin if n_elements(scfmod) eq 0 then begin neh3=widget_message('Please Analyze Data First.') goto,skipout8 endif widget_control,file5,get_value=filnom widget_control,/hourglass scfmod(where(s2nm le 2.))=99999.0 scfmod(where(scfmod ge 10.))=99999.0 holdata=outdata(*,*,7) outdata(*,*,7)=scfmod selplot,filnom(0),outdata,[7,8,9,10],nplots=2 outdata(*,*,7)=holdata fin=widget_message('Maps exported to file '+filnom(0)) skipout8: endif if (buttonpress eq 9) then begin if progress(5) eq 1. then goto,skipout9 warned=widget_message(['Warning: This process replaces the data',$ 'in the output data file with the renormalized values.',$ 'This allows you to make plots with these new values.',$ 'Points below the threshold signal-to-noise are rejected.',$ 'You must reload the data cube to recove the old values.',$ 'Would you like to proceed?'], /question) if warned eq 'No' then goto,skipout9 if n_elements(scfmod) eq 0 then begin signal=outdata(*,*,7) s2nm=outdata(*,*,13) s2nm(where(signal eq 99999.0))=99999.0 scfmod=signal/(1.-1./s2nm) if total(where(s2nm lt s2nth)) ne -1 then $ scfmod(where(s2nm lt s2nth))=99999.0 endif if total(where(scfmod gt 10.)) ne -1 then $ scfmod(where(scfmod gt 10.))=99999.0 outdata(*,*,7)=scfmod if n_elements(outdata1) eq 0 then goto,skipout9 signal1=outdata1(*,*,7) s2nm1=outdata1(*,*,13) s2nm1(where(signal1 eq 99999.0))=99999.0 scfmod1=signal1/(1.-1./s2nm1) if total(where(scfmod1 gt 10.)) ne -1 then $ scfmod1(where(scfmod1 gt 10.))=99999.0 if total(where(s2nm1 lt s2nth)) ne -1 then $ scfmod1(where(s2nm1 lt s2nth))=99999.0 outdata1(*,*,7)=scfmod1 progress(5)=1. skipout9: endif return end