; Creates average and variance images
;
; SOURCE: spider/docs/techs/recon/newprogs/display.spi
;
; PURPOSE: Creates a large circular plot (a SPIDER image) containing smaller 
;          circles representing the 83 angular groups. The radii of the 83 small
;          circles are proportional to the number of particles in each group.
;
; This batch files creates displays for all defocus groups.

; I/O PARAMETERS AND FILES ARE SET HERE:

[type] =  1  ; 1 = put projection numbers in display
             ; 0 = don't put in numbers
             ; -1 = numbers only, no circles!

[back] = 1   ; 1 = white background, 0 = black background

;  ------------ Input files ---------------------------------------

[refangles] = '../Alignment/refangles'  ; Doc file of the 83 angles

[defgrps]   = '../Alignment/sel_group'  ; Defocus groups selection file

[how_many]  = 'how_many'                ; Number of particles per projection

; --------------- Output files  -----------------------------------

[displaydir]      = 'display'                        ; Directory for group gnuplot command script

[display]    = '[displaydir]/cndis_by_group'         ; Stacked plot images

[displayall] = '[displaydir]/cndis_all_groups'       ; All group plot image

; -------------- END BATCH HEADER ---------------------------------

VM
mkdir -p [displaydir]

VM
echo " Computing images of reference view usage" ; echo ' '

DO                                      ; Loop over all defocus group(s)
   UD NEXT [key],[grp]                  ; Get group from group sel. file
   [defgrps]
   IF ([key] .LE. 0) EXIT               ; End of groups in doc file

   @display_p([type],[back])
   [refangles]                          ; Reference angles file                 (input)
   df{***[grp]}/[how_many]              ; Doc file of particles per projection  (input)
   [display]@{***[grp]}                 ; Stacked image file                    (output)
ENDDO

VM
echo " Use Web Montage to display stacked images of reference view usage from: [display].$DATEXT"

; Put sum of all defocus groups in [displayall]

[grp] = 0

@display_p([type],[back])
[refangles]                          ; Reference angles file                 (input)
[how_many]                           ; Doc file # of particles / projection  (input)
[displayall]                         ; Output file                           (input)

VM
echo ' '
VM
echo " Use Web to show  image of overall reference view usage:  [displayall].$DATEXT" ; echo ' '
 
EN 
;