KANZ__DEFINE $SSW/gen/idl/synoptic/kanz__define.pro
[Previous] [Next]
 Project     : HESSI

 Name        : KANZ__DEFINE

 Purpose     : Define a KANZ data object

 Category    : Ancillary GBO Synoptic Objects

 Syntax      : IDL> c=obj_new('kanz')

 CALLS: ***
	DATATYPE [1], DATATYPE [2], DATATYPE [3], GET_UTC, KANZ::GET_SDIR, KANZ::INIT
	KANZ::RENAME_FILES, KANZ::SETPROP, KANZ::SYNOP, str_replace [1], str_replace [2]
	synop_link
 History     : Written 15 March 2000, D. Zarro, SM&A/GSFC

 Contact     : dzarro@solar.stanford.edu


KEYBOARD_CRS $SSW/gen/idl/display/keyboard_crs.pro
[Previous] [Next]
 Project     :	SOHO - CDS

 Name        :	
	KEYBOARD_CRS
 Purpose     :	
	Move the graphics cursor with the keyboard.
 Explanation :	
	This procedure uses the routine CURSOR to find the coordinates,
	expressed in data units, of a point selected with the cursor.  Rather
	than letting the mouse move the cursor, the cursor is moved from the
	keyboard, allowing the user to move in one direction without moving in
	the other direction.
 Use         :	
	KEYBOARD_CRS  [, X_VALUE  [, Y_VALUE  [, PRINT_SWITCH ]]]

	KEYBOARD_CRS		;Values printed to screen.
	KEYBOARD_CRS, X, Y	;Values stored in variables X and Y
	KEYBOARD_CRS, X, Y, 1	;Values stored in X,Y, and printed to screen.

 Inputs      :	
	None required.
 Opt. Inputs :	
	PRINT_SWITCH	- Switch used to control printing the values of 
			  X_VALUE, Y_VALUE to the screen.  If not passed,
			  then assumed 0 (no printing) unless no parameters
			  are passed, in which case 1 (printing) is assumed.
 Outputs     :	

 Opt. Outputs:	
	X_VALUE		- X position in data coordinates of cursor.
	Y_VALUE		- Y position in data coordinates of cursor.
 Keywords    :	
	None.
 Calls       : ***
	TRIM
 Common      :	
	None.
 Restrictions:	
	None.
 Side effects:	
	None.
 Category    :	
	Utilities, User_interface.
 Prev. Hist. :	
	William Thompson	Applied Research Corporation
	September, 1987		8201 Corporate Drive
				Landover, MD  20785
 Written     :	
	William Thompson, GSFC, September 1987.
 Modified    :	
	Version 1, William Thompson, GSFC, 9 July 1993.
		Incorporated into CDS library.
		Added call to CONVERT_COORD so as to be compatible with
			logarithmic plots.
 Version     :	
	Version 1, 9 July 1993.


keyword_db $SSW/gen/idl/util/keyword_db.pro
[Previous] [Next]
   Name: keyword_db

   Purpose: return info from one or more keyword database files
  
   Input Parameters:
      dbasefile - name of keyword dbase file (rd_tfile/rd_uline_col compat)
  
   Output Parameters:
      keywords -     list of keywords matching TAGLIST (default is all in db)
      exestrings -   execute-ready strings associated with keyword list
      descriptions - text descriptions associated with keyword list
  
   Keyword Parameters:
      taglist - optional taglist to include/convert (def=all in dbase)
                (array, comma delimited string)
      tagfile - name of ascii file which contains taglist (via rd_tfile)
      alphabetize - if set, return info in tag-alphbetic order
      head_db - name of header dbase file to use 
      refresh - if set, refresh common block
      exec_cmd (output) - EXECUTIVE execute strings (ex: .NONE. )
      quiet/loud - switches to determine noise level of routine
      XXX - any single TAG can be passed as a switch (keyword inheritance)
      loud/quiet - set noise level of procedure
  
   Calling Sequence:
      keyword_db, dbasefile, kout, exeout, descout, $
          taglist=taglist, tagfile=tagfile, strtemplate=strtemplate
          /xxx  

   Calling Example:
                       |----In----| |-------- OUT -------------|
      IDL> keyword_db, trace_keydb, keywords, exestr, descripts, $
              taglist='date_obs, day, mfilt1,wave_len'

      IDL> more, strjustify(keywords) + ' ' + descripts
            day      Days since 1-Jan-79
            date_obs Date/Time of Image
            mfilt1   Filter wheel 1 Position
            wave_len Wavelength length class (descriptor)

 CALLS: ***
	BOX_MESSAGE, CONCAT_DIR [1], CONCAT_DIR [2], CONCAT_DIR [3], FILE_EXIST [2]
	MERGE_STRUCT, STR2ARR [1], STR2ARR [2], UNIQ [1], UNIQ [2], UNIQ [3], concat_dir [4]
	data_chk [1], data_chk [2], file_exist [1], file_exist [3], is_member [1]
	is_member [2], rd_tfile [1], rd_tfile [2], rd_ulin_col, strspecial [1]
	strspecial [2]
 CALLED BY:
	write_trace
   History:
      7-March-1998 - S.L.Freeland - extract some ~generic code from
                     trace_dph2struct, allow multiple keyword databases

     10-March-1008 - SLF - update the structure common the way I originally
                           intended
  
   Method:
     for each dbase file, read,parse,store and optionally return TAGLIST subset  
     common block stores one structure for each uniq dbase file name


