; CALCULATE TWO HALF-SET RECONSTRUCTIONS ; FOR EACH DEFOCUS GROUP ; ; Adapted from bpodd.bat (formerly b24.bpo) ; NOTES: ; 1) Requires bpcg.spi, calcres.spi ; 2) Results file saved (to check for number of iterations, for example) ; ------------ Parameters -------------- x45 = -1 ; object radius for FSC masking, pixels (<0 will retrieve from PARAMS) x20 = 1 ; backprojection method (1==BP CG, 2==BP 32F, 3==BP RP) x41 = -1 ; (for BP CG or BP RP) radius of reconstructed volume, pixels (use -1 for 95% winsize / 2) ; For BP CG x52 = 1.0E-5 ; BP CG: error limit x53 = 0.0 ; BP CG: chi^2 limit x54 = 25 ; BP CG: iteration limit x55 = 1 ; BP CG: mode (see BP CG documentation) x56 = 2000 ; BP CG: lambda (see BP CG documentation) ; For BP RP x42 = 0.2e-5 ; BP RP: lambda x43 = 0.0 ; BP RP: correction limit x44 = 1000 ; BP RP: iteration limit ; ------------- Input files ---------------- FR L [params]../params ; parameter doc file FR L [defgrps]sel_group_cclim ; list of defocus groups ; DF_GROUP NUMPARTS FR L [ali]../Alignment/dala01_{***[grp]}@****** ; aligned particles FR L [angles]../Alignment/align_01_{***[grp]} ; angles doc file (for AP SH) FR L [seltotal]sel_particles_{***[grp]} ; selection file-template for each defocus-group FR L [symmetry_doc]* ; symmetry doc file (* for none, not available for BP CG) ; ------------ Output files --------------- FR L [df_dir]df ; defocus-group directory prefix FR L [selodd]selodd ; selection file for odd particles FR L [seleven]seleven ; selection file for even particles FR L [vol_odd]vol001_odd ; half-set volume (one for each defocus group) FR L [vol_even]vol001_even ; half-set volume (one for each defocus group) FR G [unfiltered_volume]vol001 ; (for BP32F only) combined volume FR L [doc_cmp]doccmp001 ; unmasked resolution curve (one for each defocus group) FR L [masked_fsc_doc]docfscmasked ; masked resolution curve (one for each defocus group) fr l [summary_doc]summary-bps ; summary doc file ; -------------- END BATCH HEADER -------------------------- FR L [temp_fsc_doc]tmpdocrf3 fr l [mask_unscaled]_11 fr l [gaussian_mask]_12 fr l [temp_odd_vol]_21 fr l [temp_even_vol]_22 md set mp 0 ; 0 = use all processors available ; get parameters UD IC 5,[pxsz] ; WAS x41 ; Pixel size [params] UD IC 17,[idim] ; Window size [params] [center] = [idim]/2 + 1 ; Center coordinate ; calculate reconstruction radius if necessary IF (x41.eq.-1) THEN x41 = INT( (0.95*[idim])/2.0 ) ENDIF ; calculate mask radius, if necessary if(x45.le.0) then ; get diameter from PARAMS ud 18,[part-diam] [params] [radius] = [part-diam]/2 endif ; MAKE GAUSSIAN MASK FOR FSC ; create Gaussian mo 3 [mask_unscaled] ; OUTPUT [idim],[idim],[idim] ; dimensions G ; _G_aussian [center],[center],[center] ; center coordinates [radius],[radius],[radius] ; Gaussian falloff ; get statistics fs [max] [mask_unscaled] ; lift maximum to 1 ar [mask_unscaled] [gaussian_mask] p1/[max] ; clean up de [mask_unscaled] ud ice [params] de [summary_doc] SD / MASKED_RES UNMASKED_RES NUMPARTS [summary_doc] vm echo "Calculating backprojections"; date; echo [particle-counter] = 0 ; get #defocus-groups UD N,[num-grps] [defgrps] ; loop through defocus-groups DO LB1 x77=1,[num-grps] ; Get current group number, defocus UD IC x77,[grp],[numparts] [defgrps] ; Group selection file (input) [particle-counter] = [particle-counter] + [numparts] ; create directory, if needed vm echo "if(! -d [df_dir]{***[grp]}) mkdir [df_dir]{***[grp]}"|csh ; split into odd and even selection lists doc split [seltotal] ; INPUT; total-selection file [df_dir]{***[grp]}/[selodd] ; OUTPUT [df_dir]{***[grp]}/[seleven] ; OUTPUT if(x20.eq.1) then if(x77.eq.1) then vm echo "Using BP CG" endif ; reconstruct even volume @bpcg([grp],x41,x52,x53,x54,x55,x56) [ali] [df_dir]{***[grp]}/[selodd] [angles] [df_dir]{***[grp]}/[vol_odd] ; reconstruct odd volume @bpcg([grp],x41,x52,x53,x54,x55,x56) [ali] [df_dir]{***[grp]}/[seleven] [angles] [df_dir]{***[grp]}/[vol_even] endif if(x20.eq.2) then if(x77.eq.1) then vm echo "Using BP 32F" endif bp 32f [ali] [seltotal] [angles] [symmetry_doc] [df_dir]{***[grp]}/[unfiltered_volume] ; combined reconstruction [df_dir]{***[grp]}/[vol_odd] [df_dir]{***[grp]}/[vol_even] endif if(x20.eq.3) then if(x77.eq.1) then vm echo "Using BP RP" endif ; reconstruct even volume @bprp(x41,x42,x43,x44) [ali] [df_dir]{***[grp]}/[selodd] [angles] [symmetry_doc] [df_dir]{***[grp]}/[vol_odd] ; reconstruct odd volume @bprp(x41,x42,x43,x44) [ali] [df_dir]{***[grp]}/[seleven] [angles] [symmetry_doc] [df_dir]{***[grp]}/[vol_even] endif ; CALCULATE UNMASKED AND MASKED RESOLUTION CURVES ; unmasked @calcres([unmasked-freq]) ; output parameter: unmasked-freq [df_dir]{***[grp]}/[vol_odd] ; INPUT: first volume [df_dir]{***[grp]}/[vol_even] ; INPUT: second volume blah ; INPUT: (optional) mask [df_dir]{***[grp]}/[doc_cmp] ; OUTPUT: unmasked FSC doc [unmasked-res] = [pxsz]/[unmasked-freq] ; masked @calcres([masked-freq]) ; output parameter: masked-freq [df_dir]{***[grp]}/[vol_odd] ; INPUT: first volume [df_dir]{***[grp]}/[vol_even] ; INPUT: second volume [gaussian_mask] ; INPUT: (optional) mask [df_dir]{***[grp]}/[masked_fsc_doc] ; OUTPUT: unmasked FSC doc [masked-res] = [pxsz]/[masked-freq] ;;vm ;;echo "Nominal resolution at 0.5FSC: {%f6.4%[masked-freq]} pixels^-1" ;vm ;echo "Unmasked resolution: {%f6.2%[unmasked-res]} Angstroms" vm echo "Defocus group {***[grp]}, Masked resolution: {%f6.2%[masked-res]} Angstroms" sd [grp], [masked-res],[unmasked-res],[numparts] [summary_doc] ; clean up de [temp_odd_vol] de [temp_even_vol] LB1 ; end group-loop UD ICE [defgrps] vm echo "Done"; date EN ; Modified 2011-01-14 ; TO DO: add pubsub option ; 2011-01-14 (trs) -- FSC resolution outsourced to calcres.spi ; 2011-01-13 (trs) -- writing out both masked and unmasked FSCs ; 2009-10-23 (trs) -- bug fix for input file pattern in BP32F option ; 2009-07-10 (trs) -- creates defocus-group directories, if needed ; 2009-04-14 (trs) -- input selection file now Reconstruction/sel_particles_*** ; 2008-02-01 (trs) -- added option for BP RP ; 2008-01-31 (trs) -- added option for BP 32F ; 2007-03-23 (trs) -- uses sel_group as input instad of order_defocus ; 2007-01-30 (trs) -- half-set selection lists created here ; 2007-01-30 (trs) -- inputs are now stacks ; 2006-05-12 (trs) -- calculates radius from PARAMS ; 2006-05-12 (trs) -- computes resolution curves, from old FSC.SPI ; 2006-04-05 (trs) -- updated for changes in variable-passing