;
;
; PURPOSE: Create selection files with number of particles for each projection
;
; SOURCE: select.spi
; Merged with combine.spi Nov 2006 ArDean Leith
;
; MASTER COPY: /net/bali/usr1/spider/docs/techs/recon/newprogs/
;
; I/O PARAMETERS AND FILES ARE SET HERE:
;
; -------------------------- Parameters --------------------------
[docombine] = 1 ; If >0 combine alignment parameters also
[ccthresh] = 0.0 ; CCC threshold. Use 0 to include all particles.
; Describes relative similiarity of
; the particle to the reference projection.
[numrefs] = 83 ; Number of reference views (projections)
; --------------------- Input files ----------------------------------
FR G
[defgrps]sel_group ; Defocus group selection doc file
FR G
[align_parameters]../Alignment/align_01_*** ; Alignment parameter files from 'AP SH'
; --------------------- Output files -------------------------------
FR G
[how_many]how_many ; Overall doc file listing number of particles
; in each reference view.
FR G
[group_how_many]df{***[grp]}/how_many ; Group summary doc file listing number of particles
; in each reference view.
FR G
[dfsel]df{***[grp]}/select ; New select directories.
FR G
[select]df{***[grp]}/select/sel*** ; Doc file listing particles assigned to
; each reference view
FR G
[docaligncom]align_01_all ; Combined (merged) alignment file (large)
; -------------- END BATCH HEADER ---------------------------------
UD N [numgrps] ; Get number of groups
[defgrps] ; Groups selection file (input)
DO LB1 [numgrp]=1,[numgrps] ; Loop over all group(s)
UD [numgrp],[grp] ; Get current group number
[defgrps] ; Group selection file (input)
VM
echo ' 'Summarizing group: {***[grp]}
VM ; Make sure output dir. present
mkdir -p [dfsel]
DE ; Remove any existing group output files.
[select]
DE ; Remove any existing group output files.
[group_how_many]
VO MQ ; Create doc. files from 'AP SH' doc. file
([ccthresh]) ; CCC threshold
[align_parameters][grp] ; Output from 'AP SH' (has current CC value) (input)
([numrefs]) ; Number of references used (input)
[select] ; Template for selection document files (output)
[group_how_many] ; Group howmany document file (output)
LB1
VM
echo ' '
; Create summed top-level doc file
DE ; Remove any existing top-level howmany file.
[how_many]
SD / # PARTICLES
[how_many] ; Initialize top-level howmany file with comment line
DO LB2 [numref] = 1,[numrefs] ; Loop over all references
[sum] = 0 ; Initialize sum
DO LB3 [numgrp]=1,[numgrps] ; Loop over all group(s)
UD [numgrp],[grp] ; Get current group number
[defgrps] ; Group selection file (input)
UD [numref], [n] ; Get number for this reference
[group_how_many] (input)
[sum] = [sum] + [n] ; Sum the numbers for all the references
LB3
SD [numref],[sum]
[how_many] ; Top-level howmany file (output)
VM
echo ' 'View: {***[numref]} has: {*****[sum]} particles
LB2
SD E
[how_many] ; Top-level howmany file (output)
IF ([docombine] .GT. 0) THEN
VM
echo ' '
VM
echo ' Combining alignment parameters'
DE ; Remove existing output doc. file
[docaligncom]
; Put header comment in new output doc file
SD / PHI,THE,PSI, MIR-REF#,IMG#,INPLANE , SX,SY,NPROJ, DIFF,CCROT,INPLANE ,SX,SY
[docaligncom]
SD E
[docaligncom]
DOC COMBINE ; Combine contents of a series of document files
[align_parameters] ; Template for doc. file series (input)
[defgrps] ; Selection doc. file with file numbers (input)
[docaligncom] ; Combined document file (output)
ENDIF
VM
echo ' '
EN
;