KILL_JOB $SSW/gen/idl/system/kill_job.pro
[Previous] [Next]
 Project     : SOHO - CDS

 Name        : KILL_JOB

 Purpose     : Kill a UNIX job

 Category    : Utility

 Explanation : e.g. kill_job,'telnet' to kill all jobs with the containing
               the string 'telnet'

 Syntax      : IDL> kill_job,job_name

 Inputs      : JOB_NAME = name of job to kill

 Keywords    : /CASE: job searching is case sensitive
               /EXACT: job name must be exact
               /VERBOSE: send messages

 CALLED BY:
	GET_NOAA, SMART_FTP
 Restrictions: UNIX only

 CALLS: ***
	ESPAWN, EXIST_JOB, OS_FAMILY, STR2ARR [1], STR2ARR [2], TRIM
 Side effects: None

 History     : Version 1,  5-Dec-1997,  D.M. Zarro.  Written

 Contact     : DZARRO@SOLAR.STANFORD.EDU


killold [1] $SSW/gen/idl/system/killold.pro
[Previous] [Next]
   Name: killold

   Purpose: kill old jobs (PIDs)

   Keyword Parameters:
      noconfirm - switch, if set, do not prompt before each kill
      testing   - switch, if set, just show what WOULD happen (no spawn)      
      hours     - age to kill (default is 24-48 hours)
      all       - kill all jobs (older than 10 minutes - dont kill THIS JOB)
      pattern   - if supplied, only consider jobs which include this pattern
      exclude   - if supplied, only consider jobs which do NOT include this
                     this pattern

   Calling Sequence:
      killold [,/noconfirm, /testing]

   Calling Example:
      killold,hours=8,/mail        ; kill jobs older than 8 hours and send mail

   Usage:
      run as a cron job with /noconfirm switch for automated cleanup 

 CALLS: ***
	OS_FAMILY, STR2ARR [1], STR2ARR [2], anytim2ints [1], anytim2ints [2]
	data_chk [1], data_chk [2], fmt_tim [1], fmt_tim [2], get_user [1], get_user [2]
	gt_day [1], gt_day [2], int2secarr [1], int2secarr [2], mail [1], mail [2]
	pr_status [1], pr_status [2], prstr [1], prstr [2], str2cols [1], str2cols [2]
	strjustify, timegrid
   Restrictions:
      Only cleans up jobs owned by account running it 
      (but thats a good and possible thing)
      Unix alpha-osf only (or others with identical "ps auxw" format)

   History:
      21-Dec-1995 (S.L.Freeland)
       5-jan-1996 (S.L.Freeland) - add MAIL keyword
      10-jan-1996 (S.L.Freeland) - use prstr instead of more
      11-jan-1996 (S.L.Freeland) - only mail if jobs killed 
       4-feb-1996 (S.L.Freeland) - add HOURS keyword and logic
      13-apr-1997 (S.L.Freeland) - message + return if non-UNIX -> SSW system
                                      root protect.
      15-jul-1997 (S.L.Freeland) - add PATTERN and EXCLUDE keyword & function
      16-jul-1997 (S.L.Freeland) - permit vectors for PATTERN and EXCLUDE 


KISF__DEFINE $SSW/gen/idl/synoptic/kisf__define.pro
[Previous] [Next]
 Project     : HESSI

 Name        : KISF__DEFINE

 Purpose     : Define a KISF data object for Kiepenheuer-Institute Obs.

 Category    : Ancillary GBO Synoptic Objects

 Syntax      : IDL> c=obj_new('kisf')

 CALLS: ***
	GET_UTC, KISF::GET_SDIR, KISF::INIT, KISF::SETPROP, KISF::SYNOP, synop_link
 History     : Written 15 March 2000, D. Zarro, SM&A/GSFC

 Contact     : dzarro@solar.stanford.edu


