ACALCHEK $SSW/radio/ovsa/idl/analysis/acalchek.pro
[Next]
 NAME:
     ACALCHEK
 PURPOSE:
     Main routine to analyze antenna pointing data.  Responds to scans
     of type PNTCAL (scan code 8) or TEST DATA (scan code 1).
 CATEGORY:
     OVRO APC DATA ANALYSIS
 CALLING SEQUENCE:
     acalchek[,filename][,hrec | ,after=after][,output][,debug][,/cmdfile]
 INPUTS:
     filename   the name of the file containing PNTCAL data.  If
                  omitted, the file DAILY.ARC in directory
                  !DEFAULTS.WORKDIR is assumed.
     hrec       the record number of the SOLAR scan header.  Data
                  will be processed up to the next EOS segment.
                  If this argument is given, then AFTER keyword
                  is ignored.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     after      an optional time string of the standard form
                  [yyyy.ddd ]hh:mm[:ss] after which to start
                  looking for a valid PNTCAL or TEST DATA scan.
     cmdfile    a switch that indicates that the routine was called
                  from a command file, so issue no modal messages, and
                  print any error messages to <WORKDIR>\ACAL.MSG.
     debug      a switch that activates some debugging statements
                  for getting an indication of intermediate steps.
                  This switch is not compatible with /CMDFILE switch.
 ROUTINES CALLED:
     openarc, getdata, lasthrec, tl_decode, decode, acfit
 OUTPUTS:
     output     a 2*nant-element string array containing formatted lines of
                  output of the following form.  The two header lines are
                  not included.  These lines are also appended to
                  the file boresite.pnt in the directory !DEFAULTS.DBDIR.

      Source Name     Date      Time   Rec#  HA(deg)  DEC(deg) Ant Axis Offset
      ------------ ---------- -------- ----- -------- -------- --- ---- ------
      SUN          2000/03/08 19:09:40  1402  -13.531   -4.540  4    HO   0.075
      SUN          2000/03/08 19:09:40  1402  -13.531   -4.540  4    DO  -0.017
      SUN          2000/03/08 19:09:40  1402  -13.531   -4.540  5    HO   0.027
      SUN          2000/03/08 19:09:40  1402  -13.531   -4.540  5    DO   0.118
      SUN          2000/03/08 19:09:40  1402  -13.531   -4.540  6    HO   0.020
      SUN          2000/03/08 19:09:40  1402  -13.531   -4.540  6    DO   0.037

 COMMENTS:
     There will have to be modifications to this routine when
     additional antennas are available.
 CALLS: ***
	ACFIT, FLAGOOL, FREESCAN, GAINCOR, GET_CYCLE, LASTHREC, LOADCT, LST, MSEC2STR, NEWSCAN
	NINT [1], NINT [2], OPENARC
 CALLED BY:
	WACAL
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 16-Jun-1998 by Dale Gary
     21-Jun-1998  DG
       Changed from reading a(rec) to getdata(rec,a) throughout,
       so that routine should work under UNIX.
     25-Aug-1998  DG
       Added check for new TRAJECTORY segments (but contents ignored
       for now.)
     03-Nov-1998  DG
       Removed NaNs before using MEDIAN routine at the very end.
     04-Feb-1999  DG
       Converted to use NEWSCAN routine
     07-Jun-1999  DG
       Began work on plotting diagnostic info, for evaluating the results
     13-Mar-2000  DG
       Changed to work with more than 5 antennas.
     04-Nov-2000  DG
       Major changes to make it work with VARDB, etc.  Now applies
       proper gain calibration before determining pointing.
     08-Dec-2003  DG
       Fixed bug that caused a crash when one antenna was missing (due to
       plotting with too few points).
     01-Sep-2005  DG
       Several changes to plot frequency-dependent offsets (likely will be
       commented out except for special tests).


ACFIT $SSW/radio/ovsa/idl/fitting/acfit.pro
[Previous] [Next]
 NAME:
     ACFIT
 PURPOSE:
     ACALCHEK support routine.  Fits Antenna PNTCAL data to find
     the frequency dependent peak flux, pointing offset, half-power
     beamwidth, and rmserr of the fits for each of the small antennas.
 CATEGORY:
     OVRO APC ACALCHEK SUPPORT ROUTINE
 CALLING SEQUENCE:
     acfit,avdat,pk,po,hpbw,rmserr[,/debug]
 INPUTS:
     avdat   the ACAL data array, of size (nant,nf,nblk), where
                the first index is the number of antennas (5--the
                first two are 27 m and not used [yet]), second
                index is the number of frequencies (43), and the
                third index is the number of "blocks" (pointings--20)
                in the ACAL Trajectory.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     debug    a switch to enable plotting of some intermediate
                results.
 ROUTINES CALLED:
 OUTPUTS:
     pk      an array of size (nant,nf) containing the peak level
                in receiver units of the peak (Sun-center) at each
                frequency.
     po      an array of size (nant,nf,2) containing the pointing
                offsets in degrees for each of the two axes, HA and DEC.
     hpbw    an array of size (nant,nf,2) containing the half-power
                beamwidth in degrees for each of the two axes, HA and DEC.
     rmserr  an array of size (nant,nf,2) containing the rms error of the
                fit for the two axes, HA and DEC.
 COMMENTS:
 CALLS: ***
	ALTFIT, GAUSFIT, NINT [1], NINT [2]
 CALLED BY:
	ACALCHEK, DLACHEK
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 17-Jun-1998 by Dale E. Gary
     18-Jun-1998  DG
       Added ALTFIT routine and associated code.
     16-Nov-1998  DG
       Fixed small bug with RMSTOT not being defined in some cases
     12-Oct-2000  DG
       Considerable changes to flag and disregard saturated data.


Adaptive image display $SSW/radio/ethz/idl/obsolete/tv_y_adapt.pro
[Previous] [Next]
 NAME:
       Adaptive image display

 PURPOSE:
       Display an image in a coordinate system using a given y-axis
       using the currently active window.

 CALLING SEQUENCE
	TV_Y_ADAPT, imgData, xAxis, yAxis, MIN=MIN, MAX=MAX

 INPUTS:
       img: the image to be displayed
       xAxis: the xAxis to be used 
       yAxis: the yAxis to be used - one pixel-row of the image
              is displayed per entry in this vector

 KEYWORDS:
       MIN, MAX: the image data will be scaled using these maxima and minima

 CALLS: ***
	CONGRID [1], CONGRID [2], CONGRID [3], TV_Y_ADAPT
 SIDE EFFECTS:

 RESTRICTIONS:
       xAxis has to have linear scale (is not checked).

 MODIFICATION HISTORY:
       02/01/30 Initial version
                Oliver Trachsel <toliver@astro.phys.ethz.ch>
		 Institute of Astronomy, ETH Zurich


ADJ2MCAL $SSW/radio/ovsa/idl/misc/adj2mcal.pro
[Previous] [Next]
 NAME:
     ADJ2MCAL
 PURPOSE:
     Adjusts the amplitude calibration factors on the 2m antennas by
     comparing with the total power calibration.  The adjustment is
     to make the calibration factors smoother, without changing the
     absolute calibration.
 CATEGORY:
     OVRO APC DATA CALIBRATION
 CALLING SEQUENCE:
     adj2mcal,ampcal,tpcal,tpupd
 INPUTS:
     ampcal    An instance of an AMPCAL structure, as returned by
                 get_ampcal_struct.
     tpcal     An instance of a TPCAL structure, as returned by
                 get_tpcal_struct.
     tpupd     An instance of a TPUPD structure, as returned by
                 get_tpupd_struct.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 ROUTINES CALLED:
 OUTPUTS:
     ampcal    On output, contains the same values as on input,
                 except the 2m amplitude calibration factors are
                 adjusted.
 COMMENTS:
     A plot of the calibrator comparison can be obtained by a
     call to COMPARE_CAL2, with identical arguments.
 CALLED BY:
	NEWSCAN
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written  31-Dec-2000 by Dale E. Gary
     03-Mar-2001  DG
       Fixed bug that occurred when no total power update was
       available.
     29-Mar-2001  DG
       Accidentally applied correction to Ant 2 I feed.  Changed
       feed loop to start at 4 instead of 3, so that this doesn't
       happen.


