BASEPHZ $SSW/radio/ovsa/idl/util/basephz.pro
[Previous] [Next]
 NAME:
     BASEPHZ
 PURPOSE:
     Allows interactive adjustment of frequency-dependent phase
     slope and offset in a single "baseline" measurement (a scan
     processed with ANALYZE, and creates or adds a line to an
     output file suitable for input to the BASFIT baseline fitting
     routine.
 CATEGORY:
     OVSA APC CALIBRATION
 CALLING SEQUENCE:
     basephz,filename[,calfile=calfile]
 INPUTS:
     filename   The name of the .SAV file created by ANALYZE, containing
                  processed (averaged) data from a PCAL scan, organized
                  into a time series of spectral information.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     calfile    The name of a suitable phase and amplitude calibration
                  file produced by AMPHIT.  The file contains amplitude,
                  phase, and uncertainties in amplitude and phase, for
                  a list of frequencies, for a list of baselines IN ORDER
                  [12, 14, 15, 16, 24, 25, 26].  If omitted, or included
                  but equal to an empty string [''], the user
                  is asked to input a filename.
 ROUTINES CALLED:
     cal_pclose, amphit, wphzfit
 OUTPUTS:
 COMMENTS:
 CALLS: ***
	AMPHIT, BREAK_FILE [1], BREAK_FILE [2], BREAK_FILE [3], CAL_PCLOSE, NINT [1]
	NINT [2], WPHZFIT, break_file [4]
 CALLED BY:
	WANALYZE
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 01-Jul-1999 by Dale E. Gary
     31-Mar-2000  DG
       Significant cleanup and documentation.  Now writes a standard format
       file that no longer needs editing!
     14-Apr-2000  DG
       Get rid of C:\TEMP references (use !Defaults.workdir)
     10-May-2000  DG
       Change handling of AMPHIT to reflect change of format of OUT array
       returned by AMPHIT.
     05-Jul-2000  DG
       Now uses a variable NF=6 rather than the number 6, but the number of
       frequencies is still hardwired, just in only one place now.  Probably
       the CALFILE (just an AMPHIT file) should contain the number of frequencies.
     01-Jan-2001  DG
       Changed to read the number of frequencies, baselines, and scans from
       the .CAL file (Just an AMPHIT file).  Also, if the .CAL file contains
       more frequencies than the data, that is okay--only the appropriate
       frequencies will be used.
     30-Aug-2004  DG
       Fixed some things to reflect changes to AMPHIT file (.AMF) format.
       Also added information string in call to WPHZFIT.


BASFIT $SSW/radio/ovsa/idl/fitting/basfit.pro
[Previous] [Next]
 NAME:
     BASFIT
 PURPOSE:
     Given a list of sources and corresponding 1 GHz phases
     determined by BASEPHZ routine, determines phase change for
     slightly different baseline lengths in a 3D matrix, applies
     the phase change to data from each baseline, and locates
     the set of baseline shifts dBx, dBy, dBz that give the
     smallest residuals.
 CATEGORY:
     OVRO APC INSTRUMENT CALIBRATION
 CALLING SEQUENCE:
     resid = basfit(infile,amfile,minphz[,stepsize][,blcor=blcor][,nsteps=nsteps])
 INPUTS:
     infile    the name of a file that contains the list of source
                 data.  Consists of one line for each source measurement.
                 Each line has filename, scan header record, time, and list
                 of 1 GHz phases (from BASEPHZ routine) and chi-square,
                 one pair for each baseline (14 numbers all together).
     amfile    the routine has been changed to ignore most of the contents
                 of infile (although the filename, hrec, and time are
                 still important), and instead use the output of AMPHIT
                 (specifically WAMPHIT) to fit all of the frequencies
                 instead of simply a best fit line.
     stepsize  the size of the step [cm] between adjacent points in the
                 3D search space.  3 cm is a good size to start with.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     blcor     an array of corrections from a previous run of BASFIT
                 (as returned by VIS_BASFIT routine), to apply before
                 starting the search in phase space.  Of size (3,NBL)
                 where the first index if for the three axes Bx, By,
                 and Bz, and NBL is the number of baselines.
     nsteps    either a single value or a 3-element array giving the
                 number of steps IN EACH DIRECTION to include in the
                 search.  The actual number of steps is NSTEPS*2 + 1 in
                 each dimension.  If a single value, the same number
                 of steps is used in each axis.  If a 3-element array
                 is given, they are interpreted as NX,NY,NZ.  If omitted,
                 NX = NY = NZ = 8 is used as the default.

 ROUTINES CALLED:
 OUTPUTS:
     resid   the giant array of residuals, of size
                       (NSTEPS*2+1,NSTEPS*2+1,NSTEPS*2+1,NBL),
               where the indexes are BX offset, BY offset, BZ offset (all
               ranging from -NSTEPS to NSTEPS in units of the stepsize),
               and the baseline number.
     minphz  an array of size (NANT,NANT,NMEAS) containing both the
               original phase information (in the bottom diagonal part of
               the NANT x NANT matrix) and the phases for the set of
               baselines with the minimum residuals (upper diagonal part
               of the NANT x NANT matrix)
 COMMENTS:
     The residuals and a comparison of minimum phases with input phases
     can be viewed using VIS_BASFIT routine.
 CALLS: ***
	BASFIT_RESID, DELAY, NEWSCAN, OPENARC, PROGMETER, STR_SEP
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 01-Jul-1999 by Dale E. Gary
     05-July-2000  DG
       Several changes to make it work with any number of antennas (maybe), and
       for a settable number of steps in each axis.  Also now uses all of the
       phases directly rather than the phase slope fit by BASEPHZ (via the AMFILE
       input file).


BASLIN_PCLOSE $SSW/radio/ovsa/idl/support/baslin_pclose.pro
[Previous] [Next]
 NAME:
     BASLIN_PCLOSE
 PURPOSE:
     Force phase closure in baseline calibration data.
 CATEGORY:
     OVRO APC CALIBRATION
 CALLING SEQUENCE:
     blout = baslin_pclose(blin)
 INPUTS:
     blin    A float array of size (nb*2,nmeas) where NB=7 is the number of
                baselines for which the baseline calibration data were taken,
                and NMEAS is the number of measurements.  The first dimension
                is 2*NB because it consists of 7 phases and 7 chi-square
                values, alternating.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 ROUTINES CALLED:
     pclose
 OUTPUTS:
     blout  An exactly parallel array to BLIN, 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 01-Jul-1999 by Dale E. Gary


BDOTS $SSW/radio/ovsa/idl/interferometry/bdots.pro
[Previous] [Next]
 NAME:
     BDOTS
 PURPOSE:
     Given the current position coordinates (HA and Dec) and a header
     containing baseline info, calculate the time delay [nsec].  The
     routine gets its name from the fact that time delay is tau = B . S
     where B is the baseline vector and S is the position vector.
 CATEGORY:
     OVRO SPAN DATA-ANALYSIS
 CALLING SEQUENCE:
     tau = bdots(ha,dec,geometry,uv)
 INPUTS:
     ha        the current hour angle [msec]
     dec       the current declination [masec]
     geometry  the geometry structure as returned from NEWSCAN.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 ROUTINES CALLED:
 OUTPUTS:
     tau       an array of size NANT x NANT
                 containing the delay in nsec for each baseline
     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.
 COMMENTS:
 CALLED BY:
	ARLOCPLOT, DELAY, MAKE_SOLCALTRAJ, OVSA_UV
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 11-Mar-1997 by Dale Gary
     10-Jan-1999  DG
       Changed input argument name from HEADER to GEOMETRY
     01-Nov-1999  DG
       Add calculation of u,v coordinates (these will correspond
       to the start of the cycle.
     14-Mar-2000  DG
       Made some things explicitly DOUBLEs, possibly better accuracy.


BGND_INTERP $SSW/radio/ovsa/idl/util/bgnd_interp.pro
[Previous] [Next]
 NAME:
     BGND_INTERP
 PURPOSE:
     Given from one to three spectra representing the background at
     different intervals, return a flat, linear, or quadratic
     dynamic spectrum interpolated to the appropriate times.
 CATEGORY:
     OVRO APC ANALYSIS
 CALLING SEQUENCE:
     bgdynspec = bgnd_interp(bgspec,tspec,times)
 INPUTS:
     bgspec    The spectrum or spectra representing the background in
                 one to three intervals, of size [NF,N], where
                   N=1 => a flat background,
                   N=2 => a linear background,
                   N=3 => a quadratic background,
                   N>3 => a cubic spline background.
                 If N=1, a 1-D array of size [NF] may be used as input.
                 Any missing or bad data should be flagged with NaN.
     tspec     The center times of the intervals used to generate the
                 spectra in BGSPEC, in msec.
     times     An array of length [NTIMES], containing the times [msec]
                 at which to interpolate/extrapolate the background
                 spectrum.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
 ROUTINES CALLED:
 OUTPUTS:
     bgdynspec The background spectrum, of size [NF,NTIMES], representing
                 the time-dependent background sampled at times given in
                 the TIMES array.  If any frequency of the input DATA had
                 all NaN, then NaN will be returned in that element.
                 If input data are not as expected, -1 is returned.
 COMMENTS:
 CALLS: ***
	POLY_FIT, SPLINE
 CALLED BY:
	OVSA_EXPLORER formerly OVSA_PRESUB, OVSA_PRESUB
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 23-Nov-2001 by Dale E. Gary


BGND_INTVAL $SSW/radio/ovsa/idl/util/bgnd_intval.pro
[Previous] [Next]
 NAME:
     BGND_INTVAL
 PURPOSE:
     Given an interval of data for a single channel (TP or baseline
     data), return a spectrum representing the background of the
     interval.
 CATEGORY:
     OVRO APC ANALYSIS
 CALLING SEQUENCE:
     bgspec = bgnd_intval(data[,median=median])
 INPUTS:
     data      a dynamic spectrum of an interval of data for a single
                 channel, of size [NF,NTIMES] where NF is the number
                 of frequencies and NTIMES is the number of times in
                 the data.  Any missing or bad data should be flagged
                 with NaN.
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     median    If set, the median is used to determine the representative
                 spectrum, otherwise an average is used.
 ROUTINES CALLED:
 OUTPUTS:
     bgspec    the background spectrum, of size [NF], representing
                 the background of the interval.  If any frequency
                 of the input DATA had all NaN, then NaN will be returned
                 in that element.  If input data are not as expected,
                 -1 is returned.
 COMMENTS:
 CALLS: ***
	MEAN
 CALLED BY:
	OVSA_EXPLORER formerly OVSA_PRESUB, OVSA_PRESUB
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 23-Nov-2001 by Dale E. Gary


Build_Schedule $SSW/radio/ovsa/idl/support/build_schedule.pro
[Previous] [Next]
 NAME:
     Build_Schedule
 PURPOSE:
     Given an optional date (system date used if not specified), a
     schedule file (solar.scd) will be created from the tmp file
     (solar.tmp).  The program finds and replaces the day of the year,
     the time (based on the calibrator's times returned from the check_cals
     function) and/or the calibrator's name (again based on the calibrator's
     names returned from the check_cals function).  Then it outputs the
     modified lines to the schedule file.
 CATEGORY:
     OVRO APC DATA CALIBRATION
 CALLING SEQUENCE
     build_schedule,[date]
 OPTIONAL (KEYWORD) INPUT PARAMETERS:
     date       the date in the format : YYYY-MON-DD where MON is the first
                3 letters of the month
 ROUTINES CALLED:
     External: check_cals, msec2str, anytim, dayofyr, caldat, read_sched
 OUTPUTS:
     The output is the schedule file solar.scd
 COMMENTS:
 CALLS: ***
	CALDAT, DAYOFYR [1], anytim [1], anytim [2], anytim [3], anytim [4], anytim [5]
	check_cals, dayofyr [2], ssw_strsplit
 CALLED BY:
	SCHEDULE
 SIDE EFFECTS:
 RESTRICTIONS:
 MODIFICATION HISTORY:
     Written 13-Mar-2002 by Garrett Smith
     20-Mar-2002  DG
       Heavily rewritten to be more general and also to take advantage of
       some other code.
     30-Dec-2003  DG
       Changed name of STRPLIT to SSW_STRSPLIT to account for change in SSW