KORREL $SSW/gen/idl/image/korrel.pro
[Previous] [Next]
 NAME:
        KORREL
 PURPOSE:
        Calculate the x/y offset between an image (or a series of images)
        and a reference image.  Offsets are a co-registration
        algorithm.
 CATEGORY:
        Image Processing
 CALLING SEQUENCE:
        xy = korrel(image,reference,size,offset)
 INPUTS:
        image = 2-D or 3-D array.  Image(s) to be registered with reference.
        reference = 2-D array.  Reference image for co-registration.
        size = 2-element integer vector.  Size of the subimage of reference
               which is actually registered with image.  Make shure that
               this subimage completely falls within image.
        offset = 2-element integer vector.  Coordinates of first pixel of
                 the registration subimage within reference.
 OUTPUTS:
        xy = float(2,*).  x and y offsets of image(s) compared to reference.
             Positive values indicate that the first pixel of reference
             falls within the boundaries of image.
 KEYWORDS (INPUT):
        time = time in msec for each image (vector).  If supplied, the output
        array will be float(3,*), with xy(2,*) = time.
 CALLED BY:
	ALIGN_AR, sxt_av_teem
 COMMON BLOCKS:
        None.
 SIDE EFFECTS:
 RESTRICTIONS:
 PROCEDURE:
        Minimizes the sum of the pixel differences between the two images.
        Algorithm is brute force and not CPU efficient, but very robust
        (supposedly more robust than cross correlation).
        To make the same algorithm faster using a Monte Carlo Method: see
        Barnea and Silverman, 1972, IEEE Trans. Comput. Vol. C-21, p. 179.
 MODIFICATION HISTORY:
        JPW, Jan. 1992
        JPW, Aug. 92 im and ref can have different size now.


KPNO__DEFINE $SSW/gen/idl/synoptic/kpno__define.pro
[Previous] [Next]
 Project     : HESSI

 Name        : KPNO__DEFINE

 Purpose     : Define a KPNO data object

 Category    : Ancillary GBO Synoptic Objects

 Syntax      : IDL> c=obj_new('kpno')

 CALLS: ***
	ADD_TAG [1], ADD_TAG [2], DATATYPE [1], DATATYPE [2], DATATYPE [3], HAVE_TAG
	KPNO::CLEANUP, KPNO::INDEX2FITS, KPNO::INIT, REP_TAG_VALUE
 History     : Written 17 Feb 2001, D. Zarro, EIT/GSFC

 Contact     : dzarro@solar.stanford.edu


KSONE $SSW/gen/idl_libs/astron/math/ksone.pro
[Previous] [Next]
 NAME:
       KSONE
 PURPOSE:
       Compute the one-sided Kolmogorov-Smirnov statistic
 EXPLANATION:
       Returns the Kolmogorov-Smirnov statistic and associated probability for 
       for an array of data values and a user-supplied cumulative distribution
       function (CDF) of a single variable.   Algorithm from the procedure of
       the same name in "Numerical Recipes" by Press et al. 2nd edition (1992)

 CALLING SEQUENCE:
       ksone, data, func_name, D, prob, [ /PLOT ]

 INPUT PARAMETERS:
       data -  vector of data values, must contain at least 4 elements for the
               K-S statistic to be meaningful 
       func_name - scalar string giving the name of the cumulative distribution
               function.    The function must be defined to accept the data
               vector as its only input (see example), though keywords may be
               passed via the _EXTRA facility.

 OUTPUT PARAMETERS:
       D - floating scalar giving the Kolmogorov-Smirnov statistic.   It 
               specified the maximum deviation between the cumulative 
               distribution of the data and the supplied function 
       prob - floating scalar between 0 and 1 giving the significance level of
               the K-S statistic.   Small values of PROB show that the 
               cumulative distribution function of DATA is significantly 
               different from FUNC_NAME.

 OPTIONAL INPUT KEYWORD:
       PLOT - If this keyword is set and non-zero, then KSONE will display a
               plot of the CDF of the data with the supplied function 
               superposed.   The data value where the K-S statistic is 
               computed (i.e. at the maximum difference between the data CDF 
               and the function) is indicated by a vertical line.
               KSONE accepts the _EXTRA keyword, so that most plot keywords
               (e.g. TITLE, XTITLE, XSTYLE) can also be passed to KSONE.

 CALLS: ***
	PROB_KS
 EXAMPLE:
       Determine if a vector created by the RANDOMN function is really 
       consistent with a Gaussian distribution with unit variance.
       The CDF of a Gaussian is the error function except that a factor
       of 2 is included in the error function.   So we must create a special
       function:

       function gauss_cdf, x
       return, errorf( x/sqrt(2) )
       end

       IDL> data = randomn(seed, 50)          ;create data array to be tested
       IDL> ksone, abs(data), 'gauss_cdf', D, prob, /PLOT     ;Use K-S test
      
       PROB gives the probability that the null hypothesis (DATA came from a 
       Gaussian distribution with unit variance) is correct.

 NOTES:
       The code for PROB_KS is from the 2nd (1992) edition of Numerical 
       Recipes which includes a more accurate computation of the K-S 
       significance for small values of N than the first edition.

 PROCEDURE CALLS
       procedure PROB_KS - computes significance of K-S distribution

 REVISION HISTORY:
       Written     W. Landsman                   August, 1992
       Accept _EXTRA keywords   W. Landsman      September, 1995          
       Fixed possible bug in plot display showing position maximum difference
       in histogram   M. Fardal/ W. Landsman      March, 1997
       Converted to IDL V5.0   W. Landsman   September 1997
       Documentation updates   W. Landsman   June 2003
       Pass _EXTRA to func_name  M. Fitzgerald    April, 2005


