Extended IDL Help

This page was created by the IDL library routine mk_html_help. For more information on this routine, refer to the IDL Online Help Navigator or type:

     ? mk_html_help

at the IDL command line prompt.

Last modified: Fri Nov 13 21:41:07 1998.


List of Routines


Routine Descriptions

BELONG

[Next Routine] [List of Routines]

Name : BELONG
        returns a binary integer (or a vector of binary integers)
        which specifies  whether a given Element belongs to a Set
        or not
                     
Calling Sequence:
      Result = BELONG(Element, Set)
Arguments 
      Element  : an element or a vector of elements to be tested
      Set : an array of values defining the set.
      Both may be any type of variables.
History
       Jongchul Chae :December 1996

(See ./belong.pro)


CR_CORRECT

[Previous Routine] [Next Routine] [List of Routines]

   NAME : CR_CORRECT
   PURPOSE :
           Correct for cosmic ray like defect
   CALLING SEQUENCE
            New_image      = CR_CORRECT(Old_image, Size=size, Cutoff=cutoff)
    INPUT:
           Old_image :  image to be corrected
    KEYWORD INPUTS:
           Size :   window size  for  median filtering (defualt=3)
           Cutoff : cutoff value  (default value=3.)
   OUTPUT:
           New_image : corrected image
   History
      June 1997    Jongchul Chae

(See ./cr_correct.pro)


CURVEFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       CURVEFIT

 PURPOSE:
       Non-linear least squares fit to a function of an arbitrary 
       number of parameters.  The function may be any non-linear 
       function.  If available, partial derivatives can be calculated by 
       the user function, else this routine will estimate partial derivatives
       with a forward difference approximation.

 CATEGORY:
       E2 - Curve and Surface Fitting.

 CALLING SEQUENCE:
       Result = CURVEFIT_C(X, Y, W, A, SIGMAA, FUNCTION_NAME = name, $
                         ITMAX=ITMAX, ITER=ITER, TOL=TOL, /NODERIVATIVE)

 INPUTS:
       X:  A row vector of independent variables.

       Y:  A row vector of dependent variable, the same length as x.

       W:  A row vector of weights, the same length as x and y.
               For no weighting,
               w(i) = 1.0.
               For instrumental weighting,
               w(i) = 1.0/y(i), etc.

       A:  A vector, with as many elements as the number of terms, that 
           contains the initial estimate for each parameter.  If A is double-
           precision, calculations are performed in double precision, 
           otherwise they are performed in single precision.

 KEYWORDS:
       FUNCTION_NAME:  The name of the function (actually, a procedure) to 
       fit.  If omitted, "FUNCT" is used. The procedure must be written as
       described under RESTRICTIONS, below.

       ITMAX:  Maximum number of iterations. Default = 20.
       ITER:   The actual number of iterations which were performed
       TOL:    The convergence tolerance. The routine returns when the
               relative decrease in chi-squared is less than TOL in an 
               interation. Default = 1.e-3.
       CHI2:   The value of chi-squared on exit
       NODERIVATIVE:   If this keyword is set then the user procedure will not
               be requested to provide partial derivatives. The partial
               derivatives will be estimated in CURVEFIT using forward
               differences. If analytical derivatives are available they
               should always be used.
      A_EXPECTED :  The expected value of the parameters (INPUT).
                 If omitted, initial guesses are used.
      A_WEIGHT : the inverse of the variances of the allowable difference between 
               the expected and the final parameters

 OUTPUTS:
       Returns a vector of calculated values.
       A:  A vector of parameters containing fit.

 OPTIONAL OUTPUT PARAMETERS:
       Sigmaa:  A vector of standard deviations for the parameters in A.

 COMMON BLOCKS:
       NONE.

 SIDE EFFECTS:
       None.

 RESTRICTIONS:
       The function to be fit must be defined and called FUNCT,
       unless the FUNCTION_NAME keyword is supplied.  This function,
       (actually written as a procedure) must accept values of
       X (the independent variable), and A (the fitted function's
       parameter values), and return F (the function's value at
       X), and PDER (a 2D array of partial derivatives).
       For an example, see FUNCT in the IDL User's Libaray.
       A call to FUNCT is entered as:
       FUNCT, X, A, F, PDER
 where:
       X = Vector of NPOINT independent variables, input.
       A = Vector of NTERMS function parameters, input.
       F = Vector of NPOINT values of function, y(i) = funct(x(i)), output.
       PDER = Array, (NPOINT, NTERMS), of partial derivatives of funct.
               PDER(I,J) = DErivative of function at ith point with
               respect to jth parameter.  Optional output parameter.
               PDER should not be calculated if the parameter is not
               supplied in call. If the /NODERIVATIVE keyword is set in the
               call to CURVEFIT then the user routine will never need to
               calculate PDER.

 PROCEDURE:
       Copied from "CURFIT", least squares fit to a non-linear
       function, pages 237-239, Bevington, Data Reduction and Error
       Analysis for the Physical Sciences.

       "This method is the Gradient-expansion algorithm which
       combines the best features of the gradient search with
       the method of linearizing the fitting function."

       Iterations are performed until the chi square changes by
       only TOL or until ITMAX iterations have been performed.

       The initial guess of the parameter values should be
       as close to the actual values as possible or the solution
       may not converge.

 EXAMPLE:  Fit a function of the form f(x) = a * exp(b*x) + c to
	sample pairs contained in x and y.
	In this example, a=a(0), b=a(1) and c=a(2).
	The partials are easily computed symbolicaly:
		df/da = exp(b*x), df/db = a * x * exp(b*x), and df/dc = 1.0

		Here is the user-written procedure to return F(x) and
		the partials, given x:
       pro gfunct, x, a, f, pder	; Function + partials
	  bx = exp(a(1) * x)
         f= a(0) * bx + a(2)		;Evaluate the function
         if N_PARAMS() ge 4 then $	;Return partials?
		pder= [[bx], [a(0) * x * bx], [replicate(1.0, N_ELEMENTS(x))]]
       end

         x=findgen(10)			;Define indep & dep variables.
         y=[12.0, 11.0,10.2,9.4,8.7,8.1,7.5,6.9,6.5,6.1]
         w=1.0/y			;Weights
         a=[10.0,-0.1,2.0]		;Initial guess
         yfit=curvefit(x,y,w,a,sigmaa,function_name='gfunct')
	  print, 'Function parameters: ', a
         print, yfit
       end

 MODIFICATION HISTORY:
       Written, DMS, RSI, September, 1982.
       Does not iterate if the first guess is good.  DMS, Oct, 1990.
       Added CALL_PROCEDURE to make the function's name a parameter.
              (Nov 1990)
       12/14/92 - modified to reflect the changes in the 1991
            edition of Bevington (eq. II-27) (jiy-suggested by CreaSo)
       Mark Rivers, U of Chicago, Feb. 12, 1995
           - Added following keywords: ITMAX, ITER, TOL, CHI2, NODERIVATIVE
             These make the routine much more generally useful.
           - Removed Oct. 1990 modification so the routine does one iteration
             even if first guess is good. Required to get meaningful output
             for errors. 
           - Added forward difference derivative calculations required for 
             NODERIVATIVE keyword.
           - Fixed a bug: PDER was passed to user's procedure on first call, 
             but was not defined. Thus, user's procedure might not calculate
             it, but the result was then used.
       Stein Vidar H. Haugan, Univ. of Oslo, 7 May 1996
           - Detecting NaN errors and deadlock repetitions inside the
           REPEAT loop.
       Jongchul CHAE, 1996
           - Introduce a regularizing term to prevent the degeneracy between
             parameters
           - Add new keyword paramters A_EXPECTED and A_weight
           - Eliminate forward difference derivative calulations 
           - Vectorize the program so as to fit a set of data points
             at a same time
               
           