ADJ_PCLOSE $SSW/radio/ovsa/idl/support/adj_pclose.pro
[Previous] [Next]
 NAME:
     ADJ_PCLOSE
 PURPOSE:
     Force phase closure in I calibration adjustment data.
 CATEGORY:
     OVRO APC CALIBRATION
 CALLING SEQUENCE:
     adjout = adj_pclose(adjin)
 INPUTS:
     adjin    A float array of size (3*nb,ns) where NB=7 is the number of
                baselines for which the calibration data were taken, and
                NS=5 is the number of scans over which the adjustment is
                to be made.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 ROUTINES CALLED:
     pclose
 OUTPUTS:
     adjout  An exactly parallel array to ADJIN, but with phases corrected
                for phase closure.
 COMMENTS:
 CALLS: ***
	PCLOSE
 SIDE EFFECTS:
 RESTRICTIONS:
     This routine will have to be fixed to work with more than 5
     antennas (7 baselines)
 MODIFICATION HISTORY:
     Written 21-Jul-1999 by Dale E. Gary


Adjust Table $SSW/radio/ethz/idl/ragview/datatype/adjusttable.pro
[Previous] [Next]
 NAME:
 	Adjust Table
 PURPOSE:
 	Procedure to enlarge the length of a 2D table
	in x direction.
 CALLING SEQUENCE:
	AdjustTable, table, newLength
 INPUT PARAMETERS:
	table: the 2D  table to adjust in x direction
 	newLength: the integer length, greater as the former length
 OUTPUT PARAMETER:
	table: the adjusted table.
 CALLS:


ADJUST_AMF $SSW/radio/ovsa/idl/support/adjust_amf.pro
[Previous] [Next]
 NAME:
     ADJUST_AMF
 PURPOSE:
     Compares multiple .AMF files taken with different baselines
     during a standard series of reference calibrations, makes
     the multiple measurements on the 12 baseline consistent,
     averages the 12 baseline data, and writes out a final .AMF
     file containing the multiple baseline information.
 CATEGORY:
     OVRO APC CALIBRATION SUPPORT
 CALLING SEQUENCE:
     adjust_amf[,files][,outfile=outfile][,/debug]
 INPUTS:
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     files     the names of the input files containing the AMPHIT
                 data from the series of calibration observations
                 (output from WAMPHIT).  If omitted, the user is
                 asked to choose the series of input files.
     outfile   the name of the output .AMF file to write the
                 combined information to.  If omitted, the user
                 is asked to provide a filename interactively.
     debug     a switch that, when set, causes plots to be shown
                 for gauging the quality of the result.
 ROUTINES CALLED:
     lobe
 OUTPUTS:
 COMMENTS:
 CALLS: ***
	BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], CAL_PCLOSE, GET_SCREEN_SIZE
	LINFIT, LOBE, OKTOWRITE, break_file [4]
 SIDE EFFECTS:
     Writes the results to an output file specified by the user.
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 29-Jul-2000 by Dale E. Gary
     16-Sep-2000  DG
       Fixed up several things such as converting -99.9 to NaN on
       input, and NaN to -99.9 on output.


ADJUST_REFCAL $SSW/radio/ovsa/idl/support/adjust_refcal.pro
[Previous] [Next]
 NAME:
     ADJUST_REFCAL
 PURPOSE:
     Applies phase variations at the common frequency (3.6 GHz) to
     other frequencies, assuming a linear frequency dependence, and
     writes out a final .AMF file
 CATEGORY:
     OVRO APC CALIBRATION SUPPORT
 CALLING SEQUENCE:
     adjust_refcal[,filename]
 INPUTS:
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     filename  the name of the input file containing the AMPHIT
                 data from the 5-scan calibration (output from
                 WAMPHIT).  If omitted, the user is asked to choose
                 an input file.
 ROUTINES CALLED:
 OUTPUTS:
 COMMENTS:
 CALLS: ***
	CAL_PCLOSE, LOBE, OKTOWRITE, PICKFILE, UNIQ [1], UNIQ [2], UNIQ [3]
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 14-May-2000 by Dale Gary
     29-Dec-2000  DG
       Changed to read the number of frequencies, baselines, and
       scans directly from the .AMF file.