KSTWO $SSW/gen/idl_libs/astron/math/kstwo.pro
[Previous] [Next]
 NAME:
       KSTWO
 PURPOSE:
       Return the two-sided Kolmogorov-Smirnov statistic
 EXPLANATION:
       Returns the Kolmogorov-Smirnov statistic and associated probability 
       that two arrays of data values are drawn from the same distribution
       Algorithm taken from procedure of the same name in "Numerical
       Recipes" by Press et al., 2nd edition (1992), Chapter 14

 CALLING SEQUENCE:
       kstwo, data1, data2, D, prob

 INPUT PARAMATERS:
       data1 -  vector of data values, at least 4 data values must be included
               for the K-S statistic to be meaningful
       data2 -  second set of data values, does not need to have the same 
               number of elements as data1

 OUTPUT PARAMETERS:
       D - floating scalar giving the Kolmogorov-Smirnov statistic.   It
               specifies the maximum deviation between the cumulative 
               distribution of the data and the supplied function 
       prob - floating scalar between 0 and 1 giving the significance level of
               the K-S statistic.   Small values of PROB show that the 
               cumulative distribution function of DATA1 is significantly 
               different from DATA2

 CALLS: ***
	PROB_KS
 EXAMPLE:
       Test whether two vectors created by the RANDOMN function likely came
       from the same distribution

       IDL> data1 = randomn(seed,40)        ;Create data vectors to be 
       IDL> data2 = randomn(seed,70)        ;compared
       IDL> kstwo, data1, data2, D, prob   & print,D,prob

 PROCEDURE CALLS
       procedure PROB_KS - computes significance of K-S distribution

 REVISION HISTORY:
       Written     W. Landsman                August, 1992
       FP computation of N_eff      H. Ebeling/W. Landsman  March 1996
       Converted to IDL V5.0   W. Landsman   September 1997
       Fix for arrays containing equal values J. Ballet/W. Landsman Oct. 2001