(See ./curvefit_c.pro)


FILE_IN_PATH

[Previous Routine] [Next Routine] [List of Routines]

  NAME : 
       FILE_IN_PATH
  PURPOSE :
       Checks and finds a full string of a file name
       by searching through IDL paths    
  CALLING SEQUENCE :
       Result = file_in_path(filename, count=count)
  INPUTS :
       FILENAME    a string of the  file name  
  OUTPUTS:
       Result    a full string  including  directory and filename'
                  If the specified file exists, it returns the
                  file name without searching through IDL paths.
                  If more than one files are found in IDL paths,
                  the first one is returned.
                  If no file is found,  it returms the file name
                  but the keyword count has the value zero.    

  KEYWORDS:               
        COUNT      the number of existing files
                  
  REQUIRED ROUTINES:

         BREAK_PATH  LOCATE_DIR
  MODIFICATION HISTORY
        March 1997    Jongchul Chae

(See ./file_in_path.pro)


FTP_GETPUT

[Previous Routine] [Next Routine] [List of Routines]
  NAME:    FTP_GETPUT
  PURPOSE:  Get a file from or put it to a remote machine using FTP
  CALLING SEQUENCE:
           FTP_GETPUT, FILE, NODE, USER, PASSWD 
  INPUT:
           FILE    the file name to be gotten or put
           NODE    the node of the remote machine
           USER    user id  
           PASSWD  password. USER and PASSWD can be omitted if either
                   ANONYMOUS or AUTO_LOGIN keyword is set.
  KEYWORDS:
           REMOTE_DIR  the remote directory (default is the home directory)
           LOCAL_DIR   the local directory (deafult id the current directory)
           PUT         if set, the file is put (default id to get it)
           ASCII       if set, the ASCII mode is chosen (default is BINARY)
           ANONYMOUS   if set, anonymous FTP is tried.
           AUTO_LOGIN  if set, auto-login FTP is tried. This works
                       only UNIX-campatible machines and the file $HOME/.netrc
                       should exist and contain the proper infomation.
           STATUS      is set to 1 (success) or 0 (failure). Valid only for GET
                        
  HISTORY:
          1998 November    Created   Jongchul Chae  

(See ./ftp_getput.pro)


GAUSS_PROFILE

[Previous Routine] [Next Routine] [List of Routines]

 NAME : GAUSS_PROFILE

 PURPOSE :  Calcultes Gaussian profiles 

 CALLING SEQUENCE :

        Value = GAUSS_PROFILE(W, gauss_par)

 INPUTS:
    W          values at which the function is evaluated
               
    GAUSS_PAR  Normal Gaussian parameters 
               which define a Gaussian profile in the way :
 
                   continuum  = GAUSS_PAR(0,*,*)       in counts  
                   peak       = GAUSS_PAR(1,*,*)       in counts   
                   center     = GAUSS_PAR(2,*,*)       in pixels
                   width      = GAUSS_PAR(2,*,*)       in pixels 
                      
               I(W) = continuum+peak*exp(-0.5*((W-center)/width)^2)
 RESTRICTION:
               GAUSS_PAR should not be a scalar.
               The first dimension should be 4.

               If GAUSS_PAR is an 1-d array, then W can be any of
               scalar, 1-d array, 2-d array etc.
               IF GAU_PAR is a 2-d or 3-d array, then W should
               be either a scalar or 1-d array.

 OUTPUTS: 
      Value      spectral profiles
                 (1-d, 2-d or 3-d array)
                 with N0 x N1 X N2   elements
                  N0 = number  of X(*,0,0) elements
                  N1 x N2 = number of GAUSS_PAR(0,*,*) elements
         

 MODIFICATION HISTORY

        April 1997    Jongchul Chae

(See ./gauss_profile.pro)


IMAGE_COMPRESS