AMPHIT $SSW/radio/ovsa/idl/fitting/amphit.pro
[Previous] [Next]
 NAME:
     AMPHIT
 PURPOSE:
     Routine to fit best straight line to calibrator phases and
     return the average amplitude and phase for the entire timerange
     of data, with optional plotting and saving of data to a file.
     This is the main routine for creating amplitude and phase
     calibration.  The handles only one baseline at a time and must
     be called multiple times to do all baselines.
 CATEGORY:
     OVRO APC DATA CALIBRATION
 CALLING SEQUENCE:
     amphit,frq,data,bl,tavg,cfg,out,[,pslope][,ifrq=ifrq] $
              [,fitslope=fitslope][,debug=debug][,/save,lun=lun] $
              [,pol=pol][,ndfac=ndfac]
 INPUTS:
     frq      Array of frequencies contained in the data [GHz]
     data     Data array of size (NCHAN,NFRQ,NMEAS), where NCHAN is the
                number of channels, NFRQ is the number of frequencies,
                and NMEAS is the number of measurements (times).
     bl       A number representing the baseline to be fit.  Currently one
                of [12,14,15,16,24,25,26].
     tavg     The array of times, of length (NMEAS), in [msec] corresponding
                to the data
     cfg      The CONFIG structure from the scan that was analyzed.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     pslope   A guess at the frequency-dependent slope that will remove
                temporal drifts in the phases.  If omitted, zero is assumed.
     ifrq     Specifies an index within the FRQ array, for handling a single
                frequency at a time.
     fitslope A switch declaring whether a frequency-dependent phase drift
                should be allowed in the fit.  If set, a phase drift is
                allowed (and reported in the output).  If not set, zero
                phase drift is assumed (after possible correction for
                the value of PSLOPE.
     debug    A switch that turns plotting on or off.  If set, plots of the
                phases as a function of time at each frequency are shown,
                along with the straight line fit.
     lun      The logical unit number of the file opened by the routine on
                an initial call.  This should be undefined on the first call,
                and unchanged on subsequent calls.
     pol      A single string character specifying the polarization state
                'R' -> RCP, 'L' -> LCP, 'I' -> Linear polarization.  If
                omitted, 'I' is the default.  Note that this information is
                merely written to the header line of the output.
     ndfac    An array of size (NANT), giving the factors for each antenna
                that are needed to normalize the data to an effective noise
                diode value of 500.  If omitted, the values are set to unity.
 ROUTINES CALLED:
 OUTPUTS:
     lun      The logical unit number of the file opened by the routine on
                the initial call.
     out      The result of the fit, in 6 columns for each frequency.  The
                columns are Freq, Amp, dAmp, Pha, dPha, and Pslope in
                degrees/hr/GHz.
 COMMENTS:
 CALLS: ***
	LOBE, NINT [1], NINT [2], OKTOWRITE, RVAV
 CALLED BY:
	BASEPHZ, DAILY, WAMPHIT, WANALYZE, XPOL_ANAL, daily_cal
 SIDE EFFECTS:
     Writes the solution to the output log or terminal.  If the SAVE keyword
     is set, the solution is also written to a file (whose name is requested
     via widget dialog).  When all of the baselines have been written, the
     file must be explicitly closed by the caller with FREE_LUN,LUN.
 RESTRICTIONS:
     When all of the baselines have been written, the file must be
     explicitly closed by the caller with FREE_LUN,LUN.  The baselines
     should be written in the order 12, 14, 15, 16, 24, 25, 26 in order to
     make a valid calibration file.
 MODIFICATION HISTORY:
     Written 04-Jul-1999 by Dale E. Gary
     01-Apr-2000  DG
       Added IFRQ keyword, for handling a single frequency at a time.  Also
       now writes out frequency in OUT array.
     06-Apr-2000  DG
       Added POL keyword, whose sole purpose is to allow writing of polarization
       state to the header lines of the output.  Also added NDFAC keyword, to
       normalize the output to correspond to an effective noise diode value of
       500.
     15-Jun-2000  DG
       Fix problem with fitting non-5-element data.
     02-Jul-2000  DG
       Fix a problem with 3-element data.
     22-Jul-2000  DG
       Change averaging scheme to do algebraic average of amplitudes if S/N
       is greater than 2.5
     15-Oct-2002  DG
       No longer sets frequency column to NaN when there are no good data.
     17-Dec-2002  DG
       Made a number of changes to reflect new calibration scheme.  Now
       both the HEADER and CONFIG structures are included in the arg list,
       and information is written to the output file giving the antennas,
       their order, which backend channels were used, and what the relevent
       backend channel phase offset is.
     03-Jan-2003  DG
       I had to resort to a "trick" to deal with a problem with the 12RLI
       data.  If the logical unit number is not defined, some header lines
       are written to the beginning of the file.  The first line contains
       information assuming this is 12RLI data.  This is okay, since WAMPHIT,
       which is used for non-12RLI data, will never call AMPHIT with an
       undefined LUN.
     11-Jan-2003  DG
       Changes to allow use of non-zero PHI_AB value.


ANALYZE [1] $SSW/radio/ovsa/idl/analysis/analyze.pro
[Previous] [Next]
 NAME:
     ANALYZE
 PURPOSE:
     Reduce observations by applying the phase and gain corrections
     and optionally performing a vector average over a specified
     time average and writing out an IDL save file of the results.
     Only one polarization at a time is currently handled.
 CATEGORY:
     OVRO APC DATA ANALYSIS
 CALLING SEQUENCE:
     analyze,filename,hrec,timavg,range[,time=time][,outfile=outfile] $
             [,pshift=pshift][,/notrack]
 INPUTS:
     filename   the name of the file containing the data.
     hrec       the record number of the scan header.  Data
                  will be processed up to the next EOS segment.
                  If this argument is given, then AFTER keyword
                  is ignored.
     timavg     a single integer or float value: the time, in sec, over
                  which to integrate.  Must correspond to an integral number
                  of cycles.  Specify the cycle time for no integration.
     range      a 2-element array indicating the range of data wanted, as
                  either record numbers or times (the latter is
                  indicated by the /TIME keyword).  Times are specified
                  as HHMMSS.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     time       if set, specifies that the RANGE is to be interpreted as
                  a time range.  If unset or omitted, the RANGE is interpreted
                  as a record range.
     outfile    an optional string giving the name of the output SAVE file.  If
                  omitted, the data are placed in file !DEFAULTS.WORKDIR+GENERIC.SAV
     pshift     an optional 2-element array specifying the distance to shift
                  the phase center, in arcsec, as [x,y] with x positive W
                  and y positive N.
     notrack    an optional switch to inform FLAGOOL to disregard tracking
                  (i.e. bad tracking data are NOT flagged bad).
 ROUTINES CALLED:
     openarc, newscan, getcycle, flagool, gaincor, freescan, ovsa_adjtime
 OUTPUTS:
 COMMENTS:
     The name of this routine definitely needs to change to something more
     appropriate.
 CALLS: ***
	BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], FLAGOOL, FREESCAN, GAINCOR
	GET_CYCLE, HMS2SEC, MOMENT, NEWSCAN, OPENARC, OVSA_ADJTIME, PROGMETER, STR_SEP, UNIQ [1]
	UNIQ [2], UNIQ [3], break_file [4]
 CALLED BY:
	CHANPHZCHEK, DAILY, WANALYZE, XPOL_ANAL, ovsa_calib
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 07-Jan-1999 by Dale Gary
     29-Jan-1999  DG
       Add outfile keyword
     21-Jul-1999  DG
       Add output of TLS structure to .SAV file
     28-Aug-1999  DG
       Add POLCODE, and change input time range from seconds to more
       convenient HHMMSS.
     28-Mar-2000  DG
       Fix problem with routine getting into infinite loop when it hit
       the end of the file without an end of file record.
     31-Mar-2000  DG
       Added saving of original datafile name as o_datfile
     02-Apr-2000  DG
       Now works for all polarizations.  Removed POLCODE keyword.
     06-Apr-2000  DG
       Added saving of NDFAC, since this is needed for calibration.
     14-Apr-2000  DG
       Get rid of C:\TEMP references (use !Defaults.workdir)
     28-Jul-2000  DG
       Added HEADER to SAV file output, to provide NANT and AATAB
       Added code to extract uv values, and added some more outputs
       for Jeongwoo's mapping requirements.  ANALYZE needs to be
       considerably revamped for "production" purposes soon.
     04-Nov-2000  DG
       Added call to FREE_SCAN to free memory
     06-Mar-2001  DG
       Added solar info to GEOMETRY structure (in NEWSCAN) and changed
       to write a single file instead of three.
     18-Mar-2001  DG
       Previous change was a disaster for other code that assumed only
       one array name to hold the data, so all three polarizations, if
       they exist, are now contained in a single array.  The variable
       NPOL gives info about which polarizations exist.  NPOL=1 => I,
       NPOL=2 => R and L, NPOL=3 => R, L and I
     15-Dec-2001  DG
       Changed TAVG from a FLOAT to a LONG array.  Added OVSA_ADJTIME
       call, and save new variables MSOFF (time offsets for each data
       sample, in msec), TTP2M (time array for 2m double time resolution)
       and TP2M (total power for 2m at double time resolution).
     08-Jun-2002  DG
       Added PSHIFT keyword to allow specifying a shift of the phase center.
     17-Dec-2002  DG
       Added output of CFG structure to save file, and use /COMPRESS
       keyword.
     23-Dec-2002  DG
       Added NOTRACK keyword
     05-March-2003 GN
       Replaced the default outfile name with a standard name: yyyymmdd_hhmm.sav
       Added ERROR keyword and code to handle the errors
     26-Sep-2004  DG
       Added code to allow only 2 channels when data are pure dual-polarization.
       New code is activated for header.tls.yrday > 2004.231.
     07-Oct-2004  DG
       Standardize on two polarizations for data after 2004.231, even when
       observing sequence has only one polarization.  Missing polarization is
       treated as NaN.


ANALYZE [2] $SSW/radio/ovsa/idl/analysis/analyze_old.pro
[Previous] [Next]
 NAME:
     ANALYZE
 PURPOSE:
     Reduce observations by applying the phase and gain corrections
     and optionally performing a vector average over a specified
     time average and writing out an IDL save file of the results.
     Only one polarization at a time is currently handled.
 CATEGORY:
     OVRO APC DATA ANALYSIS
 CALLING SEQUENCE:
     analyze,filename,hrec,timavg,range[,time=time][,outfile=outfile] $
             [,pshift=pshift][,/notrack][,xpol]
 INPUTS:
     filename   the name of the file containing the data.
     hrec       the record number of the scan header.  Data
                  will be processed up to the next EOS segment.
                  If this argument is given, then AFTER keyword
                  is ignored.
     timavg     a single integer or float value: the time, in sec, over
                  which to integrate.  Must correspond to an integral number
                  of cycles.  Specify the cycle time for no integration.
     range      a 2-element array indicating the range of data wanted, as
                  either record numbers or times (the latter is
                  indicated by the /TIME keyword).  Times are specified
                  as HHMMSS.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     time       if set, specifies that the RANGE is to be interpreted as
                  a time range.  If unset or omitted, the RANGE is interpreted
                  as a record range.
     outfile    an optional string giving the name of the output SAVE file.  If
                  omitted, the data are placed in file !DEFAULTS.WORKDIR+GENERIC.SAV
     pshift     an optional 2-element array specifying the distance to shift
                  the phase center, in arcsec, as [x,y] with x positive W
                  and y positive N.
     notrack    an optional switch to inform FLAGOOL to disregard tracking
                  (i.e. bad tracking data are NOT flagged bad).
     xpol     A switch that states whether cross-polarization measurements
                (i.e. RL or LR) are analyzed.  If omitted or set to zero,
                cross-polarization measurements (if any) are ignored.  If
                set to 1, parallel-polarization measurements are ignored
                and the crossed-polarization measurements RL are placed
                where RR would go, and LR are placed where LL would go. This
                is implemented by changing the OBSEQ structure in NEWSCAN.
 ROUTINES CALLED:
     openarc, newscan, getcycle, flagool, gaincor, freescan, ovsa_adjtime
 OUTPUTS:
 COMMENTS:
 CALLED BY:
	CHANPHZCHEK, DAILY, WANALYZE, XPOL_ANAL, ovsa_calib
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 07-Jan-1999 by Dale Gary
     29-Jan-1999  DG
       Add outfile keyword
     21-Jul-1999  DG
       Add output of TLS structure to .SAV file
     28-Aug-1999  DG
       Add POLCODE, and change input time range from seconds to more
       convenient HHMMSS.
     28-Mar-2000  DG
       Fix problem with routine getting into infinite loop when it hit
       the end of the file without an end of file record.
     31-Mar-2000  DG
       Added saving of original datafile name as o_datfile
     02-Apr-2000  DG
       Now works for all polarizations.  Removed POLCODE keyword.
     06-Apr-2000  DG
       Added saving of NDFAC, since this is needed for calibration.
     14-Apr-2000  DG
       Get rid of C:\TEMP references (use !Defaults.workdir)
     28-Jul-2000  DG
       Added HEADER to SAV file output, to provide NANT and AATAB
       Added code to extract uv values, and added some more outputs
       for Jeongwoo's mapping requirements.  ANALYZE needs to be
       considerably revamped for "production" purposes soon.
     04-Nov-2000  DG
       Added call to FREE_SCAN to free memory
     06-Mar-2001  DG
       Added solar info to GEOMETRY structure (in NEWSCAN) and changed
       to write a single file instead of three.
     18-Mar-2001  DG
       Previous change was a disaster for other code that assumed only
       one array name to hold the data, so all three polarizations, if
       they exist, are now contained in a single array.  The variable
       NPOL gives info about which polarizations exist.  NPOL=1 => I,
       NPOL=2 => R and L, NPOL=3 => R, L and I
     15-Dec-2001  DG
       Changed TAVG from a FLOAT to a LONG array.  Added OVSA_ADJTIME
       call, and save new variables MSOFF (time offsets for each data
       sample, in msec), TTP2M (time array for 2m double time resolution)
       and TP2M (total power for 2m at double time resolution).
     08-Jun-2002  DG
       Added PSHIFT keyword to allow specifying a shift of the phase center.
     17-Dec-2002  DG
       Added output of CFG structure to save file, and use /COMPRESS
       keyword.
     23-Dec-2002  DG
       Added NOTRACK keyword
     07-Nov-2003  DG
       Added XPOL keyword, to handle cross-polarization.
     10-Jan-2004  DG
       Added error return in case of OPENARC failure


