function create_vis_singleton1, n, $ ENERGY_BAND=energy_band, $ DET_INDEX_MASK=det_index_mask, $ USE_FLUX_VAR=use_flux_var, $ FNAME=fname,$ PARAMS=params, $ VIS_PLOTFIT=vis_plotfit,$ NROLL=nroll ; ; converted from script to function --ejs jan 04/06 ; adapted from create_vis_ejs.pro for single-component culled flares dec 12/07 ; INPUTS: ; n = single integer index of singleton flare list ; ; OUTPUTS: ; visibility for the selected flare, with parameters as selected via keywords ; ; Revised vis_test to use RS objectification of visibility generation ; ; 26-Jul-05 gh Initial version ; 4-Aug-05 gh Multiple changes to support software testing. ; 5-Aug-05 gh Correct output to pa = 270-roll-gridorientation ; Suppress detector 2 ; 2005-aug-09 ejs Modifications of event parameters ; 2007-dec-12 ejs Added use_flux_var and phz_radius, deleted use of nroll due to use of phz_radius ; 2008-feb-25 ejs Added energy_band keyword ; 2008-mar-18 ejs Added det_index_mask, use_flux_var keywords ; 2008-apr-09 ejs Added params keyword to enable output structure showing keyword values ; Added VIS_PLOTFIT keyword to create ps file of sinusoidal fits to stack ; for use with post-impulsive singleton_times1 ; 2008-sep-06 ejs Implemented user-controlled NROLL array ; 2008-sep-22 ejs Added keywords used in Kim's Gui output script ; RESTRICTIONS: ; for USE_FLUX_VAR keyword to operate, you must have Richard's Feb-2008 hsi_vis_gen.pro and ; hsi_visibility_fit.pro in your path. default,energy_band,[20,30] default,USE_FLUX_VAR,1 default,det_index_mask, [0,0,1, 1,1,1, 1,1,1] default,nroll, [48L, 48L, 48L, 42L, 36L, 30L, 24L, 18L, 12L] default, VIS_PLOTFIT, 1 chk_hessidata ; checks that the hessidata disk is mounted. If it isn't, stops with warning message. singleton_times1,time_intervals,id_number,xyoffset ; use the nth value of the lists returned by above command ; 08-apr-08 ejs Corrected error in xyoffset1 time_range=time_intervals[*,n] & print,anytim(time_range,/ecs) id_number1=id_number[n] & print,'id_number=',id_number1 xyoffset1=xyoffset[*,n] & print,'xyoffset=',xyoffset1 print print,'time range=',time_range,' xyoffset1=',xyoffset1 print ; energy_band=fix(energy_band) time0 = time2file(atime((time_range)[0]),/sec) ; Sam Freeland's program time2file fname='VISz'+time0+'E'+strcompress(energy_band[0],/rem)+'-'+strcompress(energy_band[1],/rem)+'.sav' print,'fname=',fname PHZ_RADIUS=20 ; phz_radius may not do anything useful for single sources message,'COMPUTING VISIBILITIES USING O-O METHODS',/info o = hsi_image() o->set, vis_time_int = time_range, det_index_mask = det_index_mask, energy_band = energy_band o->set, xyoffset = xyoffset1, phz_radius=phz_radius, use_flux_var=use_flux_var o->set, phz_n_roll_bins_control = LONARR(9)+nroll o->set, cbe_digital_quality = 0.95 o->set, phz_report_roll_bins = 1 o->set, vis_plotfit=vis_plot_fit ;Added the following that were set in script produced by gui: o-> set, uniform_weighting= 0 o-> set, use_auto_time_bin= 1L o-> set, use_cull= 1 o-> set, use_flare_xyoffset= 0 ; use our own xyoffset, not the flare catalog one o-> set, use_local_average= 0B o-> set, use_rate= 1 o-> set, use_phz_stacker= 1L o-> set, phz_n_phase_bins= 12L o-> set, phz_n_roll_bins_min= [12L, 12L, 12L, 12L, 12L, 12L, 12L, 6L, 4L] o-> set, phz_n_roll_bins_max= [64L, 64L, 64L, 64L, 64L, 64L, 64L, 64L, 64L] vis_oo = o->getdata(class='hsi_visibility') help,vis_oo,/st if n_elements(params) ne 0 then begin params=o->get(/all) print,'params.vis_plotfit=',params.vis_plotfit endif return,vis_oo end ; SCRIPT TO BE EXECUTED BY .RUN create_vis_singleton1 det_index_mask=replicate(1,9) ; all 9 grid pairs ; det_index_mask=[0,0,1,1,1,1,1,1,1] ; only 7 grid pairs for e=0,2 do begin energy_band = [12.,15.] if e eq 1 then energy_band = [15.,20.] if e eq 2 then energy_band = [20.,30.] ; nn=[0,15,16, 19,18,14, 9,7,5, 16,27] ; nn=[8,31,19] ; ; date=[21025,20929,50516] ; nn=[ 00, 05, 06, 07, 09, 15, 16, 18, 19, 08, 27] ; compact srcs ; date=[20410,20816,20929,21003,21202,40713,40417,50116, 50516,21025,20910] ; nn=[27,07,00] ; date=[20910,21003,20410] ; nn=[08] & date=[21025] ; nn=[09] ; date=[21003] ; nn=[07] date=[20410] ; nn=[00] ; date=[40713] & nn=[15] ; date=[21202] ; nn=[09] ; date=[40717] & nn=[16] ; date=[20816] & nn=[05] ; nn=[25] & date=[20317] ; nn=[07] & date=[21003] ; nn=[29] & date=[31222] ; nn=[21,29] & date=[50912,31222] ; nn = [21] & date=[50912] ; nn=[13,17,23] & date=[31219,41022,50916] ; nn=[12] & date=[31119] ; nn=[12,13,17,23] & date=[31119,31219,41022,50916] ; nn=[11] & date=[31118] ; nn = [02] & date=[20601] ; nn=[08] & date=[21025] ;nn=[05,06,09,11,18,19] ;date=[20816,20929,21202,31118,50116,50516] ;nroll=[48,48,48,42,36,30,24,18,12] & nrollx= 'nrolla' ; 4.8% outliers for flare 30 ;nroll=[64,64,60, 52,44,36, 28,20,12] & nrollx= 'nrollb' ; 6.5% outliers for flare 30 ;nroll=[48,48,40,36,32,28,20,16,12] & nrollx= 'nrollc' ; 5.5% outliers for flare 30 ;nroll=0 & nrollx='nroll0' ;nroll=[44,40,36,32,28,24,20,8,6,4] & nrollx='nrolld'; after trials with gui -> gives chisq=2.18 in vff, 1 circle ;nroll=[30,30,30,30,30,28,20,16,12] & nrollx='nrolle' ; date = [21004] & nn = [22] ; nroll=[30,30,30,30,28,20,8,6,4] & nrollx='nrollg' ; nn=[02] & date=[20601] nn=[00] & date=[20410] nroll= [30, 30, 30, 30, 28, 20, 12, 10, 6] & nrollx='nrollf' nel=n_elements(nn) fname=' ' ; fname is created by create_vis_singleton1 params=1 ratio_bad=1.0 ; the limit above which vis are deemed not to have good quality for j=0,nel-1 do begin print,'Creating vis for nn[j]=',nn[j],' date=',date[j] vis=create_vis_singleton1(nn[j],ENERGY_BAND=energy_band,FNAME=fname,PARAMS=params,nroll=nroll,$ DET_INDEX_MASK=det_index_mask) n_outliers= qual_measure(vis,nzero,mea_sig2amp,std_sig2amp,w_firsthzero,$ ratio_bad=ratio_bad) print,'Saving '+ nrollx+fname save,vis,nroll,n_outliers,nzero,mea_sig2amp,std_sig2amp,w_firsthzero,ratio_bad,$ file=nrollx+'D3-9'+fname,/ver print,'Check for new visfit plot file.' stop endfor endfor ; e end