[Previous Routine] [Next Routine] [List of Routines]

   NAME : IMAGE_COMPRESS
           
   PURPOSE :
          Compress  an image into a byte image
   CALLING SEQUENCE :
           result = IMAGE_COMPRESS(image, direction, par, $
                minbyte=minbyte, maxbyte=maxbyte, $
                bytscl=bytscl, quasilog=quasilogm sqrt=sqrt
   INPUTS :
           IMAGE          input image
                          
           DIRECTION      if equal to 1, compression
                          if equal to -1, decompression
           PAR            compression parameters
                          (in the case of decompression)
   OUTPUTS:
           PAR            (in the case of compression)
   KEYWORDS :
           MINBYTE     The minimum value for
                       the compressed byte image (default=0)
           MAXBYTE     The maximum value for
                       the compressed byte image (default=255)        
           BYTSCl    if set, byte scaling method is used.
                       par(0) = maximum value of uncompressed image
                       par(1) = minimum value of uncompressed image
           QUASILOG    if set, quasi log compression is used.
                       par(0) = maximum value of uncompressed image
                       par(1) = minimum value of uncompressed image
    
   MODIFICATION HISTORY
          March 1997,  Jongchul Chae                    

(See ./image_compress.pro)


IMAGE_SCALE

[Previous Routine] [Next Routine] [List of Routines]
   NAME :  image_scale
   PURPOSE :
          Display image with a color scale

   CALLING SEQUENCE:
          image_scale,  image,  pos_dev, $
                        minvalue=min, maxvalue=max,  $
                        maxbyte=maxbyte, $
                        no_scale =no_scale, $
                        scale_pos=scale_pos, $
                        stitle=stitle, scale=scale, $
                        color=color 
   ARGUMENT
          image :   a two-dimensional  array to be displayed (INPUT)
          pos_dev : 

(See ./image_scale.pro)


LINE_PAR_CONV

[Previous Routine] [Next Routine] [List of Routines]

  NAME : LINE_PAR_CONV
        
  PURPOSE : Convert  normal Gaussian parameters into physical
            line parameters or vice versa.
        
  CALIING SEQUENCE :
           Value = LINE_PAR_CONV(data, wl, dispersion $
                    [, rest_pixel], reverse=reverse)


  INPUTS: 
          DATA    line fitting parameters
                   (1-d, 2-d, or 3-d floating array)
                   which define a Guassian profile in the way :
 
                   continuum  = DATA(0,*,*)       in counts  
                   peak       = DATA(1,*,*)       in counts   
                   center     = DATA(2,*,*)       in pixels
                   width      = DATA(2,*,*)       in pixels 
                      
               I(j) = continuum+peak*exp(-0.5*((j-center)/width)^2)

          WL        rest wavelength of the line given in angstroms
       
          DISPERSION   dispersion given in angstrom/pixel

 OPTIONAL INPUTS:

          REST_PIXEL  the pixel value corresponding to WL
                      if not specified, it is set to zero.  
                   
 OUTPUTS:
          VALUE    physical line parameters
                   (1-d, 2d-, or 3-d floating array)
                   
                   VALUE(0,*,*)  : continuum      in  counts
                   VALUE(1,*,*)  : integrated intensity in counts
                   VALUE(2,*,*)  : Doppler Shift in km/s defined by

                     shift = (center-median(center) 
                        -rest_pixelmedian(rest_pixel))*dispersion/wl*c
                   so that the median value of Doppler shift should be 
                   very close to zero.  

  
                   VALUE(3,*,*) : Doppler Width in km/s defined by
 
                    Doppler Width = 1.414*width*dispersion/wl*c
                                                                                                                            
 KEYWORDS : 
        
         REVERSE   If set,  given input are interpreted to be
                   physical line parameters  and line fitting
                   parameters are returned.  


 MODIFICATION HISTORY

        April 1997    Jongchul Chae

(See ./line_par_conv.pro)


MARK_ON_IMAGE

[Previous Routine] [Next Routine] [List of Routines]

 NAME :
      MARK_ON_IMAGE
 PURPOSE :
      Removes an old crosshair from an image and mark a new one on it
 CALLING SEQUENCE:
      MARK_ON_IMAGE,  xpos_dev,  ypos_dev,  $
        color=color, xsize=xsize, ysize=ysize, $
        mark_only=mark_only, remove_only=remove_only  
 OPTIONAL INPUTS:
       XPOS_DEV, YPOS_DEV      mark position in device units
 KEYWORDS : 
       COLOR    the color index of mark (optional input)
       xsize    crosshair horizontal size  (optional input, def=20)
       ysize    crosshair vertical size(optional input, def=20)
       thick    crosshair thickness(optional input, def=1)
       mark_only  if set, only a new crosshair is marked on the image
       remove_only  if set, only the old crosshair is removed.
       restore    if set, the old crosshair is restored.
 EXAMPLE :
        TVSCL,  DIST(200)
        MARK_ON_IMAGE, 70, 80, /mark_only
        MARK_ON_IMAGE, 70, 130, /mark_only
        MARK_ON_IMAGE, 120, 150
        MARK_ON_IMAGE, /remove_only   

 COMMON BLOCKS:
       mark_on_image_block  
 MODIFICATION HISTORY
       March 1997 Jongchul Chae
       April 1997  J Chae   Introduce keyword RESTORE

(See ./mark_on_image.pro)


MGAUSSFIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME : mgaussfit
 PURPOSE : 
              Multi gaussian fitting
 ARGUMENT :
    INPUT
         x : independent  variable data 
         y : dependent variable data 
         w :  inverse square of the noise level of the data at each point
           
           Notice .  X, Y, W should have the same elements.
 
         par : Gaussian parameters (initial guess)
            1 D  array with elements of 6, 9 , 12, .. which depends 
                  on the number of lines 
                   
         
         y(i) = par(0) + par(1)*(x(i)-par(4))/par(5) 
                   + par(2)*((x(i)-par(4))/par(5))^2 +
          par(3) * exp(-0.5*((x(i)-par(4))/par(5))^2) +
          par(6) * exp(-0.5*((x(i)-par(7))/par(8))^2)+...
                 i=0,1,.., n_spectral-1
                 k=0,1,.., nspatial-1
          
    OUTPUT :
        result   fitted result
        par :  determined parameters

  KEYWORD
         free_par :  the indice of free parameters 
              default value = the indice of given parameters
         expected_free : the expected values of free parameters
         weight_free :  inverse   square  of the allowable differences
                           between the expected and the true free parameters.
        value : if set , calculate functional values without modifying  $
        the paramteres.

         Notice : the  weight corresponding to peak values
                     should be  an inverse square of uncertanity in the 
                    common logarithmic values. A typical
                   value may be 1./0.3^2. 
     
        itmax     maximum number of iteration 
   MODIFICATION HISTORY
       May 1997       J. Chae  : adapted from MULTI_GAUSS_FIT  

(See ./mgaussfit.pro)


MULTI_GAUSS_FIT

[Previous Routine] [Next Routine] [List of Routines]
 NAME : multi_gauss_fit
 ARGUMENT :
    INPUT
         x : independent  variable data 
         y : dependent variable data 
         w : weight of the data
           
       Note that x, y, and w may be either 1 D arrays or
            2 D arrays. 
            1 D : n_spectral elements
            2 D : n_spectral x n_spatial elements.              
 
         par : Gaussian parameters (initial guess)
            1 D : n_param elements
            2 D : n_param x n_spatial elements
         
         y(i,k) = par(0,k) + par(1,k)*(x(i,k)-par(4,k))/par(5,k) 
                   + par(2,k)*((x(i,k)-par(4,k))/par(5, k))^2 +
           exp(alog(10)*par(3,k)-0.5*((x(i,k)-par(4,k))/par(5,k))^2) +
           exp(alog(10)*par(6,k)-0.5*((x(i,k)-par(7,k))/par(8,k))^2)+...
                 i=0,1,.., n_spectral-1
                 k=0,1,.., nspatial-1
          
    OUTPUT :
        result   fitted result
        par : 
        sigma_par : probable error of parameters

  KEYWORD
         free_par :  the indice of free parameters 
            default value = the indice of given parameters
         free_expected : the expected values of free parameters
         free_weight : the inverse of the variances of the difference
                           between the expected and the true free parameters.
        itmax     maximum number of iteration 
         sign   :  an array of signs (1 or -1) with  numer of elements
                  equal to the number of Gaussian components
   MODIFICATION HISTORY
       April 1997      Jongchul Chae
       May 1997       J. Chae  :  added keyword  SIGN

(See ./multi_gauss_fit.pro)


PLOT_STYLE

[Previous Routine] [Next Routine] [List of Routines]
  NAME : PLOT_STYLE
  
  PURPOSE : Select plot style
 
  INPUTS :
        STYLE     style number 
 
                 0 : default setting
                 1 : charsize =1.2 / charthick=2.
                     font = complex roman, ticklen=0.03
                     minor ticks :suppressed
                 2 : charsize =1.2 / charthick=2.
                     font = complex roman, ticklen=-0.03
                     minor ticks :suppressed, ticks :outward

(See ./plot_style.pro)


SUMER_CONFIG

[Previous Routine] [Next Routine] [List of Routines]
 NAME: SUMER_CONFIG
 PURPOSE:
       Display and modify the system variable !sumer_config 
 HISTORY:
       1998 November J. Chae   created

(See ./sumer_config.pro)


SUMER_CONFIG_DEF

[Previous Routine] [Next Routine] [List of Routines]
 NAME: SUMER_CONFIG_DEF
 PURPOSE:
        Define the default SUMER configurations 

(See ./sumer_config_def.pro)


SUMER_COR

[Previous Routine] [Next Routine] [List of Routines]

  NAME :
        SUMER_COR
 PURPOSE:
        Apply correction for detector saturation
  CALLING  SEQUENCE :
        data_str1 = SUMER_COR (data_str0)
  INPUTS :
        DATA_STR0    Input data structure (defined by SUMER_FITS)
  OUTPUTS:
        DATA_STR1    Output data structure
   REQUIRED ROUTINES :
       deadtime_cor, local_gain_cor

(See ./sumer_cor.pro)


SUMER_DIR

[Previous Routine] [Next Routine] [List of Routines]
  NAME: SUMER_DIR
  Purpose: 
           Determine a SUMER data directory in SOHO-archive
  CALLING SEQUENCE:
           dir = SUMER_DIR(YEAR, MONTH)
  INPUT:   YEAR (integer value: e.g., 1996 or 96)
           MONTH (integer value: 1,2,.., 12)
  KEYWORD:
           OS   operating system (either 'vms' or 'unix')
                if not specfied, it is set to the machine OS.

  HISTORY
         1998 November  Chae

(See ./sumer_dir.pro)


SUMER_DISPLAY_IMA

[Previous Routine] [Next Routine] [List of Routines]

 NAME :  
        SUMER_DISPLAY_IMA
 PURPOSE :
        Display raster image (only for XRASTER)
 CALIING SEQUENCE :
        SUMER_DISPLAY_IMA  [,ps=ps]
 INPUTS :
        None
 OUPUTS :
        None
 COMMON BLOCKS
        XRASTER_WIDGET_BLOCK  XRASTER_DRAW_BLOCK
        RDSUMEREXT_BLOCK      DROP_INDEX_BLOCK DRAW_BLOCK
        XLOADCT_COM    MONOCOLORS_BLOCK
        IDL_vector_font_comm
 KEYWORDS :
        PS    If set to have non-zero value, the image is
              displayed on POSTCRIPT device. 
 SIDE EFFECTS:
        A Raster image is displayed either on X-window or POSTSCRIPT
 REQUIRED ROUTINES:
        GET_IMAGE   HARDCOPY_MESSAGE       

 MODIFICATION HISTORY
        March 1997    Jongchul Chae

(See ./sumer_display_ima.pro)


SUMER_DISPLAY_SPECTRUM

[Previous Routine] [Next Routine] [List of Routines]

 NAME :  
        SUMER_DISPLAY_SPECTRUM
 PURPOSE :
        Display a single spectrum image(only for XRASTER)
 CALIING SEQUENCE :
        SUMER_DISPLAY_SPECTRUM  [,ps=ps]
 INPUTS :
        None
 OUPUTS :
        None
 COMMON BLOCKS
        XRASTER_WIDGET_BLOCK  XRASTER_DRAW_BLOCK
        RDSUMEREXT_BLOCK      DROP_INDEX_BLOCK DRAW_BLOCK
        XLOADCT_COM    MONOCOLORS_BLOCK
        IDL_vector_font_comm
 KEYWORDS :
        PS    If set to have non-zero value, the spectrum image is
              displayed on POSTCRIPT device. 
 SIDE EFFECTS:
        A spectrum is displayed either on X-window or POSTSCRIPT
 REQUIRED ROUTINES:
        HARDCOPY_MESSAGE       

 MODIFICATION HISTORY
        March 1997    Jongchul Chae

(See ./sumer_display_spectrum.pro)


SUMER_DISPLAY_W

[Previous Routine] [Next Routine] [List of Routines]

 NAME :  
        SUMER_DISPLAY_W
 PURPOSE :
        Display W profile (only for SUMER_TOOL)
 CALIING SEQUENCE :
        SUMER_DISPLAY_W  [,ps=ps]
 INPUTS :
        None
 OUPUTS :
        None
 COMMON BLOCKS
        XRASTER_WIDGET_BLOCK  XRASTER_DRAW_BLOCK
        RDSUMEREXT_BLOCK      DROP_INDEX_BLOCK DRAW_BLOCK
        XLOADCT_COM    MONOCOLORS_BLOCK
        IDL_vector_font_comm
 KEYWORDS :
        PS    If set to have non-zero value, the w profile is
              displayed on POSTCRIPT device. 
 SIDE EFFECTS:
        A w profile  is displayed either on X-window or POSTSCRIPT
 REQUIRED ROUTINES:
        HARDCOPY_MESSAGE       

 MODIFICATION HISTORY
        March 1997    Jongchul Chae

(See ./sumer_display_w.pro)


SUMER_DISTORT_COR

[Previous Routine] [Next Routine] [List of Routines]

 NAME : SUMER_DISTORT_COR
        gives the destretched image of a SUMER spectrum
        based on a bilinear interpolation scheme
 CALIING SEQUENCE:
         REsult=SUMER_DISTORT_COR( Data, Refw, Refy, 
                  Refw_n, Ref_n,Detector=Detector)
 INPUTS:
       Data : a spectrum image 
              (2 D :n_spectral x n_spatial)
              (3 D :n_spectral x n_spatial x n_step)
              (4 D :n_spectral x n_spatial x n_step x n_line)
       Refw : the column  position of the lower 
              left corner of  the spectrum on the detector plane.
              0:shorter wavelength side ege, 
              1023 :longer wavength side edge
              (Scalars) : in case of 1 line 
              (1 D : n_line) : in case of lines more than 1
       Refy : the row  position of the lower 
              left corner of  the spectrum on the detector plane.

 OUTPUTS:
      
       Xoff_new, Yoff_new : the position of
              the new corrected sprectrum on the detector
              plane 
              

 OUPUTS:
       DATA : distortion corrected  data
                 with the same dimensions as the input data

 KEYWORD 
       Detector : 'a' or 'b' ( case insensitive)

                 When one repeatedly calls this routine for
                 a set of data obtained using the same detector,
                 he may specify this keyword only in the first
                 call and omit it after the first call
                 since the common block DISTORT_BLOCK keeps the
                 distortion data for that detector.
                 This speeds up this routine by skipping
                 data reading.
                
                    
                 
 RESTRICTIONS :
       The data files :del_x_at.fits, del_x_at.fits,
       del_x_bt.fits, del_x_bt.fits
       should exist in one of the directories in IDL path
 HISTORY
       December 1996,  Jongchul CHAE
       April  1997 J Chae   change of routine name and arguments

(See ./sumer_distort_cor.pro)


SUMER_FILE

[Previous Routine] [Next Routine] [List of Routines]

 NAME : 
        SUMER_FILE
 PURPOSE :
        Check and/or produce an effective full filename of SUMER data 
 CALLING SEQUENCE:
        Result = SUMER_FILE(FILENAME)
 INPUTS:
        FILENAME    SUMER file name (full or simple)
 KEYWORDS: 
        STATUS       is set to 1 (success) or 0 (failure)
        DIRECTORY    a directory or a string array of directories.
                     If specifed, those directories are searched.
                     
               
 REQUIRED_ROUTINES:
       BREAK_FILE, SUMER_DIR
 
 MODIFICATION HISTORY
       March 1997  Jongchul Chae
       April 1997  CHAE              : function name chnge
       November 1998   CHAE
     

(See ./sumer_file.pro)


SUMER_FILENAME

[Previous Routine] [Next Routine] [List of Routines]

 NAME : 
        SUMER_FILE
 PURPOSE :
        Check and produce an effective full filename of SUMER data 
 CALLING SEQUENCE:
        Result = SUMER_FILE(FILENAME)
 INPUTS:
        FILENAME    SUMER file name (full or simple)
 KEYWORDS: 
        STATUS       is set to 1 (success) or 0 (failure)
        DIRECTORY    a directory or a string array of directories.
                     If specifed, those directories are searched.
        ARCHIVE      If set, the  SOHO-archive is searched.
        FTP          If set, the file is retrieved via FTP
                     This option requres the pre-defined system variable
                     with the fields FTP_NODE, FTP_USER and FTP_PASSWD
                     specified.
        AUTO_FTP     If set, the file is retrieved via AUTO-LOGIN FTP
                     This option holds only for UNIX machines and requires
                     the predifined file $HOME/.netrc
        ANON_FTP     If set, the file is retrieved via ANONYMOUS FTP.
                     
               
 REQUIRED_ROUTINES:
       BREAK_FILE, SUMER_DIR
 
 MODIFICATION HISTORY
       March 1997  Jongchul Chae
       April 1997  CHAE              : function name chnge
       November 1998   CHAE
     

(See ./sumer_filename.pro)


SUMER_FITS

[Previous Routine] [Next Routine] [List of Routines]

  NAME : 
        SUMER_FITS
  PURPOSE :
        Read one binary table extension of a SUMER file 
  CALLING SEQUENCE:
        data_str = SUMER_FITS(filename,exten=exten)
  INPUTS:
        FILENAME    SUMER fits file name.
  KEYWORDS :
        EXTEN       The exntension number of the binary table to be read
                    (optional input,  default=1)
  OUPUTS:
       DATA_STR    a data structure with the following fields: 

        FILE         SUMER file name
        H            primary header       
        BH           binary header
        DATA         an array  of SUMER data 
        AMP          count amplification factor
                     Note that  DATA = RAW COUNT x AMP                                             ;        SUM_STATUS   Image Status
        DEL_TIME     Relative Time of each image  
        EXPTIME      Exposure time of each image
        SOLAR_X      Azimuth position of each image
        SOLAR_Y      Elevation position of each image
        NEXT         Number of binary extensions
        EXTENSION    The present extension number     
        DIM          dimensions of DATA
        NDATA        Number of lines in DATA
        DATA_NAMES   specification of each line
        DESCR        Physicaldescription of each dimension in DATA
        REFPIXELS    Reference pixels 
                         
                        The reference pixels are the center pixels
                        of the spectrograms each position of which
                        is measured from the lower left  corner of 
                        the corresponding spectrogram, or explicitly,
 

                           refpixels(0, *)  = dim(0)/2 - (dim(0) mod 2 eq 0)
                           refpixels(1, *)  = dim(1)/2 - (dim(1) mod 2 eq 1)
  
                        Note the FITS keyword TRPIXi in the binary header of
                        the SUMER FITS files with the extension '.fits' are
                        irrelevant to these reference pixels and
                        the FITS keywors TRPIXi in the SUMER files with the
                        extension '.fts' are defined in a slightly different 
                        way. 
                           
                         
                          
        REFPOS       Physical values at refernce pixels (from TRVALi)
            
                         The reference positions are the physical values
                         (wavelength and y-position) of the reference pixels.

        DELTAS       Physical Increments (from TDELTi)
        SUMPIXELS    SUMER reference co-pixels (from TSPIXi) 
                   
                       The SUMER reference co-pixels are the coordinates
                       of the reference pixels measured from the lower left
                       (solar North and short wavelength) corner  of the 
                       detector. 

                       It is usually the same as the values
                       of the keyword TRPIXi in the binary header of
                       the SUMER FITS files with extension of '.fits'
                       and those of the keyword TRSPIXi in the binary header
                       of the SUMER files with extension '.fts'

                       However when the spectral dimension is 1024 (full
                       detector range),  the TRPIXi in '.fits' files or
                       TRSPIX in '.fts' are different from SUMPIXELS.
                       In this case,  REFPOS(0, *) should be corrected to
                       have 
             REFPOS(0,*) = REFPOS(0,*) + DELTAS(0,*)*(511. - SUMPIXELS(0,*) )
                       and then SUMPIXELS(*,0) should be set to 511. 
   
                   
      
                       
                         
                        
                        
                        Then the position of the lower left corner  of each
                        spectrogram is given by
                          
                            sumpixels(0, *)-refpixels(0,*) :spectral direction
                            sumpixels(1, *)-refpixels(1,*) :spatial direction 
                       

  RESTRICTIONS:
        This routine reads the primary header and only one binary
        table extension of a SUMER file at a time.
   REQUIRED ROUTINES:
        FITS_INFO  HEADFITS 
        FXBOPEN FXBCLOSE  FXPAR FXBFIND FXBTDIM FXBREAD
   MODIFICATION HISTORY
        April 1997   Jongchul Chae  
        Sept  1998   Clarify the definition of data field: refpixels and
                     sumpixels            

(See ./sumer_fits.pro)


SUMER_FLAT

[Previous Routine] [Next Routine] [List of Routines]

  NAME :    SUMER_FLAT
  
  PURPOSE : Applies  flat field correction to SUMER data

  CALLING SEQUENCE :
         Result=  SUMER_FLAT(Data, Refw, Refy, file=file, $
                     decorrect=decorrect)
  INPUTS:
           DATA : SUMER data array
                  Nspectral x  Ny x Nstep x Nline    
                 If DATA is a 2-d array,  then Nstep=1 and Nline=1
                 If DATA is a 3-d array, then  Nline=1
           REFW : the pixel positions of the left edges
                  of sub spectral images  measured across the
                  slit direction  in the detector plane.
                  increases with wavelength     
                  1-d array with Nline elements or a scalar 
                  default value =0
           REFY : the pixel positions of the lower edges
                  of sub spectral images  measured along the
                  the slit direction  in the  detector plane.
                  increases in the S direction
                  (upward in the ditector).
                  1-d array with Nline elements or a scalar 
                   default value=0
  KEYWORD INPUTS:
            
           FILE :   SUMER flat field file name
                    If given, the flat image is read from this file.
              Otherwise, the flat image in the common block is used. 
           DECORRECT If set , the data are subject the reverse
                         process (i.e. decorrected).
                 
  OUTPUT:          
           DATA : flat field (de) corrected data
        
  HISTORY                                  
           April 1997   Jongchul Chae

(See ./sumer_flat.pro)


SUMER_NEW_FORMAT

[Previous Routine] [Next Routine] [List of Routines]
   NAME : 
            SUMER_REFORMAT

   PURPOSE :          
           Reformat SUMER data for a  Raster or 
           Temporal Sequence

    CALLING SEQUENCE:
         SUMER_REFORMAT,  OldData, OldPos,  OldNstep, $
                              NewDim, NewPos
    INPUTS:
         
       OldData     an array of spectral images
                               OldNw x  OldNy x OldNline   
       OldPOs     an array of  the detector coordinates of the lower left
                               corners of the lines
                                
                                OldPos(0,*)     :  spectral coordinates
                                OldPOs(1,*)     :  spatial coordinates      
       OldNstep    numer of     steps for the original sequence
 
   OUTPUTS:
   
       NewDim      a two element array of the  spectrograms 
       NewPOs      a new array of detector coordinates of the lower
                   left corners of the new line set
   HISTORY:
       J. Chae 1998 Sept      

(See ./sumer_new_format.pro)


SUMER_PICK_FLAT

[Previous Routine] [Next Routine] [List of Routines]

  NAME : SUMER_PICK_FLAT

  PURPOSE : Picks SUMER flat image file name 
  
  CALLING SEQUENCE :
          Result =  SUMER_PICK_FLAT(Filename)
       
  INPUTS:
          FILENAME    SUMER fits filename
  OUTPUTS:
          RESULT      SUMER FLAT Filename

  HISTORY
         Apr 97, J Chae

(See ./sumer_pick_flat.pro)


SUMER_RASTER_SAVE

[Previous Routine] [Next Routine] [List of Routines]

 NAME :
         SUMER_RASTER_SAVE
 PURPOSE :
         Save raster images of line parameters into a standard fits file
 CALLING SEQUENCE:
         SUMER
 INPUTS:
          None
 OUPUTS:
          None
 COMMON BLOCKS:
         xraster_block
 SIDE EFFECTS:
          A new standard fits file is created.
 REQUIRED SUBROUTINES:
          fxaddpar fxhmake  WRITEFITS
 MODIFICATION HISTORY
         May 1997       Jongchul Chae  adapted from  SAVE_RASTER

(See ./sumer_raster_save.pro)


SUMER_REFORMAT

[Previous Routine] [Next Routine] [List of Routines]
   NAME : 
            SUMER_REFORMAT

   PURPOSE :          
           Reformat SUMER data for a  Raster or Temporal Sequence

    CALLING SEQUENCE:
         SUMER_REFORMAT,  OldData, OldPos,  OldNstep, $
                              NewDim, NewPos
    INPUTS:
         
       OldData     an array of spectral images
                               OldNw x  OldNy x OldNline   
       OldPOs     an array of  the detector coordinates of the lower left
                               corners of the lines
                                
                                OldPos(0,*)     :  spectral coordinates
                                OldPOs(1,*)     :  spatial coordinates      
       OldNstep    numer of     steps for the original sequence
 
   OUTPUTS:
   
       NewDim      a two element array of the  spectrograms 
       NewPOs      a new array of detector coordinates of the lower
                   left corners of the new line set
   HISTORY:
       J. Chae 1998 Sept      

(See ./sumer_reformat.pro)


SUMER_SEARCH

[Previous Routine] [Next Routine] [List of Routines]

   NAME:   SUMER_SEARCH   
   PURPOSE:
          Widget-based Search for SUMER fits files
   CALLING SEQUENCE: 
          SUMER_SEARCH, filelist, catalog
   INPUTS :
          None
   OPTIONAL OUTPUTS :
          FILELIST :  an array of file names
          CATALOG  :  an array of strings for basic information
         
   KEYWORDS :
          None
   COMMON BLOCKS
          SUMER_SEARCH_BLOCK
   REMARKS:
          System variable !sumer_config should be difined.
          To manipulate the variable, use the program sumer_config
          
          
   REQUIRED SUNBROUTINES:
         SUMER_SEARCH_MAIN_EVENT SUMER_SEARCH_PD_EVENT
   MODIFICATION HISTORY
          March 1997      Jongchul Chae  version 1.5 
          November 1998   Jongchul Chae  version 2.0                  

(See ./sumer_search.pro)


SUMER_SEARCH_BLOCK

[Previous Routine] [Next Routine] [List of Routines]
   This contains the common block used in the SUMER_SEARCH program.
 
  common sumer_search_block,  $
       log_dir,      $ ; directory of the log file
       logfile,      $ ; log file defined by John Mariska
       sumer_dir,    $ ; SUMER directory name 
       fits_kind,    $ ; first part of  SUMER file name( e.g., 'SUM_')
       time1, time2, $ ; start and end times  (e.g., '960101_000000' and '991231_240000')
       xcen1, xcen2, $ ; east and west limits (e.g., -2000. and 2000.)
       ycen1, ycen2, $ ; south and north limits (e.g., -2000. and 2000.0)
       rcen1, rcen2, $ ; inner and outer limits (e.g., 0, 2000.)
       wl1, wl2,     $ ; 1st order wavelength limits (e.g., 600. and 1700.)
       exposure1,    $ ; explosure limits (e.g., 0 and  1.e5)
       exposure2,    $ ;
       slit,         $ ; slit (e.g., '1'). Optional 
       detector,     $ ; detector (e.g., 'A' or 'B'). Optional 
       object,       $ ; object of the observing program (e.g., 'filament'). Optional
       pop,          $ ; POP or UDP. optional 
       seq_type,     $ ; Sequence Type (e.g., 'raster'). Optional
       scientist,    $ ; Scientist name. Optional
       studyname,    $ ; Study name. Optional
       logs,         $ ; a list of searched log structures. A working variable 
       files,        $ ; a list of searched files.  A working variable 
       select,       $ ; a binary list of the files representing being chosen
       file,         $ ; One chosen file. A wortking variable
       catalog,      $ ; A list of basic information of the selected files
       done,         $ ; 0 or 1. A working variable 
       text_id,      $ ; Text widget ID. A working varaible
       list_id         ; List widget ID. A working variable
   

(See ./sumer_search_block.pro)


SUMER_SEARCH_MAIN_EVENT

[Previous Routine] [Next Routine] [List of Routines]

                                        
   NAME:
     SUMER_SEARCH_MAIN_EVENT
   PURPOSE:
     Responses to main events in SUMER_SEARCH     
   CALLING SEQUENCE:
     SUMER_SEARCH_MAIN_EVENT, event
   INPUTS:
     EVENT = a structure variable for an event 
   OUTPUTS:
     None
   COMMON BLOCKS:
    SUMER_SEARCH_BLOCK
   SIDE EFFECTS:
     Change parameters defined in common blocks 
   REQUIRED SUBROUTINES:
     None: 
   MODIFICATION HISTORY
     March 1997    Jongchul Chae   

(See ./sumer_search_main_event.pro)


SUMER_SEARCH_PD_EVENT

[Previous Routine] [Next Routine] [List of Routines]

                                        
   NAME:
     SUMER_SEARCH_PD_EVENT
   PURPOSE:
     Responses to pull-down events in SUMER_SEARCH      
   CALLING SEQUENCE:
     SUMER_SEARCH_PD_EVENT, event
   INPUTS:
     EVENT = a structure variable for an event 
   OUTPUTS:
     None
   COMMON BLOCKS:
     SUMER_SEARCH_BLOCK
   SIDE EFFECTS:
     Change parameters defined in common blocks 
   REQUIRED NON-STADNARD SUBROUTINES:
     XRASTER           MK_SUMER_CAT  LOCATE_DIR
     HEADFITS          BREAK_PATH
     SLOG_RDLOG   SLOG_GET_DAY  SLOG_GET_TIME
   RESTRICTIONS :
     SUMER log files should exist in the specified directory   
   MODIFICATION HISTORY
     March 1997    Jongchul Chae   

(See ./sumer_search_pd_event.pro)


SUMER_SERIAL

[Previous Routine] [Next Routine] [List of Routines]

  NAME:
               SUMER_SERIAL
  PURPOSE:
              Construct a single  data structure from a set of SUMER files
  CALLING SEQUENCE:
              data_str = SUMER_SERIAL(files)
  INPUTS :
            FILES  an array of file names
  OUPUTS:
            DATA_STR      a data structure defined in the same as in SUMER_FITS
  KEYWORDS:
            REFORMAT  if set, the detector plane setup ogf data
                      are reformatted. 
    
   HISTORY:
      J. Chae 1998 September introduce FLAG, REFORMAT keyword

(See ./sumer_serial.pro)


SUMER_TIME

[Previous Routine] [Next Routine] [List of Routines]

 NAME :
              SUMER_TIME
 PURPOSE :
            Convert  SUMER time string into the time of the day in seconds
  CALLING SEQUENCE:
            time = sumer_time(time_string, jday)
  INPUTS:
           TIME_STRING    time string such as '1996-10-20T16:35:30.063'
   OUTPUTS:
           TIME     time of the day in seconds
   OPTIONAL OUTPUT:
           JDAY    Julian day

(See ./sumer_time.pro)


SUMER_TOOL

[Previous Routine] [Next Routine] [List of Routines]

 NAME : 
        SUMER_TOOL
 PURPOSE:
        Widget-based display of SUMER fits data
 CALLIING SEQUENCE:
         SUMER_TOOL, files
 INPUTS :
        None
 OPTIONAL INPUT:
        FILES       SUMER fits file names to be displayed

 KEYWORDS :
        EXTEN       The extension nember of a FITS table in the file
                    to be read(optional input \  default=1).
        GROUP       Widge ID of group leader (optional input)
        REFORMAT    If set, the SUMER data are reformatted.          
 COMMON BLOCKS:
        
 REQUIRED ROUTINES:
        RDSUMEREXT  XRAS_MAIN_EVENT  SUMER_FULL_FILENAME
        GET_COLOR   DISPLAY_IMA 
 RESTRICTIONS :
        Only one call is allowed at the same time.
 MODIFICATION HISTORY
        March 1997        Jongchul Chae
        Novemebr 1998     JC      Change Name
   

(See ./sumer_tool.pro)


SUMER_TOOL_MAIN_EVENT

[Previous Routine] [Next Routine] [List of Routines]

 NAME :
        SUMER_TOOL_MAIN_EVENT
 PURPOSE :
        Responds to main events in XRASTER
 CALLING SEQUENCE:
        SUMER_TOOL_MAIN_EVENT,  event [, group=group]
 INPUTS:
        EVENT       an event structure variable (given by XRASTER)
 OUTPUTS:
        None
 KEYWORDS:
        GROUP       widget ID of the group leader (optional input)
 COMMON BLOCKS:
        XLOADCT_COM    MONOCOLORS_BLOCK
 SIDE EFFECTS:
        Changes  some variables in the common blocks
        Controls various kinds of display 
 REQUIRED ROUTINES:
        DISPLAY_IMA      DISPLAY_X    DISPLAY_Y     DISPLAY_W
        DISPLAY_SPECTRUM  MARK_ON_IMAGE
 MODIFICATION HISTORY
        March 1997      Jongchul Chae

(See ./sumer_tool_main_event.pro)


SUMER_TOOL_PD_EVENT

[Previous Routine] [Next Routine] [List of Routines]

 NAME :
        SUMER_TOOL_PD_EVENT
 PURPOSE 
        Responds to pull-down events in SUMER_TOOL
 CALLING SEQUENCE:
        SUMER_TOOL_PD_EVENT,  event [, group=group]
 INPUTS:
        EVENT       an event structure variable (given by XRASTER)
 OUTPUTS:
        None
 KEYWORDS:
        GROUP       widget ID of the group leader (optional input)
 COMMON BLOCKS:
        SUMER_TOOL_BLOCK
        
 SIDE EFFECTS:
        Changes  some variables in the common blocks
        Controls data manipulations
        Controls various kinds of display 

 REQUIRED ROUTINES:
        GET_COLOR  SAVE_RASTER  FLAT_FIELDING
        SUM_COMPRESS1    SUM_DECOMPRESS1  IDL_VECTOR_FONT
        XRASTER_HELP      
        DISPLAY_IMA      DISPLAY_X    DISPLAY_Y  
        DISPLAY_W
        DISPLAY_SPECTRUM  MARK_ON_IMAGE
 MODIFICATION HISTORY
        March 1997      Jongchul Chae

(See ./sumer_tool_pd_event.pro)


VDF_HEIGHT

[Previous Routine] [Next Routine] [List of Routines]
   NAME : 
           VDF_HEIGHT
   PURPOSE:
           Gives the physcal height of default size IDL fonts
           in device units
   CALLING SEQUENCE:
          Height = VDF_HEIGHT(Device_name)
   INPUTS:
          DEVICE_NAME      either 'X' or 'PS'
   OUTPUTS:
          Height         in device units
                           1000 = 1cm in 'PS'
                           1=  1 pixel in 'X'
   MOdification History
         April 1997   Jongchul Chae

(See ./vdf_height.pro)


XDEFROI

[Previous Routine] [Next Routine] [List of Routines]

   NAME :
         XDEFROI
   PURPOSE :
        Define a region of interest in a given image
   CALLING SEQUENCE:
        Result = xdefroi(image, zoom=zoom)
   INPUTS:
       IMAGE     a two-dimensional array
                 It should be byte-type for better looking
                 since TV is used for displaying it.
   KEYWORDS:
       ZOOM     a two elements vector containning the expansion
                factor in X and Y.
   MODIFICATION HISTORY
       March 1997   Jongchul Chae
 

(See ./xdefroi.pro)


XGAUSSFIT

[Previous Routine] [List of Routines]
   NAME : 
               XGAUSSFIT
   PURPOSE :
              Interactive Gaussian Fitting
   CALLING SEQUENCE :
             
             XGAUSSFIT, X, Y,  Par, Ncomp=Ncomp, Noise=Noise

   INPUTS:
             
           X      independent variables
           Y      dependent variables

   OUTPUT :   
 
          PAR   fitted gaussian parameters

              Y =   par(0) + par(1)*X + par(2)*X^2
                    + par(3)*exp(-0.5*((X-par(4))/par(5))^2)
                    + par(6)*exp(-0.5*((X-par(7))/par(8))^2) + ...
               under  the positive constraints, i.e.     par(3)>0,  par(6)>, ...

    KEYWORDS       
      
         XTITLE   x-axis title
         YTITLE   y-axis title 
         NCOMP     number of gaussian components (default=1)
         NOISE       a 3-element array  defining noise characteristics 
                           (default=[1,0 0])

                RMS NOISE = sqrt(NOISE(0)+NOISE(1)*SIGNAL
                       +NOISE*SIGNAL^2)

(See ./xgaussfit.pro)