ANALYZE [3] $SSW/radio/ovsa/idl/util/analyze_old.pro
[Previous] [Next]
 NAME:
     ANALYZE
 PURPOSE:
     Reduce observations by applying the phase and gain corrections
     and optionally performing a vector average over a specified
     time average and writing out an IDL save file of the results.
     Only one polarization at a time is currently handled.
 CATEGORY:
     OVRO APC DATA ANALYSIS
 CALLING SEQUENCE:
     analyze,filename,hrec,timavg,range[,time=time][,outfile=outfile] $
             [,pshift=pshift][,/notrack]
 INPUTS:
     filename   the name of the file containing the data.
     hrec       the record number of the scan header.  Data
                  will be processed up to the next EOS segment.
                  If this argument is given, then AFTER keyword
                  is ignored.
     timavg     a single integer or float value: the time, in sec, over
                  which to integrate.  Must correspond to an integral number
                  of cycles.  Specify the cycle time for no integration.
     range      a 2-element array indicating the range of data wanted, as
                  either record numbers or times (the latter is
                  indicated by the /TIME keyword).  Times are specified
                  as HHMMSS.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     time       if set, specifies that the RANGE is to be interpreted as
                  a time range.  If unset or omitted, the RANGE is interpreted
                  as a record range.
     outfile    an optional string giving the name of the output SAVE file.  If
                  omitted, the data are placed in file !DEFAULTS.WORKDIR+GENERIC.SAV
     pshift     an optional 2-element array specifying the distance to shift
                  the phase center, in arcsec, as [x,y] with x positive W
                  and y positive N.
     notrack    an optional switch to inform FLAGOOL to disregard tracking
                  (i.e. bad tracking data are NOT flagged bad).
 ROUTINES CALLED:
     openarc, newscan, getcycle, flagool, gaincor, freescan, ovsa_adjtime
 OUTPUTS:
 COMMENTS:
     The name of this routine definitely needs to change to something more
     appropriate.
 CALLED BY:
	CHANPHZCHEK, DAILY, WANALYZE, XPOL_ANAL, ovsa_calib
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 07-Jan-1999 by Dale Gary
     29-Jan-1999  DG
       Add outfile keyword
     21-Jul-1999  DG
       Add output of TLS structure to .SAV file
     28-Aug-1999  DG
       Add POLCODE, and change input time range from seconds to more
       convenient HHMMSS.
     28-Mar-2000  DG
       Fix problem with routine getting into infinite loop when it hit
       the end of the file without an end of file record.
     31-Mar-2000  DG
       Added saving of original datafile name as o_datfile
     02-Apr-2000  DG
       Now works for all polarizations.  Removed POLCODE keyword.
     06-Apr-2000  DG
       Added saving of NDFAC, since this is needed for calibration.
     14-Apr-2000  DG
       Get rid of C:\TEMP references (use !Defaults.workdir)
     28-Jul-2000  DG
       Added HEADER to SAV file output, to provide NANT and AATAB
       Added code to extract uv values, and added some more outputs
       for Jeongwoo's mapping requirements.  ANALYZE needs to be
       considerably revamped for "production" purposes soon.
     04-Nov-2000  DG
       Added call to FREE_SCAN to free memory
     06-Mar-2001  DG
       Added solar info to GEOMETRY structure (in NEWSCAN) and changed
       to write a single file instead of three.
     18-Mar-2001  DG
       Previous change was a disaster for other code that assumed only
       one array name to hold the data, so all three polarizations, if
       they exist, are now contained in a single array.  The variable
       NPOL gives info about which polarizations exist.  NPOL=1 => I,
       NPOL=2 => R and L, NPOL=3 => R, L and I
     15-Dec-2001  DG
       Changed TAVG from a FLOAT to a LONG array.  Added OVSA_ADJTIME
       call, and save new variables MSOFF (time offsets for each data
       sample, in msec), TTP2M (time array for 2m double time resolution)
       and TP2M (total power for 2m at double time resolution).
     08-Jun-2002  DG
       Added PSHIFT keyword to allow specifying a shift of the phase center.
     17-Dec-2002  DG
       Added output of CFG structure to save file, and use /COMPRESS
       keyword.
     23-Dec-2002  DG
       Added NOTRACK keyword


ANIMPROF $SSW/radio/nrh/idl/1dnrh/profils/animprof.pro
[Previous] [Next]
 NAME:
	ANIMPROF

 PURPOSE:

	Cette procedure trace une serie d'images unidimensionnelles
	(intensite et/ou polarisation)animees
 CATEGORY:
	NRH1 profils

 CALLING SEQUENCE:
	 ANIMPROF,Images, Unit

 INPUTS:
	IMAGES Tableau d'images 2dim(espace,temps) ou 3dim(espace,temps,I:V)
		voir lec1d
	UNIT	Unite associee au tableau

 KEYWORD PARAMETERS:
	INTENSITE trace du parametre I
	POLAR	  trace du parametre V
	ATTENTE	  delais entre le trace de 2 images
	HEURES	  tTableau de chaine de caracteres [Heure debut,Heure de fin]
			format de l'heure "hh:mn:ss:ccc"
	CANAUX	  tableau contenant [Canal de debut, Canal de fin]
			format: valeurs entieres

 OUTPUTS:
	Trace des images sucessives

 CALLS: ***
	HMS, INDICE, LOADINTENS, LOADPOLAR, MOTCLE, MSH, NRH1_ANIM
 CALLED BY:
	MENUTRACEPROF
 COMMON BLOCKS:
	NRH1_GLOBAL

 MODIFICATION HISTORY: (bonmartin@obspm.fr)
	13/11/98) Adapte du logiciel XHELIO


ANTENNE_RH $SSW/radio/nrh/idl/dp_soft_rh/util_rh/rh_antenne.pro
[Previous] [Next]
 NAME: 
       ANTENNE_RH 
 
 PURPOSE: 
	Nom des antennes, tableau de chaines de caracteres.
 
 CALLING SEQUENCE: 
       S = rh_antenne(nbant)
 
 INPUTS:
	nbant: Nombre d'antennes

 KEYWORD PARAMETERS: 
       NONE.
 
 OUTPUTS: 
       rh_antenne(nbant) : tableau de chaines de caracteres.
 
 CALLS: ***
	RH_ANTENNE
 COMMON BLOCKS: 
	NONE.
 
 EXAMPLE: 
       s = RH_ANTENNE(nbant) 
 
 MODIFICATION HISTORY: 


