samb version 1.0 of  2001.12.20
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

   Program SAMB is for resolving sub-ambiguities in group delays.     
                                                                      
   It reads residual file generated by Solve and edited by user,      
   a database and generates C-shell program which invokes Fourfit     
   for all observations marked as outliers in the residual file.      
   Fourfit will try to re-fringe these observations with narrow       
   search window using model derived from Solve solution.             
                                                                      
   Background.                                                        
                                                                      
   Sub-ambiguities occur when delay resolution function has several   
   close maxima and observation has low SNR: 7-30. Delay resolution   
   function may have several close maxima if there were too few       
   channels left, 3-4. In this case random noise may cause Fourfit    
   to pick up a wring peak of delay resolution function.              
                                                                      
   Sub-ambiguities cannot be resolved in Solve, contrary to group or  
   phase delay ambiguities, since sub-ambiguities do not have fixed   
   spacing. However, in conjunction with Fourfit Solve can help       
   to resolve them.                                                   
                                                                      
   Technology of resolving sub-ambiguities.                           
                                                                      
   You should keep in mind that resolving sub-ambiguities is rather   
   art than science. It is a tedious task and requires several rounds 
   of re-Fourfitting, creation of new databases, analyzing them,      
   running SAMB etc. You should also have **complete** Fourfit and    
   correlator output including records of type 1xxx.                  
                                                                      
   First we have to make good group delay solution with suppressing   
   all observations with sub-ambiguities. In the case when there are  
   baselines with more than 20% of observations with subambiguities   
   case should be taken to select which points should be kept and     
   which points should be considered as points at wrong peak of       
   delay resolution function. It is instructive to check adjustments  
   to baseline dependent clocks. If baseline dependent clocks for     
   one more more baselines has large values, greater than 200 psec,   
   there are good chances what all points with sub-ambiguities at     
   some baselines were kept, but normal points which correspond to    
   a main peak at delay resolution function were suppressed.          
                                                                      
   Then we should decide at which band, X or S, sub-ambiguities occur.
   Examining plots of group delay ionosphere contribution, number of  
   channels and fringe plots is helpful.                              
                                                                      
   Then we run interactive solution with creation of residual file    
   (option (A) at last page of interactive Solve).                    
                                                                      
   Then we make plots of postfit residuals plus clock function        
   (option R in MDLPL_PLUS which is invoked by hitting key / from     
   interactive Solve).                                                
                                                                      
   Having both plot and residual file we edit residual file by        
   leaving there lines which correspond to observation which are      
   are considered as observations with sub-ambiguities and removing   
   other lines.                                                       
                                                                      
   It is important to keep in mind that if an error was made and      
   the observation which in fact did not have sub-ambiguity was left  
   in residual file after refringing it may have 0 quality code and   
   become unrecoverable at all. (Future versions of samb will         
   overcome this setback).                                            
                                                                      
   Usually observations with sub-ambiguities occur only at several    
   baselines. It may turn out useful first to split residual file     
   onto several pieces with observations with residuals at specific   
   baseline using grep and then to work with this short files. Later  
   these files can be combined.                                       
                                                                      
   Then we call program samb. It creates C-shell program which        
   invokes Fourfit and tries to re-fringe observations marked in      
   residual file.                                                     
                                                                      
  Usage: samb [-h] -r <residual_file> -d <database_file>              
                   -f <fringe_directory> -c <fourfit_control_file>    
                   -w <delay_window> -o <output_file>                 
                   [-v <verbosity_level>]                             
                                                                      
  <residual_file> -- file with residuals generated by interactive     
                     Solve or its portion. Only lines with ">" at     
                     the 8-th column are taken into account. SAMB     
                     interprets that all lines with ">" at the 8-th   
                     column correspond to observations with           
                     sub-ambiguities.                                 
                                                                      
  <database_file> -- X or S-band database name If X-band database     
                     name is supplied than SAMB consider all outliers 
                     are considered as observations with              
                     sub-ambiguities at X-band. If S-band database    
                     name is supplied, then sub-ambiguities at S-band 
                     are implied.                                     
                                                                      
  <fringe_directory> -- Name of the directory which contains scan     
                        sub-directories. It is assumed that these     
                        scan sub-directories contain root, correlator 
                        and Fourfit files.                            
                                                                      
  <fourfit_control_file> -- Control file used by Fourfit for fringing 
                            all observations considered as            
                            observations with sub-ambiguities. This   
                            control file will be used for re-Fourfit. 
                                                                      
  <delay_window> -- Full width of a search window for multi-band      
                    delay which will be used by Fourfit in re-fringe  
                    mode. Units: nsec. Delay window should not be too 
                    wide: not more than twice sub-ambiguity spacing   
                    at this band, and it should not be too narrow,    
                    since in that case there is a risk of losing the  
                    observation. Half of sub-ambiguity spacing is     
                    reasonable suggestion.                            
                                                                      
  <output_file> -- Name of the the control file which will be created 
                   by SAMB.                                           
                                                                      
  <verbosity_level> -- level of verbosity.                            
                       0 -- silent mode;                              
                       1 -- verbose mode.                             

  Example: 

  samb -r /lyra3/fringe/cb904/cb904_01.rf -d 01OCT18SA \
       -f /lyra3/fringe/cb904/7603 -c /lyra3/fringe/cb904/cf_7603 -w 5.0 \
       -o /lyra3/fringe/cb904/samb_05.csh -v 1


  History:

  pet  2001.12.19  -- beginning of development
  pet  2001.12.20  -- releaase of version 1.0
