PRO cip_letg_prune ;+ ; This procedure reads in the grating efficiency files and ; "prunes" them and writes them back out... with a type of "greffprXXX" ; See also cip_hetg_prune.pro ; ; 7/16/99 dd Pruning the N0003 efficiencies. Modified the code ; to be more general too. ;- ver_str = 'N0003' acurs = [0.001, 0.005, 0.020] acstrs = ['001', '005', '020'] ; Read in the shell effics and headers lmp1 = rdb_read(!DDLETGCAL+'/cip/letgmp1D1996-11-01greff'+ver_str+'.rdb', $ HEADER=hdr1) lmp3 = rdb_read(!DDLETGCAL+'/cip/letgmp3D1996-11-01greff'+ver_str+'.rdb', $ HEADER=hdr3) lmp4 = rdb_read(!DDLETGCAL+'/cip/letgmp4D1996-11-01greff'+ver_str+'.rdb', $ HEADER=hdr4) lmp6 = rdb_read(!DDLETGCAL+'/cip/letgmp6D1996-11-01greff'+ver_str+'.rdb', $ HEADER=hdr6) LETG = rdb_read(!DDLETGCAL+'/cip/letgD1996-11-01greff'+ver_str+'.rdb', $ HEADER=hdrLETG) ; and the ERRORs lmp1e = rdb_read(!DDLETGCAL+'/cip/letgmp1D1996-11-01grerr'+ver_str+'.rdb', $ HEADER=hdr1e) lmp3e = rdb_read(!DDLETGCAL+'/cip/letgmp3D1996-11-01grerr'+ver_str+'.rdb', $ HEADER=hdr3e) lmp4e = rdb_read(!DDLETGCAL+'/cip/letgmp4D1996-11-01grerr'+ver_str+'.rdb', $ HEADER=hdr4e) lmp6e = rdb_read(!DDLETGCAL+'/cip/letgmp6D1996-11-01grerr'+ver_str+'.rdb', $ HEADER=hdr6e) LETGe = rdb_read(!DDLETGCAL+'/cip/letgD1996-11-01grerr'+ver_str+'.rdb', $ HEADER=hdrLETGe) ; Put all the products on one grid... Do zero and first-orders ; and a second order: ys = [ [lmp1.op1], [lmp1.oz], $ [lmp3.op1], [lmp3.oz], $ [lmp4.op1], [lmp4.oz], $ [lmp6.op1], [lmp6.oz], $ [LETG.op1], [LETG.oz], [LETG.op2] ] ; Loop over the desired accuracies to output for iac = 0, n_elements(acurs)-1 do begin ; - - - - - - - - - - - - - - - - - - - - - - - ; Prune them... accuracy = acurs(iac) ; relative accuracy acstr = acstrs(iac) ; accuracy string ; Find the set of X values... ; use the same accuracy for them all ysize = SIZE(ys) as = accuracy* (1.0+FLTARR(ysize(2))) ; Find the needed xs... xs_needed = interp_pruned_x(lmp1.energy, ys, as ) ; Write out the pruned files hdr = ['# written by cip_prune.pro, '+SYSTIME(), $ '# pruned to accuracy = '+STRCOMPRESS(accuracy), $ '#', $ hdr1] rdb_write, !DDLETGCAL+'/cip/letgmp1D1996-11-01greffpr'+acstr+ver_str+'.rdb', $ lmp1(xs_needed), $ HEADER = hdr hdr = ['# written by cip_prune.pro, '+SYSTIME(), $ '# pruned to accuracy = '+STRCOMPRESS(accuracy), $ '#', $ hdr3] rdb_write, !DDLETGCAL+'/cip/letgmp3D1996-11-01greffpr'+acstr+ver_str+'.rdb', $ lmp3(xs_needed), $ HEADER = hdr hdr = ['# written by cip_prune.pro, '+SYSTIME(), $ '# pruned to accuracy = '+STRCOMPRESS(accuracy), $ '#', $ hdr4] rdb_write, !DDLETGCAL+'/cip/letgmp4D1996-11-01greffpr'+acstr+ver_str+'.rdb', $ lmp4(xs_needed), $ HEADER = hdr hdr = ['# written by cip_prune.pro, '+SYSTIME(), $ '# pruned to accuracy = '+STRCOMPRESS(accuracy), $ '#', $ hdr6] rdb_write, !DDLETGCAL+'/cip/letgmp6D1996-11-01greffpr'+acstr+ver_str+'.rdb', $ lmp6(xs_needed), $ HEADER = hdr hdr = ['# written by cip_prune.pro, '+SYSTIME(), $ '# pruned to accuracy = '+STRCOMPRESS(accuracy), $ '#', $ hdrLETG] rdb_write, !DDLETGCAL+'/cip/letgD1996-11-01greffpr'+acstr+ver_str+'.rdb', $ LETG(xs_needed), $ HEADER = hdr ; and the ERRORs hdr = ['# written by cip_prune.pro, '+SYSTIME(), $ '# pruned to accuracy = '+STRCOMPRESS(accuracy), $ '#', $ hdr1e] rdb_write, !DDLETGCAL+'/cip/letgmp1D1996-11-01grerrpr'+acstr+ver_str+'.rdb', $ lmp1e(xs_needed), $ HEADER = hdr hdr = ['# written by cip_prune.pro, '+SYSTIME(), $ '# pruned to accuracy = '+STRCOMPRESS(accuracy), $ '#', $ hdr3e] rdb_write, !DDLETGCAL+'/cip/letgmp3D1996-11-01grerrpr'+acstr+ver_str+'.rdb', $ lmp3e(xs_needed), $ HEADER = hdr hdr = ['# written by cip_prune.pro, '+SYSTIME(), $ '# pruned to accuracy = '+STRCOMPRESS(accuracy), $ '#', $ hdr4e] rdb_write, !DDLETGCAL+'/cip/letgmp4D1996-11-01grerrpr'+acstr+ver_str+'.rdb', $ lmp4e(xs_needed), $ HEADER = hdr hdr = ['# written by cip_prune.pro, '+SYSTIME(), $ '# pruned to accuracy = '+STRCOMPRESS(accuracy), $ '#', $ hdr6e] rdb_write, !DDLETGCAL+'/cip/letgmp6D1996-11-01grerrpr'+acstr+ver_str+'.rdb', $ lmp6e(xs_needed), $ HEADER = hdr hdr = ['# written by cip_prune.pro, '+SYSTIME(), $ '# pruned to accuracy = '+STRCOMPRESS(accuracy), $ '#', $ hdrLETGe] rdb_write, !DDLETGCAL+'/cip/letgD1996-11-01grerrpr'+acstr+ver_str+'.rdb', $ LETGe(xs_needed), $ HEADER = hdr ; - - - - - - - - - - - - - - - - - - - - - - - END ; of accuracy loop RETURN END