APCAL_ADD_27M_RL $SSW/radio/ovsa/idl/util/apcal_add_27m_rl.pro
[Previous] [Next]
 NAME:
     APCAL_ADD_27M_RL
 PURPOSE:
     Routine to add results for RLI observation using the 27M antennas
     to existing AMPCAL and PHZCAL segment records.  This version for RL data.
 CATEGORY:
     OVRO APC DATA CALIBRATION
 CALLING SEQUENCE:
     apcal_add_27m_rl
 INPUTS:
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 ROUTINES CALLED:
     getparms, tlsnow, get_tl_struct, tl_encode, dayofyr
 OUTPUTS:
 COMMENTS:
     The values written to the file are in scaled, 2-byte integer form.  To convert
     the amplitude values back to units/SFU, read the integer value, multiply by 0.01,
     and apply to baseline data by multiplying the factors for BOTH antennas involved.
     To convert the phase values to degrees, read the integer value and multiply by 0.01.
     To apply to baseline data, use the phase difference for the two antennas.
 CALLS: ***
	CHECK_12AP, NINT [1], NINT [2], TLSNOW, TL_ENCODE
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 26-Jul-2005 by Dale E. Gary  (adapted from APCAL_ADD_27MANT)


APCAL_ADD_27MANT [1] $SSW/radio/ovsa/idl/util/apcal_add_27mant.pro
[Previous] [Next]
 NAME:
     APCAL_ADD_27MANT
 PURPOSE:
     Routine to add results for RLI observation using the 27M antennas
     to existing AMPCAL and PHZCAL segment records.
 CATEGORY:
     OVRO APC DATA CALIBRATION
 CALLING SEQUENCE:
     apcal_add_27mant[,/s273]
 INPUTS:
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     S273      If set, the calibrator is assumed to be 3C273 and the 3C273 fluxes are
                 applied.  Otherwise the calibrator is assumed to be 3C84.
 ROUTINES CALLED:
     getparms, tlsnow, get_tl_struct, tl_encode, dayofyr
 OUTPUTS:
 COMMENTS:
     The values written to the file are in scaled, 2-byte integer form.  To convert
     the amplitude values back to units/SFU, read the integer value, multiply by 0.01,
     and apply to baseline data by multiplying the factors for BOTH antennas involved.
     To convert the phase values to degrees, read the integer value and multiply by 0.01.
     To apply to baseline data, use the phase difference for the two antennas.
 CALLS: ***
	ERRPLOT [1], ERRPLOT [2], LOBE, NINT [1], NINT [2], TLSNOW, TL_ENCODE, readamf
 SIDE EFFECTS:
     Data are written to the files !DEFAULTS.EPHEMDIR+'AMPCAL.REC' and
     !DEFAULTS.EPHEMDIR+'PHZCAL.REC'.
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 30-Mar-2002 by Dale E. Gary  (adapted from APCAL_ADD_2MANT)
     03-Jan-2003  DG
       Implement new form of AMF file, and apply appropriate corrections
       to phases to convert them to forward order AB.  If the 12 baseline
       has antenna 1 as the second antenna (e.g. 21), then the phase has
       to be adjusted to reverse the order.  Normally this would simply
       mean a 180 degree phase shift, but the channel phase does NOT
       reverse, so it is more complicated.
     04-Jan-2003  DG
       Found an error.  The correct expressions are:
       Denote the channel phases as phi_BC, phi_CA, and phi_AB = 0.
       To invert a channel (which is done prior to the next step,
       if INFO.ORDER = -1, as read from AMF file), use
            phi = -2*phi_CA - 2*phi_BC - phi     for AB
            phi = -2*phi_CA            - phi     for BC
            phi =  4*phi_CA + 2*phi_BC - phi     for CA
       To apply the channel phase, simply subtract it:
            phi = phi - phi_AB for AB
            phi = phi - phi_BC for BC
            phi = phi - phi_CA for CA
       Note that for 12RLI AMF files, the channel phases are written
       differently from those in the 12n AMF files.  See AMPHIT for more
       info.
     10-Jan-2003  DG
       Fixed a subtle bug--the output file was not the same as the
       input file.
     08-Nov-2003  DG
       Added new 3C84 flux measurement, plus code to deal with differences
       having to do with the new 27-m polarization.


APCAL_ADD_27MANT [2] $SSW/radio/ovsa/idl/util/apcal_add_27mant_old.pro
[Previous] [Next]
 NAME:
     APCAL_ADD_27MANT
 PURPOSE:
     Routine to add results for RLI observation using the 27M antennas
     to existing AMPCAL and PHZCAL segment records.
 CATEGORY:
     OVRO APC DATA CALIBRATION
 CALLING SEQUENCE:
     apcal_add_27mant[,/s273]
 INPUTS:
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     S273      If set, the calibrator is assumed to be 3C273 and the 3C273 fluxes are
                 applied.  Otherwise the calibrator is assumed to be 3C84.
 ROUTINES CALLED:
     getparms, tlsnow, get_tl_struct, tl_encode, dayofyr
 OUTPUTS:
 COMMENTS:
     The values written to the file are in scaled, 2-byte integer form.  To convert
     the amplitude values back to units/SFU, read the integer value, multiply by 0.01,
     and apply to baseline data by multiplying the factors for BOTH antennas involved.
     To convert the phase values to degrees, read the integer value and multiply by 0.01.
     To apply to baseline data, use the phase difference for the two antennas.
 SIDE EFFECTS:
     Data are written to the files !DEFAULTS.EPHEMDIR+'AMPCAL.REC' and
     !DEFAULTS.EPHEMDIR+'PHZCAL.REC'.
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 30-Mar-2002 by Dale E. Gary  (adapted from APCAL_ADD_2MANT)
     03-Jan-2003  DG
       Implement new form of AMF file, and apply appropriate corrections
       to phases to convert them to forward order AB.  If the 12 baseline
       has antenna 1 as the second antenna (e.g. 21), then the phase has
       to be adjusted to reverse the order.  Normally this would simply
       mean a 180 degree phase shift, but the channel phase does NOT
       reverse, so it is more complicated.
     04-Jan-2003  DG
       Found an error.  The correct expressions are:
       Denote the channel phases as phi_BC, phi_CA, and phi_AB = 0.
       To invert a channel (which is done prior to the next step,
       if INFO.ORDER = -1, as read from AMF file), use
            phi = -2*phi_CA - 2*phi_BC - phi     for AB
            phi = -2*phi_CA            - phi     for BC
            phi =  4*phi_CA + 2*phi_BC - phi     for CA
       To apply the channel phase, simply subtract it:
            phi = phi - phi_AB for AB
            phi = phi - phi_BC for BC
            phi = phi - phi_CA for CA
       Note that for 12RLI AMF files, the channel phases are written
       differently from those in the 12n AMF files.  See AMPHIT for more
       info.
     10-Jan-2003  DG
       Fixed a subtle bug--the output file was not the same as the
       input file.


APCAL_ADD_2M_RL $SSW/radio/ovsa/idl/util/apcal_add_2m_rl.pro
[Previous] [Next]
 NAME:
     APCAL_ADD_2M_RL
 PURPOSE:
     Routine to add results for a single 2M antenna to existing
     AMPCAL and PHZCAL segment records.  This version for RL data.
 CATEGORY:
     OVRO APC DATA CALIBRATION
 CALLING SEQUENCE:
     apcal_add_2m_RL[,/s273]
 INPUTS:
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     S273      If set, the calibrator is assumed to be 3C273 and the 3C273 fluxes are
                 applied.  Otherwise the calibrator is assumed to be 3C84.
 ROUTINES CALLED:
     getparms, tlsnow, get_tl_struct, tl_encode, dayofyr
 OUTPUTS:
 COMMENTS:
     The values written to the file are in scaled, 2-byte integer form.  To convert
     the amplitude values back to units/SFU, read the integer value, multiply by 0.01,
     and apply to baseline data by multiplying the factors for BOTH antennas involved.
     To convert the phase values to degrees, read the integer value and multiply by 0.01.
     To apply to baseline data, use the phase difference for the two antennas.
 CALLS: ***
	CLOSE_ANT, ERRPLOT [1], ERRPLOT [2], LOBE, NINT [1], NINT [2], OKTOWRITE, TLSNOW
	TL_ENCODE, readamf
 SIDE EFFECTS:
     Data are written to the files !DEFAULTS.EPHEMDIR+'AMPCAL.REC' and
     !DEFAULTS.EPHEMDIR+'PHZCAL.REC'.
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 26-Jul-2005 by Dale E. Gary  (adapted from APCAL_ADD_2MANT)
     07-Nov-2005  DG
       I think the correction for channel phase was wrong--all I need to do is
       correct for the BEPHZ and apply ORDER, in that order.  This version is a
       test of that...