KUIPERONE $SSW/gen/idl_libs/astron/math/kuiperone.pro
[Previous] [Next]
 NAME:
       KUIPERONE
 PURPOSE:
       Compute the one-sided Kuiper statistic (invariant Kolmogorov-Smirnov)
 EXPLANATION:
       Returns the Kuiper statistic and associated probability
       for an array of data values and a user-supplied cumulative distribution
       function (CDF) of a single variable.   Algorithm adapted from KSONE
       in "Numerical Recipes" by Press et al. 2nd edition (1992)

       Kuiper's test is especially useful for data defined on a circle or 
       to search for periodicity (see Paltani 2004, A&A, 420, 789). 
 CALLING SEQUENCE:
       kuiperone, data, func_name, D, prob, [ /PLOT ]

 INPUT PARAMETERS:
       data -  vector of data values, must contain at least 4 elements for the
               Kuiper statistic to be meaningful
       func_name - scalar string giving the name of the cumulative distribution
               function.    The function must be defined to accept the data
               vector as its only input (see example).

 OUTPUT PARAMETERS:
       D - floating scalar giving the Kuiper statistic.   It
               specifies the sum of positive and negative deviations between the
               cumulative distribution of the data and the supplied function
       prob - floating scalar between 0 and 1 giving the significance level of
               the Kuiper statistic.   Small values of PROB show that the
               cumulative distribution function of DATA is significantly
               different from FUNC_NAME.

 OPTIONAL INPUT KEYWORD:
       PLOT - If this keyword is set and non-zero, then KUIPERONE will display a
               plot of the CDF of the data with the supplied function
               superposed.   The data values where the Kuiper statistic is
               computed (i.e. at the maximum difference between the data CDF
               and the function) are indicated by vertical dashed lines.
               KUIPERONE accepts the _EXTRA keyword, so that most plot keywords
               (e.g. TITLE, XTITLE, XSTYLE) can also be passed to KUIPERONE.

 CALLS: ***
	PROB_KUIPER
 EXAMPLE:
       Determine if a vector created by the RANDOMN function is really
       consistent with a Gaussian distribution.
       The CDF of a Gaussian is the error function except that a factor
       of 2 is included in the error function.   So we must create a special
       function:

       function gauss_cdf, x
       return, errorf( x/sqrt(2) )
       end

       IDL> data = randomn(seed, 50)          ;create data array to be tested
       IDL> kuiperone, data, 'gauss_pdf', D, prob, /PLOT     ;Use Kuiper test

       PROB gives the probability that DATA came from a Gaussian distribution

 NOTES:
       Note that the 2nd (1992) edition of Numerical Recipes includes
       a more accurate computation of the K-S significance for small
       values of N.

 PROCEDURE CALLS
       procedure PROB_KUIPER - computes significance of Kuiper distribution

 REVISION HISTORY:
       Written     W. Landsman                   August, 1992
       Accept _EXTRA keywords   W. Landsman      September, 1995
       Fixed possible bug in plot display showing position maximum difference
       in histogram   M. Fardal/ W. Landsman      March, 1997
       Converted to IDL V5.0   W. Landsman   September 1997
       Adapted from KSONE      J. Ballet     July 2003


KUIPERTWO $SSW/gen/idl_libs/astron/math/kuipertwo.pro
[Previous] [Next]
 NAME:
       KUIPERTWO
 PURPOSE:
       Compute the two-sided Kuiper statistic (invariant Kolmogorov-Smirnov)
 EXPLANATION:
       Returns the Kuiper statistic and associated probability 
       that two arrays of data values are drawn from the same distribution
       Algorithm adapted from KSTWO in "Numerical
       Recipes" by Press et al., 2nd edition (1992), Chapter 14

 CALLING SEQUENCE:
       kuipertwo, data1, data2, D, prob, [ /PLOT ]

 INPUT PARAMETERS:
       data1 -  vector of data values, at least 4 data values must be included
               for the Kuiper statistic to be meaningful
       data2 -  second set of data values, does not need to have the same 
               number of elements as data1

 OUTPUT PARAMETERS:
       D - floating scalar giving the Kuiper statistic.   It
               specifies the sum of positive and negative deviations between
               the cumulative distributions of the two data sets
       prob - floating scalar between 0 and 1 giving the significance level of
               the Kuiper statistic.   Small values of PROB show that the 
               cumulative distribution function of DATA1 is significantly 
               different from DATA2

 OPTIONAL INPUT KEYWORD:
       PLOT - If this keyword is set and non-zero, then KUIPERTWO will display
               a plot of the CDF of the two data sets.
               The data values where the Kuiper statistic is
               computed (i.e. at the maximum difference between the CDF of
               the two data sets) are indicated by vertical dashed lines.
               KUIPERTWO accepts the _EXTRA keyword, so that most plot keywords
               (e.g. TITLE, XTITLE, XSTYLE) can also be passed to KUIPERTWO.

 CALLS: ***
	PROB_KUIPER
 EXAMPLE:
       Test whether two vectors created by the RANDOMN function likely came
       from the same distribution

       IDL> data1 = randomn(seed,40)        ;Create data vectors to be 
       IDL> data2 = randomn(seed,70)        ;compared
       IDL> kuipertwo, data1, data2, D, prob   & print,D,prob

 PROCEDURE CALLS
       procedure PROB_KUIPER - computes significance of Kuiper distribution

 REVISION HISTORY:
       Written     W. Landsman                August, 1992
       FP computation of N_eff      H. Ebeling/W. Landsman  March 1996
       Converted to IDL V5.0   W. Landsman   September 1997
       Fix for arrays containing equal values J. Ballet/W. Landsman
       Oct. 2001
       Adapted from KSTWO, added PLOT keyword  J. Ballet     July 2004