; Plots number of particles from each reference view
 ;
 ; SOURCE: spider/docs/techs/recon1/Procs/plot-ref-views.spi 
 ;
 ; PURPOSE: Creates a plot summary of number of particles assigned to each views.
 ;          Selects  '*_good'input file if it exists otherwise selects: '*_all'.
 ;          Can display plot.
 ;
 ; USAGE:   clean ; ./spider spi/dat @plot-ref-views

 ;  ------------ Parameters ----------------------------------------

![want-good-yn] = 1     ; Set to: 1  if you want to plot from the 'good' ref views (not 'all')
 
 [wantplot-yn]  = 1     ; Set to: 0  if you do not want to open Gnuplot automatically

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

 [howmany] = 'views/parts_vsview'  ; Particles per view doc file 

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

 [gnuplot] = 'parts_vsview'         ; Overall gnuplot script (without extension)
   
 ; -------------- END BATCH HEADER ---------------------------------- 

 MD                                ; Quiet
   VB OFF

 IQ FI [goodexist]                 ; See if this should access 'all' or 'good'
   [howmany]_good

 ; Select 'all' or 'good' for input
 IF ( [goodexist] == 1 ) THEN
    [allvsgood] = '_good'
 ELSE
    [allvsgood] = '_all'
 ENDIF

 ; Concatenate name
 [plot]   =  '[gnuplot][allvsgood].gnu'
 [source] =  '[howmany][allvsgood].$DATEXT'

 SYS                                ; Delete the group script output file
   rm -f  [plot]        

 SYS                                ; Create gnuplot script file
   echo ' 'set ylabel \"Particles\" >  [plot]
 SYS 
   echo ' 'set xlabel \"View\" >> [plot]
 SYS 
   echo ' 'set title \"Particles vs View\" >> [plot]
 SYS 
   echo ' 'plot \'[source]\' using 1:3 notitle with boxes >> [plot]

 IF ( [wantplot-yn] == 1 ) THEN
    SYS                                 
      echo  '  'Displaying histogram of views using: gnuplot -persist [plot]; echo   
    SYS                           ; Plot the histogram file                       
      gnuplot -persist [plot]  
 ELSE    
    SYS                           ; Plot the histogram file                       
      echo "  Plot by typing: ' gnuplot -persist [plot]  '" ; echo
 ENDIF

 EN
 
 ; Modified 2013-10-28
 ;    2013-10-23 (agl) -- new file names, modernized syntax & cosmetic

 ;