APCAL_ADD_2MANT $SSW/radio/ovsa/idl/util/apcal_add_2mant.pro
[Previous] [Next]
 NAME:
     APCAL_ADD_2MANT
 PURPOSE:
     Routine to add results for a single 2M antenna to existing
     AMPCAL and PHZCAL segment records.
 CATEGORY:
     OVRO APC DATA CALIBRATION
 CALLING SEQUENCE:
     apcal_add_2mant[,/s273]
 INPUTS:
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     S273      If set, the calibrator is assumed to be 3C273 and the 3C273 fluxes are
                 applied.  Otherwise the calibrator is assumed to be 3C84.
 ROUTINES CALLED:
     getparms, tlsnow, get_tl_struct, tl_encode, dayofyr
 OUTPUTS:
 COMMENTS:
     The values written to the file are in scaled, 2-byte integer form.  To convert
     the amplitude values back to units/SFU, read the integer value, multiply by 0.01,
     and apply to baseline data by multiplying the factors for BOTH antennas involved.
     To convert the phase values to degrees, read the integer value and multiply by 0.01.
     To apply to baseline data, use the phase difference for the two antennas.
 CALLS: ***
	CLOSE_ANT, ERRPLOT [1], ERRPLOT [2], LOBE, NINT [1], NINT [2], OKTOWRITE, TLSNOW
	TL_ENCODE, readamf
 SIDE EFFECTS:
     Data are written to the files !DEFAULTS.EPHEMDIR+'AMPCAL.REC' and
     !DEFAULTS.EPHEMDIR+'PHZCAL.REC'.
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 25-Mar-2002 by Dale E. Gary  (adapted from MAKE_APCAL)
     28-Mar-2002  DG
       Now produces reasonable results.
     03-Jan-2003  DG
       Implement new form of AMF file, and apply appropriate corrections
       to phases to convert them to forward order AB.  If the baseline
       involving antenna 1 has antenna 1 as the second antenna (e.g. 41),
       then the phase has to be adjusted to reverse the order.  Normally
       this would simply mean a 180 degree phase shift, but the channel
       phase does NOT reverse, so it is more complicated.
     04-Jan-2003  DG
       Found an error.  The correct expressions are:
       Denote the channel phases as phi_BC, phi_CA, and phi_AB = 0.
       To invert a channel (which is done prior to the next step,
       if INFO.ORDER = -1, as read from AMF file), use
            phi = -2*phi_CA - 2*phi_BC - phi     for AB
            phi = -2*phi_CA            - phi     for BC
            phi =  4*phi_CA + 2*phi_BC - phi     for CA
       To apply the channel phase, simply subtract it:
            phi = phi - phi_AB for AB
            phi = phi - phi_BC for BC
            phi = phi - phi_CA for CA
     10-Jan-2003  DG
       Fixed a subtle bug--the output file was not the same as the
       input file.


APCALCHEK $SSW/radio/ovsa/idl/analysis/apcalchek.pro
[Previous] [Next]
 NAME:
     APCALCHEK
 PURPOSE:
     Main routine to analyze phase calibration data.  Responds to scans of type
     PCAL (scan code 5).
 CATEGORY:
     OVRO APC DATA ANALYSIS
 CALLING SEQUENCE:
     apcalchek[,filename][,hrec,erec | ,after=after][,debug][,/cmdfile]
 INPUTS:
     filename   the name of the file containing PCAL data.  If
                  omitted, the file DAILY.ARC in directory
                  !DEFAULTS.WORKDIR is assumed.
     hrec       the record number of the PCAL scan header.  Data
                  will be processed up to the next EOS segment.
                  If this argument is given, then AFTER keyword
                  is ignored.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     erec       the end record number.  This is only needed as a
                  convenience for the PROGRESS Meter, and may be omitted.
     after      an optional time string of the standard form
                  [yyyy.ddd ]hh:mm[:ss]m after which to start
                  looking for a valid PCAL scan.
     cmdfile    a switch that indicates that the routine was called
                  from a command file, so issue no modal messages, and
                  print any error messages to <WORKDIR>\PCAL.MSG.
     debug      a switch that activates some debugging statements
                  for getting an indication of intermediate steps.
                  This switch is not compatible with /CMDFILE switch.
 ROUTINES CALLED:
     openarc, getdata, lasthrec, tl_decode, decode, get_centim, pldinit,
     gaincor, pldout
 OUTPUTS:
 COMMENTS:
     There will have to be modifications to this routine when
     additional antennas are available.
 CALLS: ***
	DECODE, FLAGOOL, GAINCOR, GETDATA, LASTHREC, OPENARC, POLY_FIT, PROGMETER, TL_DECODE, WSTR
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 22-Aug-1998 by Dale Gary (simple adaptation from PCALCHEK)
     23-Aug-1998  DG
       Fixed bug in polarization code determination.
     25-Aug-1998  DG
       Added check for new TRAJECTORY segments (but contents ignored
       for now.)
     05-Feb-2000  DG
       Removed now unnecessary sin and cos lookup tables in GAINCOR call.


APPLY_BEPHZ $SSW/radio/ovsa/idl/util/apply_bephz.pro
[Previous] [Next]
 NAME:
     APPLY_BEPHZ
 PURPOSE:
     Correct for the non-zero phase induced by phase switching and
     synchronous sampling in the Mk II backend.
 CATEGORY:
     OVRO APC DATA ANALYSIS
 CALLING SEQUENCE:
     apply_bephz,muxarr,s,c,upper,choff,data
 INPUTS:
     muxarr   An NANT x NANT array giving the code determining whether
                a given baseline is AB (=0), BC (=-1), or CA (=1).
     s        An array of indexes into the NANT x NANT array giving
                sine channels
     c        An array of indexes into the NANT x NANT array giving
                cosine channels
     upper    An array of indexes into the NANT x NANT array giving
                the channels in the same order as in DATA.
     choff    An array of offsets into the DATA array corresponding
                to the channels in S and C.
     data     An array of size (NANT*NANT,NF) giving the data for one
                cycle of the observing sequence (input and output)
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 ROUTINES CALLED:
 OUTPUTS:
     data     On output, the corrected data, in the same format as on
                input.
 COMMENTS:
 CALLED BY:
	GAINCOR
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 03-Jan-2003 by Dale E. Gary


APPLY_BLDIR $SSW/radio/ovsa/idl/util/apply_bldir.pro
[Previous] [Next]
 NAME:
     APPLY_BLDIR
 PURPOSE:
     Impose the convention that a baseline with increasing antenna order
     (e.g. 1-2 or 4-5) is positive while one taken with decreasing
     order (2-1 or 5-4) is negative.  This is necessary to allow data
     taken in different MUX modes to be compared.  Also applies the
     backend channel phase corrections.
 CATEGORY:
     OVRO APC DATA ANALYSIS
 CALLING SEQUENCE:
     apply_bldir,chanphz,bldir,s,c,data,uv
 INPUTS:
     chanphz  An NANT x NANT array giving the AB, BC, or CA backend
                channel phase corrections (units of radians), to be
                subtracted from the data
     bldir    An NANT x NANT array giving the "baseline direction"
                as +1 for increasing antenna order (e.g. 1-2 or 4-5),
                and -1 for decreasing antenna order (2-1 or 5-4).
     s        An array of indexes into the NANT x NANT array giving
                sine channels
     c        An array of indexes into the NANT x NANT array giving
                cosine channels
     data     An array of size (NANT*NANT,NF) giving the data for one
                cycle of the observing sequence (input and output)
     uv       An NANT x NANT array containing the u,v coordinates in
                nsec.  U is contained in the upper non-diagonal elements
                and V is in the lower non-diagonal elements (input and output)
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 ROUTINES CALLED:
 OUTPUTS:
     data     On output, the corrected data, in the same format as on
                input.
     uv       An NANT x NANT array containing the u,v coordinates in
                nsec.  U is contained in the upper non-diagonal elements
                and V is in the lower non-diagonal elements.  on output
                those baselines with negative BLDIR have a changed sign.
 COMMENTS:
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 07-Nov-2002 by Dale E. Gary


APPLY_CAL $SSW/radio/ovsa/idl/util/apply_cal.pro
[Previous] [Next]
 NAME:
     APPLY_CAL
 PURPOSE:
     Applies the total power, or amplitude and phase calibration contained
     in REFCAL, to a dynamic spectrum for a single antenna or baseline and
     a single polarization.
 CATEGORY:
     OVRO APC CALIBRATION
 CALLING SEQUENCE:
     apply_cal,amp,pha,time,freq,ipol,ibl,refcal
 INPUTS:
     amp       a dynamic spectrum of size (NF,NTIMES), for a single antenna
                 (in the case of total power), or a single baseline (in the
                 case of amplitude data), and a single polarization.
                 NB: the updated values are returned in AMP, overwriting
                 its contents.
     pha       an array of the same type as AMP, containing the phase for
                 the same baseline.  If AMP is total power (as indicated by
                 IBL value) then pha is not used, but must be supplied (e.g.
                 use a constant such as zero).
                 NB: the updated values are returned in PHA, overwriting
                 its contents.
     time      an array of size (NTIMES) containing the times for the
                 AMP and PHA arrays [msec].
     freq      an array of size (NF) containing the frequencies for the
                 AMP and PHA arrays [GHz].
     ipol      a constant specifying the polarization type: 0=RCP, 1=LCP,
                 and 2=LIN, of the data in AMP and PHA.
     ibl       a constant specifying the antenna or baseline of the data in
                 AMP and PHA.  Note that this is the index into the REFCAL
                 arrays, and its meaning will depend on the number of antennas
                 and baselines.  Values 0 to NANT-1 indicate total power for
                 antenna ANT[IBL].  Values NANT to NANT+NBL-1 indicate
                 amplitude and phase for baseline IBL-NANT.  For example, here
                 are the 21 values for 6 antennas: 0=Ant 1, 1=Ant 2, 2=Ant 4,
                 3=Ant 5, 4=Ant 6, 5=Ant 7, 6=Baseline 12, 7=Baseline 14,
                 8=Baseline 15, ... 11=Baseline 24, 12=Baseline 25, ...
                 14=Baseline 27, 15=Baseline 45, ... 20=Baseline 67.
     refcal    the complete REFCAL structure as returned from NEWSCAN.  The
                 information from REFCAL is applied to the AMP and PHA arrays
                 to calibrate the total power or amplitudes and phases.  In
                 the case of phase, both the reference calibration and the
                 daily (time-dependent) phase calibration are applied.  In the
                 case of total power or amplitude, both the reference calibration
                 and the update calibration are applied.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 ROUTINES CALLED:
     lobe
 OUTPUTS:
     amp       the same dynamic spectrum as the input, except with calibration
                 applied.  NB: this overwrites the contents of the input.
     pha       the same dynamic spectrum as the input, except with calibration
                 applied.  NB: this overwrites the contents of the input.
 COMMENTS:
 CALLS: ***
	LOBE, NINT [1], NINT [2]
 CALLED BY:
	APPLY_CAL_ALL, APPLY_CAL_ALL_2M, SOLAID
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 29-Jul-2000 by Dale E. Gary
     07-Oct-2000  DG
       Fixed problem with application of phase calibration for a
       single frequency.
     07-Apr-2001  DG
       Fixed a bug that occurred when there was no DAILY calibration.


APPLY_CAL_ALL $SSW/radio/ovsa/idl/util/apply_cal_all.pro
[Previous] [Next]
 NAME:
     APPLY_CAL_ALL
 PURPOSE:
     Applies the total power, amplitude and phase calibration contained
     in REFCAL, to data output by ANALYZE.
 CATEGORY:
     OVRO APC CALIBRATION
 CALLING SEQUENCE:
     out = apply_cal(tavg,avg,f,refcal)
 INPUTS:
     tavg      an array of size (NTIMES) containing the times for the
                 AMP and PHA arrays [msec].
     avg       an array of size (NCHAN,NF,NTIMES,NPOL) containing the
                 uncalibrated data output by ANALYZE
     freq      an array of size (NF) containing the frequencies for the
                 AMP and PHA arrays [GHz].
     refcal    the complete REFCAL structure as returned from NEWSCAN.  The
                 information from REFCAL is applied AVG array to calibrate
                 all of the channels.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 ROUTINES CALLED:
     apply_cal
 OUTPUTS:
     out       the same as the AVG input, except with calibration
                 applied.
 COMMENTS:
 CALLS: ***
	APPLY_CAL, PROGMETER
 CALLED BY:
	OVSA_EXPLORER formerly OVSA_PRESUB, OVSA_PRESUB, RELVIS, calib_rate
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 29-Mar-2001 by Dale E. Gary
     08-Dec-2001  DG
       Added progress meter.


APPLY_CAL_ALL_2M $SSW/radio/ovsa/idl/util/apply_cal_all_2m.pro
[Previous] [Next]
 NAME:
     APPLY_CAL_ALL_2M
 PURPOSE:
     Applies the calibration contained in REFCAL, to 2M total power
     (double time) data output by ANALYZE.
 CATEGORY:
     OVRO APC CALIBRATION
 CALLING SEQUENCE:
     tp2mc = apply_cal_all_2m(ttp2m,tp2m,f,refcal)
 INPUTS:
     ttp2m     an array of size (NTIMES) containing the times for the
                 TP2M array [msec].
     tp2m      an array of size (NCHAN,NF,NTIMES) containing the
                 uncalibrated TP2M data output by ANALYZE
     freq      an array of size (NF) containing the frequencies for the
                 TP2M array [GHz].
     refcal    the complete REFCAL structure as returned from NEWSCAN.  The
                 information from REFCAL is applied to the TP2M array to
                 calibrate all of the 2M total power channels.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 ROUTINES CALLED:
     apply_cal
 OUTPUTS:
     tp2mc     the same as the TP2M input, except with calibration
                 applied.
 COMMENTS:
 CALLS: ***
	APPLY_CAL
 CALLED BY:
	OVSA_EXPLORER formerly OVSA_PRESUB
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 15-Dec-2001 by Dale E. Gary


ARLOCPLOT $SSW/radio/ovsa/idl/util/arlocplot.pro
[Previous] [Next]
 NAME:
     ARLOCPLOT
 PURPOSE:
     Plot active region and phase center locations on the solar disk
     for a solar scan, and allow readout of coordinates using the mouse.
 CATEGORY:
     OVRO APC DATA ANALYSIS
 CALLING SEQUENCE:
     arlocplot,filename,hrec
 INPUTS:
     filename   the name of the file containing the data.
     hrec       the record number of the scan header for a solar scan.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 ROUTINES CALLED:
     openarc, newscan, freescan, ovsa_get_index, findseg, getdata, decode,
     cvdoy, cnv_xy2h, cnv_h2xy, stonyhurst
 OUTPUTS:
 COMMENTS:
     Crude exit indicator: Click on left side within 10 pixels of edge
     of window to exit.
 CALLS: ***
	BDOTS, CNV_H2XY, CNV_XY2H, CVDOY, DECODE, FINDSEG, FREESCAN, GETDATA, HMS2SEC, JULDAY
	LOADCT, NEWSCAN, OPENARC, OVSA_GET_INDEX, OVSA_LST, PANDB, TL_DECODE, stonyhurst
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 31-May-2002 by Dale Gary
     08-Jun-2002  DG
       Cleaned up coordinate display, and made it exit gracefully.
     11-Jan-2004  DG
       Added plot of position angle of fringes.  Currently only does 12
       baseline, but easily expanded to do any baseline--I just need a
       way for the user to specify the desired baseline.


ASCII Write $SSW/radio/ethz/idl/io/ascii_write.pro
[Previous] [Next]
 NAME:
 	ASCII Write
 PURPOSE:
	Writes an array in ASCII file with an optional header.
 CALLING SEQUENCE:
	ASCII_Write, array [, header]
 INPUTS:
	array: the array to write, may be of any dimension.
	header: an optional header, an array of strings
 KEYWORDS;
	FILENAME: for defining the name of the file. If not
		present, the name of the file will be the
		contents of the variable "!p.title" without
		blanks, appended with {\it .dat}.
	INTERACTIVE: if the "FILENAME" keyword is not
		set the filename will be asked interactively
 SIDE EFFECT:
	A file is written
 RESTRICTION:
	The elements of the 2D array are written in the reverse
	order as on the VAX VMS FORTRAN system. Namely, 
	in WAVE, blocks of x coordinates are written.
 CALLS: ***
	ASCII_WRITE
 MODIFICATION HISTORY:
	Created by A.Csillaghy in September 1991
		Inst. of Astronomy, ETH Zurich
       Modified March 98 for IDL5/ssw/ragview ACs.


ASCII_Read $SSW/radio/ethz/idl/io/ascii_read.pro
[Previous] [Next]
 NAME: 
	ASCII_Read
 PURPOSE:
	Read ASCII formatted files, which contains a two-
	dimaensionnal array of data with an optional header. 
	The dimensions must be known and are asked to the user.
 CATEGORY:
	Input/Output
 CALLING SEQUENCE:
	ASCII_Read, filename, image [, header ]
 INPUT ARGUMENTS:
	filename: the complete filename.
	header: if present, a header is assumed to be in the file.
	image: any variable of the type to read.
 KEYWORDS:
	NX, NY: the dimensions of the data array. If not given,
		they will be asked interactively.
 OUTPUT ARGUMENTS:
	image: The data array read.
	header: the file header.
 CALLS: ***
	Read_Test
 CALLED BY:
	Files_Handling [1], Files_Handling [2]
 SIDE EFFECTS:
	The terminal window is used to read the dimensions.


AUTOCAL $SSW/radio/ovsa/idl/util/autocal.pro
[Previous] [Next]
 NAME:
     AUTOCAL
 PURPOSE:
     Start the SCHEDULE, running an existing AUTOCAL schedule, and then
     generate a SCHEDULE file for taking Cas A and 3C84 calibration
     observations 28 days in advance of the current day.  This is
     part of a scheme to automatically obtain calibration observations
     every 4 weeks, on Sunday.
 CATEGORY:
     OVRO APC DATA CALIBRATION
 CALLING SEQUENCE
     autocal[,ndays]
 INPUTS:
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     ndays     The number of days hence to make the new schedule for.  If
                 omitted, 28 days is assumed as a default.  If zero, the
                 schedule is not run at all, just a new schedule is created.
 ROUTINES CALLED:
     doyddmm (internal routine)
 OUTPUTS:
 COMMENTS:
 CALLS: ***
	CALDAT, DAYOFYR [1], DOYHHMM, SCHEDULE, UPTIME, dayofyr [2], get_logenv [1]
	get_logenv [2]
 SIDE EFFECTS:
     Immediately starts the SCHEDULE with the current AUTOCAL.SCD file.
     Creates the file !DEFAULTS.WORKDIR+'autocal.scd' containing the
     schedule for 28 days hence (overwriting the current file contents),
     and starts an "at" job (if at OVRO) to run at the correct date and
     time in the future.
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 05-Oct-2000 by Dale E. Gary
     29-Dec-2000  DG
       Added optional NDAYS argument.


autocorr $SSW/radio/ethz/idl/ragview/modify/autocorr.pro
[Previous] [Next]
 PURPOSE: 
	Computes the autocorrelation of an image or a vector.
 CALLING SEQUENCE:
	result = AutoCorr( image )
 INPUT:
	image: a 2D array (or 1D array), real
 RESULT:
	the autocorrelated image
 KEYWORD:
	/NORMALIZED: if set, the autocorrelation is normalized.
	XLAGMAX: the max. lag used in the "square sum" method, 
		 the limit of the array returned in the FFT method.
		 default:  nx-1 (nx: nb elements in x)
	YLAGMAX: the max. lag used in the "square sum" method, 
		 the limit of the array returned in the FFT method.
		 default: ny-1 (ny: nb elements in y)
	SQUARESUM: output of the sum of the elements squared.
	FAST: if set the Wiener-Khinchin theorem is used. 
		Otherwise it is calculated from its definition.
		
 CALLS: ***
	AVG [1], AVG [2]
 CALLED BY:
	Modification of 1D Plots, Modify Image Pixels, RAG Exponentiation, RAG Log
 PROCEDURE:
	With the Wiener-Khintchin Theorem: the
	autocorrelation of an image is the backward fourrier
	transform of the power spectrum.
	With the definition: see the manual.
	With FFT: In the two-dimensional case, the 0 lag
	is shifted to the middle of the picture (i.e. the
	image is symmetrical. In the FFT 1dimensional case,
	however, only one half of the autocorrelation
	is shown (and therefore not shifted).
 RESTRICTION:
	The Fourier method is much faster, but much less
	accurate than the method based on the algorithm.
       CAUTION: the FFT method assumes periodic boundaries,
	i.e. the function is repeated infinitely.
 MODIFICATION HISTORY:
	Created in August 1991 by A.Csillaghy
		Inst. of Astronomy, ETH Zurich
	FFT Case: 1d no shift in July 1995, ACs.


Automatic polarization determination with background subtraction $SSW/radio/ethz/idl/util/polarization.pro
[Previous] [Next]
 NAME:
       Automatic polarization determination with background subtraction

 PURPOSE:
       Determine the L/R-Polarization of a data point using the
       following steps:
		1) Let user choose a point and two reference bands
                  for background subtraction
		2) Search and open the p- and i-file(s) containing the
                  specified time/frequency data
		3) Calculate R and L intensities for data point and
                  background reference bands, subtract background,
                  calculate new polarization

 CALLING SEQUENCE
	DriftRate, zReal, xAxis, yAxis, WINNR=WINNR

 INPUTS:
       xAxis: the x-axis of the displayed image zone
       yAxis: the corresponding y-axis 

 KEYWORDS:
       WINNR: If set, the specified window contains the image to be
              treaten, otherwise the active window is taken.

 CALLS: ***
	DATATYPE [1], DATATYPE [2], DATATYPE [3], GETBREAKS, GETIMAGESIZES, GETOFFSETS
	HMSCONVERT, MEAN, POLARIZATION, STRN [1], STRN [2], STRN [3], SWAPVARS, XKILL, XMESSAGE
	devtopix, rapp_get_spectrogram
 SIDE EFFECTS:

 RESTRICTIONS:

 MODIFICATION HISTORY:
       02/01/30 Initial version
                Oliver Trachsel <toliver@astro.phys.ethz.ch>
		 Institute of Astronomy, ETH Zurich


Axis Time $SSW/radio/ethz/idl/ragview/display/axistime.pro
[Previous] [Next]
 NAME:
	Axis Time
 PURPOSE:
	Writes x axis with hours / minutes / seconds labels
 CALLING SEQUENCE:
	AxisTime, yPosition, range [, ps]
 INPUT PARAMETERS:
	yPosition: the height where the horizontal axis is placed
	axisRange = a 2-element array containing the minimum 
		and maximum of the plot
	ps: is 1 if the device is PostScript, 0 otherwise.
 KEYWORDS: 
	AXISTYPE = 1 -> axis has ticks down
	AXISTYPE = 0 -> axis has ticks up
	/NOLABELS: The tick names are not drawn
	/NORMAL: The values given in the parameters are
		in normalized coordinates. Default: device
		coordinates.
	CHARSIZE: defines the (relative) character size.
		Default: !p.charsize
 SIDE EFFECT:
	In the current plot window, an axis with time units is 	;	drawn.
 RESTRICTION:
	The axis range is continuous.
 SEE ALSO
	enrad, show_image
 CALLS: ***
	AXISTIME, HMSCONVERT
 MODIFICATION HISTORY:
	Written in November 1991 by A.Csillaghy
		Inst. of Astronomy, ETH Zurich.
	Heavy modifications in July 1992 for better display. A.Cs
	Thresholds for drawing the labels lower modified, A.Cs
		Dec. 92
	Adaptation of tick marks in ps format: Jun 93, A.Cs
	CHARSIZE in Nov 94, ACs.