Local IDL Routines

(This page was created by a MODIFICATION of the IDL library routine mk_html_help).

List Last updated: Mon Nov 3 11:18:32 2008.

You may download a g-zipped tar file of all these files.


Alphabetical List of Routines

[List of Routines by Category]


Routine Descriptions

[Next Routine] [List of Routines]
 NAME:
 
	GREEK

 PURPOSE:
 
       This function returns the string needed to draw the specified
       greek character using either the vector graphics font no. 4,
       or PostScript font 9.

       If (!d.name eq 'PS') and (!p.font eq 0), then the PostScript
       font will be used.  Otherwise, the vector font will be used.

 CALLING SEQUENCE:
 
	Result = GREEK(Name)

 INPUTS:
 
       Name - String specifying the greek character name. Valid
              inputs are:

              alpha, beta, gamma, delta, epsilon, zeta, eta, theta
              iota, kappa, lambda, mu, nu, xi, omicron, pi, rho,
              sigma, tau, upsilon, phi, chi, psi, omega

              Alpha, Beta, Gamma, Delta, Epsilon, Zeta, Eta, Theta
              Iota, Kappa, Lambda, Mu, Nu, Xi, Omicron, Pi, Rho,
              Sigma, Tau, Upsilon, Phi, Chi, Psi, Omega

              Although not greek, the following characters are also
              valid (but will only work with the 'default' font !3):

              angstrom, Angstrom, degrees, plus_minus

 KEYWORDS:

       FORCE_PS - Set to use PostScript font, regardless of the value
                  of !d.name and !p.font.

       PLAIN - Set to just return Name in plain text.

       APPEND_FONT - Set to append the characters specifying a
                     'default' font: !3. That is, if this keyword is
                     set, then the command

                     Result=GREEK(theta,/APPEND_FONT)

                     will return the string

                     '!9q!3' for PostScript and '!4h!3' for vector
                     fonts.
 

 OUTPUTS:
 
       Result - The string containing the specified greek character.

 EXAMPLE:

	Result=GREEK(theta)
	
       In this case, Result='!9q' if !d.name is 'PS' and !p.font is
       0; otherwise, Result='!4h'

 MODIFICATION HISTORY:
 
 	David L. Windt, Bell Labs, September 1998.
       windt@bell-labs.com
                    

(See src/idl_cvs/greek.pro)


ADDLABELNODES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       addLabelNodes
 PURPOSE:
       Add LABEL sub-nodes to MDSplus signal nodes reading info from a file
 CATEGORY:
       MDSplus, TCL 
 CALLING SEQUENCE:
       addLabelNodes, shot1, shot2, filename=filename
 INPUTS:
	shot1 = starting shot number to process (defaults to last shot)
	shot2 = last shot number to process (optional)
 KEYWORDS:
	filename - name of file with info - REQUIRED, 
		   see, e.g., BDAVIS$:[CVS.MISC.WF]tauslabel.dat
	   the file must contain 4 columns, separated by white space.  
	   the first column is the tagname (without \), the last column is 
	   the Label text enclosed in double quotes. The middle columns
	   can be any single word or character (file format from another
	   application).
	tree - name of tree -- defaults to 'WF'
 COMMON BLOCKS:
       NONE
 NOTES:
       YOU NEED PRIVILEGES to write to the MDSplus tree.
 LIMITATIONS:
 MODIFICATION HISTORY:
	25-Jan-01 Written by Bill Davis.

(See src/idl_cvs/addlabelnodes.pro)


ADDMDSTAGS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       addmdstags
 PURPOSE:
       Add tags to MDSplus nodes
 PROCEDURE:
 CATEGORY:
       MDSplus, Summary 
 CALLING SEQUENCE:
       addmdstags, shot=shot, nodes=nodes, tags=tags
 INPUTS:
 KEYWORDS:
	shot - shot number to process
	nodes - MDSplus node names to which tag will added (all in same tree)
	tags - to add
	VERBOSE  - if set, more info is printed
	test  - doesn't write to MDSplus
 EXAMPLE:
       nodes = ['\PASSIVESPEC::TOP.IR.IMG0.RAWDATA.IR_408:TIMES', $
		 '\PASSIVESPEC::TOP.IR.IMG1.RAWDATA.IR_408:TIMES', $
		 '\PASSIVESPEC::TOP.IR.IMG2.RAWDATA.IR_408:TIMES' ]
	tags = ['img0_408_times', 'img1_408_times', 'img2_408_times' ]
	addmdstags, shot=128000, nodes=nodes, tags=tags, /verb, /test
   for i=shot1,shot1+499 do addmdstags, shot=i, nodes=nodes, tags=tags, /verb
 NOTES:
       YOU NEED PRIVILEGES to write to the MDSplus tree.
 LIMITATIONS:
	Divide by zeroes, etc. will cause a message like:
	    % Program caused arithmetic error: Floating illegal operand
 MODIFICATION HISTORY:
	27-Mar-2008 Written by Bill Davis.

(See src/idl_cvs/addmdstags.pro)


ADDSIGNODES

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       addsignodes
 PURPOSE:
       Add signal nodes and tags to a MDSplus tree for many shots
 PROCEDURE:
 CATEGORY:
       MDSplus
 CALLING SEQUENCE:
       addsignodes, shot1, shot2, tags=[tag1,tag2,tag3,...]
 INPUTS:
	shot1 = starting shot number to process
	shot2 = last shot number to process
 KEYWORDS:
	tags - tags to add (if defined in the model tree, you
	       will not need to specify the corresponding nodes).
	nodes = if tags are not defined in the model tree, these are necessary
	tree - MDSplus tree
	usage - for MDSTCL node creation. Default='signal'
	VERBOSE  - if set, more info is printed
	test  - doesn't write to MDSplus
 NOTES:
       YOU NEED PRIVILEGES to write to the MDSplus tree.
 LOGIC:
	finds node names for tags. Then, if node names are not different
	than the "tag" names, does not add tags.
 LIMITATIONS:
	all signals must be in the same tree
 MODIFICATION HISTORY:
	11-Apr-07 changed for Linux (add output= to mdstcl)
	13-Jun-02 Written by Bill Davis.

(See src/idl_cvs/addsignodes.pro)


ADDTREETOTAG

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       addTreeToTag
 PURPOSE:
       return tags with trees merged in
 CATEGORY:
       MDSplus, SCOPE
 CALLING SEQUENCE:
	names = addTreeToTag( tags, trees )
 INPUTS:
   tags - array of tags, e.g., '\ip1' (if tree already there, will not change)
   trees - array of trees (same dimension as tags)
 RETURNED:
	names - tag names with tree in them, e.g., '\engineering::ip1'
 KEYWORDS:
 COMMON BLOCKS:
       none
 EXAMPLE:
 	IDL> print, addTreeToTag( ['\ip1+\ip2'], ['engineering'] )
	\engineering::ip1+\engineering::ip2
 	IDL> print, addTreeToTag( ['\engineering::ip1.blah+\ip2'], ['engineering'] )      
	\engineering::ip1.blah+\engineering::ip2

 LIMITATIONS:
 MODIFICATION HISTORY:
	30-Apr-01 Written by Bill Davis

(See src/idl_cvs/addtreetotag.pro)


ADD_TAG

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

 NAME:
    ADD_TAG
       
 PURPOSE:
    Add a new tag to the structure. NOTE: if you want to add more
    than one tag at once, use ADD_TAGS

 CATEGORY:
    Programming
 
 CALLING SEQUENCE:
    add_tag, oldstruct, tagname, tagValue, newstruct, structyp=structyp

 INPUTS: 
    oldstruct: The original structure (or array of structures)
    tagname: string containing the new tag name
    tagValue: the initial value of the new tag, e.g. fltarr(5)
           or [3,5,6], or 0L, etc.

 KEYWORD PARAMETERS:
   structyp: a string with the name of the new structure.
     if already defined an error is printed.

 OUTPUTS: 
    newstruct: The structure with the new tag it it.

 OPTIONAL OUTPUT
    NONE

 CALLED ROUTINES:
    COMBINE_STRUCTS
 

 REVISION HISTORY:
    25-OCT-2000, Judith Racusin.
       
                                      

(See src/idl_cvs/add_tag.pro)


AMEDIAN

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       AMEDIAN
 PURPOSE:
       Works the same as MEDIAN, but the effect tapers off at the edges.
 CATEGORY:
       Smoothing, Math
 CALLING SEQUENCE:
       Result = AMEDIAN( ARRAY, WIDTH )
 INPUT PARAMETERS:
       ARRAY   = One or two-dimensional array to be median filtered.
       WIDTH   = Width of the median filter box.
 OPTIONAL KEYWORD PARAMETERS:
       None.
 COMMON BLOCKS:
       None.
 SIDE EFFECTS:
       None.
 RESTRICTIONS:
       ARRAY must be one or two-dimensional.
 PROCEDURE:
       A larger array is constructed with the border filled with the reflected
       edges of the original array.  Then MEDIAN is applied to this larger
       array, and the area corresponding to the original array is returned as
       the result of the function.
 MODIFICATION HISTORY:
	15-Jul-2008 for True Color images (dimensioned [3,xsize,ysize]), smooth over each
		    color.
   	12-Jun-01 Made work for 1 dimension of 2 being small. [BD]
   	21-Feb-01 Just return array if width < or = 1. [BD]
       WRITTEN by William Thompson, February 1993.

(See src/idl_cvs/amedian.pro)


ANIM2CINE

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

 PURPOSE:
    Create an mpeg or avi movie from two .cin files from Phantom 7 Cameras.
    The data can be color or monochrome

 CATEGORY:
    animation

 CALLING SEQUENCE:
    anim2cine, CineFile1, CineFile2, outFile=outfile, t1=t1, t2=t2
   or

 INPUTS:
	CineFile1 - cine file
	CineFile2 - 
	 - 
 OPTIONAL KEYWORD PARAMETERS:
	outFile - name of output MPEG file (will default to a nice name), or 
	prefix - what would precede _shot_t1_t2 (in msec) in the output filename
	t1 - start time of animation in seconds
	t2 - end time of animation in seconds
	VIEW - if set, just displays images, and does not make an mpeg
   	ndups - if given means repeat every image 'ndups' times
   	despeckle - if set call despeckle routine (slow, but less "intrusive" 
		    than median)
	nSmooth - number input to median smoothing routine
	topPixels -
	botPixels - 
	charsize - character size for plots. Default=2
	ctb - color table for non-color image 
	label1 - label on plot for CineFile1 (default='Monochrome')
	label2 -  label on plot for CineFile2 (default='Color')
	verbose - if set will print out info as it works
 OUTPUTS: 
	an MPEG file named by outFile keyword

 PROCEDURE:
   will assume Phantom 7 camera is the fastest
 EXAMPLE:

    anim2cine, '/p/nstxusr2/nstxphantom7/NSTX_130389.cin', $
		'/p/nstxusr2/miro/MIRO_130389.cin', $
		t1=0.02, t2=0.0300, /verbose                        , /debug

    anim2cine, shot=130370, t1=0.05, t2=0.58, /verbose, /view    , /debug

    anim2cine, '/p/nstxusr2/nstxphantom7/NSTX_130388.cin', $
		'/p/nstxusr2/phantom4/NSTX_130388.cin', $
		t1=0, t2=2, ctb=0, /verbose                    , /debug

    anim2cine, shot=130375, /nonGlobal, $
		t1=0, t2=2, ctb=0, /verbose                    , /debug

   mv files to /w/nstx.pppl.gov/htdocs/nstx/Software/Diagnostics/Miro for web viewing at
   http://nstx.pppl.gov/nstx/Software/Diagnostics/Miro/

 MODIFICATION HISTORY:
	16-Jul-2008 Use Z-buffer, even when viewing, for smoother displays
   15-Jul-2008 Written by Bill Davis

(See src/idl_cvs/anim2cine.pro)


ANIMXYPLOT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       animxyplot
 PURPOSE:
       Animate X-Y plot of a 2-D array
 CATEGORY:
       Animation
 CALLING SEQUENCE:
       IDL> animxyplot, data2d, x, time [, ....]
 INPUTS:
       data2d - 2 d array (1st dimension like x, 2nd like time)
	x - array for x-axis of x-yplot
	time
 KEYWORD PARAMETERS:
	(can have any keywords used in PLOT command -- will be passed on)
 	mpeg - if set, will create an mpeg of animation
	filename - name of mpeg file (default =  'plotanimation.mpg')
	rep - # number of times to repeat frames (to slow down mpeg) default=0
	t1 - time to start animation (indexes into time array) (default=start)
	t2 - time to end animation (default=end)
	xtitle -    
	ytitle -    
	xsize - xsize of window in pixels
	ysize - ysize of window in pixels 
	flip - if set, will flip mpeg image    
	timeTitle - appended to indication of time on plot (def='Sec.')
	pause - # of seconds to pause between plotted frames when creating
	verbose - if set, will print many informational messages
	debug - if set, debug output will be printed
 OUTPUTS:
       NONE; just the mpeg file, if specified
 EXAMPLE:
	nframes = 20
	nPts = 1000
	data2d = fltarr(npts, nframes)
	time = findgen(nFrames)/1000 +0.2
	x =findgen(npts)/npts*150 + 50
	for i=0,nframes-1 do data2d[0,i]=sin(x*5/max(x)+i/10.)*exp(1.-x/100-i/10.)
	animxyplot, data2d, x, time, xtitle='Radii', ytitle='Value', /mpeg
 NOTES:
 MODIFICATION HISTORY:
       18-Jan-2008 Written by Bill Davis, PPPL

(See src/idl_cvs/animxyplot.pro)


ARRAY_EQ

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
	ARRAY_EQ
 PURPOSE:
  	Return TRUE if two arrays are equal, else false.
 CATEGORY:
       Programming
 CALLING SEQUENCE: 
	logical=ARRAY_EQ(array1,array2)

 INPUTS:   
	bigArray - an array of numbers to look in
  	littleArray - an array to look for matches in bigArray
 OUTPUTS:
	logical - 0/1

 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
 	17-May-99 WMD Written

(See src/idl_cvs/array_eq.pro)


BADPAR

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
     badpar
 PURPOSE: (one line)
     Validate an input parameter against valid entries.
 DESCRIPTION:

     This is a general parameter checking function for validating input
     quantities in other procedures and functions.  This routine will
     generate an error message indicating what is wrong with the item.

     Example of use:

     pro foo,array
     if badpar(array,[4,5],2,CALLER='foo') then return
        .
        . code for foo .
        .
     end


     This would cause an immediate return to the routine that called foo
     with an error message if the input was not either floating or double
     and 2 dimensional.

     As of IDL v3.0, these are the recognized type codes (see 1-218 in
        reference guide).

        Type
        Code     Data Type
        ----    -----------------------------
          0      Undefined
          1      Byte
          2      Integer
          3      Longword integer
          4      Floating point
          5      Double-precision floating
          6      Complex floating
          7      String
          8      Structure

 CATEGORY:
  Utility
 CALLING SEQUENCE:
     val = badpar(param,goodtype,goodrank)
 INPUTS:
     param    - IDL variable to validate.
     goodtype - Scalar or vector of type codes that are valid.
     goodrank - Scalar or vector of valid ranks.
 OPTIONAL INPUT PARAMETERS:
 KEYWORD PARAMETERS:
     CALLER   - String identifying the calling routine.
     DEFAULT  - Value to return in param if undefined and undefined allowed.
     DIMEN    - Dimensions of variable.
     NPTS     - Total number of elements in variable.
     RANK     - Rank of variable.
     TYPE     - Type of variable.
 OUTPUTS:
     Return value is true if the parameter is bad.  False if good.
 COMMON BLOCKS:
 SIDE EFFECTS:
	using the font keywords makes resizing very slow and inaccurate
 RESTRICTIONS:
 PROCEDURE:
 MODIFICATION HISTORY:
	03-Feb-03 Added FIT, FILE, and WID keywords. Made font work [BD]
     3/24/93 - Written by Marc W. Buie, Lowell Observatory.
     4/27/93 - MWB, added TYPE and DEFAULT keywords.

(See src/idl_cvs/viewtext.pro)


BAD_PTDATA_ERROR

[Previous Routine] [Next Routine] [List of Routines]
 
 NAME:
       BAD_PTDATA_ERROR
 PURPOSE:
       Return a logical true IF  the PTDATA error is serious
 CATEGORY:
       GA, error processing
 CALLING SEQUENCE:
       logical = Bad_PTDATA_Error(ptdata_ierr)
 INPUTS:
       ptdata_ierr - error return from PTDATA calls
 KEYWORD PARAMETERS:
 OUTPUTS:
 RETURNED:	logical indication of a serious error 
		(per IDL definition, e.g., 0 IF  false)
 COMMON BLOCKS:
 MODIFICATION HISTORY:
               1-Apr-97 WMD Written

(See src/idl_cvs/bad_ptdata_error.pro)


BANGPW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       bangPW
 PURPOSE:
       Widget to set interactively some !P values. Lists colors by name, 
	if mk_color used; otherwise finds "closest" index to named colors. 
	Allows selection of several custom plotting symbols (see PLOTSYM).
 CATEGORY:
       Graphics, Widgets
 CALLING SEQUENCE:
       IDL> bangPW
 INPUTS:
 KEYWORD PARAMETERS:
     Optional Keywords:
	  UPDATECALLBACK - a routine to call after struct system variable is set
	  GROUP_LEADER - This widget is destroyed if it's GL is destroyed
 OUTPUTS:
       The system variable !P is changed               	
 COMMON BLOCKS:
       NONE
 EXAMPLE:
	IDL> bangPW, UPDATECALLBACK='myReplotter'
 NOTES:
	If an application overrides !P.* parameters, or specifies them on
	the plot command, changing settings with this widget will not override.
	!P.SYMSIZE not controlled, because it seems to have no effect.
 MODIFICATION HISTORY:
	29-Apr-08 check for routine being compiled (vs. needing to be found)
		  added a "Refresh" button which, if a proper plotting routine
		  is provided, will replot with any changed settings.
	17-Aug-01 Allow lines with symbols [BD]
	30-Oct-00 Written by Bill Davis, PPPL

(See src/idl_cvs/bangpw.pro)


BELL

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       BELL
 PURPOSE:
       Ring terminal bell.
 CATEGORY:
	Programming, Sound, Errors
 CALLING SEQUENCE:
       bell, [n]
 INPUTS:
       n = number of rings (def=1).  in
 KEYWORD PARAMETERS:
 OUTPUTS:
 COMMON BLOCKS:
 NOTES:
 MODIFICATION HISTORY:
       R. Sterner, 20 Oct, 1989.

 Copyright (C) 1989, Johns Hopkins University/Applied Physics Laboratory
 This software may be used, copied, or redistributed as long as it is not
 sold and this copyright notice is reproduced on each copy made.  This
 routine is provided as is without any express or implied warranties
 whatsoever.  Other limitations apply as described in the file disclaimer.txt.

(See src/idl_cvs/bell.pro)


BETTERRAINBOW

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       betterrainbow
 PURPOSE:
       Loads a rainbow color palette with 6 evenly-spaced (roughly) colors
 CATEGORY:
      Colors,  Graphics
 CALLING SEQUENCE:
       IDL> betterrainbow
 INPUTS:
       NONE  
 KEYWORD PARAMETERS:
    Optional Keywords:
	BAR - if set, will draw a color bar on plot
	nColors - # of colors to load (Defaults to !D.TABLE_SIZE)
	lessRed - if set, rainbow will have a smaller red region
	WhiteBottom - if set, there will be a white region at the bottom
	topColor - can be an index or 'white' or 'black'
	botColor - can be an index or 'white' or 'black'
	linePlots - if set, top color will be black and bottom color will be white
	noYellow - if set, don't have yellow (because doesn't show up well on white)
 OUTPUTS:
       NONE (color table changed)
 LIMITATIONS:
	always starts at the bottom of color palette.
 MODIFICATION HISTORY:
	18-Jun-2008 added NoYellow keyword
	02-Aug-2007 fix bug for /lineplot and ncolors<256; 
		    if /linePlots keyword set, reset !p.color & !p.background
	30-Apr-2007 added linePlots keyword
	26-May-2006 added ncolors and whiteBottom keywords
	14-Feb-2005 add topColor and botColor keywords
       15-Jul-02 Written by Bill Davis, PPPL

(See src/idl_cvs/betterrainbow.pro)


BETTERTICKLABELS

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

  PURPOSE:
 	Tick labels are made a little cleaner. E.g., shorter exponentials,
	no unnecessary trailing zeroes, accurate numbers when tick values
	are small differences between large numbers, etc.

 CATEGORY:
	Plotting, Graphics

  EXAMPLE:
	IDL> plot, y, ytickformat='betterticklabels'

  EXAMPLE A - Make a dummy plot call so can determine Tick Max:
	IDL> COMMON betterticklabels_common, yticklabels
	IDL> plot, y, ytick_get=yticklabels, ytickname=replicate('      ',30)
	IDL> AXIS, YAXIS=1, YRANGE=!y.crange, ytickformat='betterticklabels'
	IDL> dum = TEMPORARY(yticklabels)	; so doesn't affect later calls

  HISTORY:
	03-Mar-2008 slight mod to handle floating point comparison
       03-Aug-2006 fixed for values less than 2.e-6
	15-Apr-04 be able to return xtick values and x tic labels (NOT DEBUGGED)
	15-Oct-01 shift y axis labels if !p.font=0 (helps with some 3-D plots)
	11-Jan-01 shift y-axis labels if on TEK and !p.font=0 
	09-Oct-00 Written by Bill Davis

(See src/idl_cvs/betterticklabels.pro)


BIN2D

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       Bin2D
 PURPOSE:
       Create a density image (2D histogram) from arrays of (x,y) points,
       or create an image of a function from arrays of ( x, y, f(x,y) ) data.
       In first case each pixel counts # of (x,y) points falling into
       a 2D bin (box), thus forming an image of counters. In optional case,
       each pixel is the average of all f(x,y) data falling into the box.
       Boxes are determined by dividing the (x,y) range into a uniform grid.
 CATEGORY:
	Image Processing
 CALLING EXAMPLES:
       imh = Bin2D( x, y, NPIX=64, XRAN=[0,20], YRAN=[-5,5] )
       imz = Bin2D( x, y, FXY=z, NPIX=[200,100] )
 INPUTS:
       X = array (any dimension) of x values.
       Y = array of y values, should correspond to x array.
               optionally, x can be of the form [[x],[y]]
               containing both x and y coordinates as rows of matrix,
               and then argument y should not be specified.
 KEYWORDS:
       XRAN and YRAN : specify the x,y range to be mapped into the image.
                       Common Bin2D, xminc,xmaxc, yminc,ymaxc
                       can also specify the x,y range if keywords are not used,
                       otherwise the defaults = min-max ranges of x and y.
       NPIXELS = 1 or 2 element integer array specifying size of result,
                       (single value means square image), default = [64,64].
      /NOCLIP means do not bother checking if (x,y) are within range (faster).
       TYPE_VAR = type code specifying the IDL variable type of result,
               (1=byte, 2=short, 3=Long, 4=float,... default=2, short integer).
 KEYWORDS (optional):
       IMAGE_DENSITY = an existing image of counters (2D histogram)
                       to which the result is added (overrides NPIX=).
       FXY = array giving z = f(x,y) for the purpose of binning into an image
               however, bins with no (x,y) data points are left = zero.
               (NOTE: must specify XRAN and YRAN, or set /NOCLIP).
   if /BOTH is set and FXY=z is given, then the binned image of z=f(x,y) is
               returned by function, and an image of (x,y) density is
               returned via the keyword IMAGE_DENSITY.
 OUTPUTS:
       Result of function is an image of the density of (x,y) points, or an
       image of scalar field function if z values are given at (x,y) points.
 PROCEDURE:
       Binning is performed by finding number of (x,y) duplicates
       at each pixel,  using the IDL sort and where functions.
 HISTORY:
       written Frank Varosi, U.of MD., 1988.
               F.V. 1990, modif. for IDL-V2.

(See src/idl_cvs/bin2d.pro)


BITMAPBUTTONS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       bitmapbuttons
 PURPOSE:
       Illustrate use of bitmapbuttons in IDL
 CATEGORY:
       GUI, buttons
 CALLING SEQUENCE:
       IDL> bitmapbuttons
    Then click on buttons and watch them change.
 COMMON BLOCKS:
       none
 NOTES:
	Requires IDL 5.2 or later.
 LIMITATIONS:
	This may not be the easiest way to manage button states
 MODIFICATION HISTORY:
	27-Jan-00 [BD]

(See src/idl_cvs/bitmapbuttons.pro)


BITS

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       bits
 PURPOSE:
       Given a byte or integer, return a vector of 8 or 16 values
       which are the binary representation of the value.
 CATEGORY:
       bits, hardware
 INPUT:
       invalue - The byte or integer value to check
 OUTPUT:
       bitarr  - The 8-element array with values set
                 if the bit is set
 EXAMPLE:
	IDL> BITS, invalue, BITARR
 HISTORY:
       Written 1988 by M.Morrison
       13-Nov-92 (MDM) - Modified to allow integer*2 values
                         and to allow an array of values.
        7-Apr-94 (MDM) - Allow integer*4 values
       15-Aug-94 (MDM) - Corrected error from 7-Apr-94 mod which
                         did not allow an array of inputs

(See src/idl_cvs/bits.pro)


BPWFEDIT

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

 PURPOSE:
	Read, Edit, & Plot Breakpoint Waveform files used in ppcc system on TFTR
 CATEGORY:
       TFTR, Waveforms, GUI Editing

 REVISION HISTORY:
	21-Aug-98 Written by Bill Davis

(See src/idl_cvs/bpwfedit.pro)


BREAKMDSNAME

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

 PURPOSE:
       break an MDS pathname near the middle, if too long

 CATEGORY:
	MDSplus, Strings

 CALLING SEQUENCE:
        newLines = BreakMDSname( line )

 INPUTS:
       line - string containing an MDSplus tag or node name      in

 KEYWORD PARAMETERS:
	MAXLENGTH  - max line length (default 72)  OPTIONAL

 OUTPUTS:
	newlines - string array of MDSplus name broken near middle

 EXAMPLE:
    IDL> line = '\ENGINEERING::OPERATIONS.PC_OH_BR_1_CUR_1'
    IDL> newLines = BreakMDSname( line, MAXLENGTH=25 )

 COMMON BLOCKS:
 NOTES:

 MODIFICATION HISTORY:
	01-Apr-99 Written earlier by Bill Davis

(See src/idl_cvs/breakmdsname.pro)


BREAKSTRING

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       BreakString
 PURPOSE:
      Break a string up and return a string array
 CATEGORY:
       Strings
 CALLING SEQUENCE:
       IDL> str_array = BreakString(longString)
 INPUTS:
       longString = a string of words 
 KEYWORD PARAMETERS:
       Optional Keywords:
	  MAXLENGTH - Maximum length of array elements of output (else=72)
	  DELIMITER - delimiter, else ' ' 
		(see WORDARRAY for multispace delmiters')
	  COMPRESS    - if set, squeeze out extra imbedded blanks
 OUTPUTS:
       str_array = returned array of strings             	out
 COMMON BLOCKS:
       NONE
 EXAMPLE:
    IDL> line = '\ENGINEERING::OPERATIONS.PC_OH_BR_1_CUR_1'
    IDL> newLines = BreakString( BreakString, MAXLENGTH=25, DELIM=':' )
 NOTES:
	Can be used as a replacement for obsolete str_sep routine
 MODIFICATION HISTORY:
	31-Jan-02 bug fix and speed improvement 
       1-Apr-99 Written by Bill Davis, PPPL

(See src/idl_cvs/breakstring.pro)


BREAKTEXT

[Previous Routine] [Next Routine] [List of Routines]
 NAME:
       breaktext
 PURPOSE:
       break up (justify) text so lines not longer than a certain length.
 CATEGORY:
       strings
 CALLING SEQUENCE:
       IDL> newText = breakText( text )
 INPUTS:
	text - string array or scalar
 KEYWORD PARAMETERS:
	nper - number of characters per line (DEFAULT=72)
	break - if set, lines longer than nper characters will be broken at an earlier space
 OUTPUTS:
       string array returned
 EXAMPLE:
    text = ['This is the first line  this is the second', ' ',  $
	     '123456789 123456789 123456789 123456789 123456789 ']
    wrapped = breaktext( text, delim='  ', maxlength=25 )

 NOTE:
  
 MODIFICATION HISTORY:
	14-Aug-2008  Written by Bill Davis, PPPL 

(See src/idl_cvs/breaktext.pro)


BREAK_PATH

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

 PURPOSE: 
     Breaks up a path string into its component directories.

 CATEGORY:
       MDSplus, Strings
 CALLING SEQUENCE: 
     Result = BREAK_PATH( PATHS [ /NoCurrent])

 INPUTS: 
     PATHS   = A string containing one or more directory paths.  The
               individual paths are separated by commas, although in UNIX, 
               colons can also be used.  In other words, PATHS has the same 
               format as !PATH, except that commas can be used as a separator 
               regardless of operating system.

               A leading $ can be used in any path to signal that what follows 
               is an environmental variable, but the $ is not necessary.  (In 
               VMS the $ can either be part of the path, or can signal logical
               names for compatibility with Unix.)  Environmental variables
               can themselves contain multiple paths.

 OUTPUT: 
      The result of the function is a string array of directories.
      Unless the NOCURRENT keyword is set, the first element of the array is 
      always the null string, representing the current directory.  All the 
      other directories will end in the correct separator character for the 
      current operating system.

 OPTIONAL INPUT KEYWORD:
      /NOCURRENT = If set, then the current directory (represented by
               the null string) will not automatically be prepended to the
               output.

 PROCEDURE CALLS:
      Functions:  DATATYPE(), breakstring()

 REVISION HISTORY:
       Version 1, William Thompson, GSFC, 6 May 1993.
               Added IDL for Windows compatibility.
       Version 2, William Thompson, GSFC, 16 May 1995
               Added keyword NOCURRENT
       Version 3, William Thompson, GSFC, 29 August 1995
               Modified to use OS_FAMILY
       Version 4, Zarro, GSFC, 4 August 1997
               Added trim to input
       Converted to IDL V5.0   W. Landsman 25-Nov-1997

(See src/idl_cvs/break_path.pro)


BTEST

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

 PURPOSE:
    To test bit N in FIX(X)

 CATEGORY:
    Bits, Hardware

 CALLING SEQUENCE:
    YesNo = btest( X, N )

 PARAMETERS:  
    Inputs:
    	X      (REQ) (I) (0 1) (I  F)
           	X is the variable to be tested
   
    	N      (REQ) (I) (0) (I)
           	The bit of X to be tested
     Returned:
    	YESNO  (REQ) (O) (0 1) (I)
           	The result of the test. 1(true) if bit N is set, 0(false)
           	otherwise.

 EXAMPLES:

        YESNO = btest( !X.STYLE, 4 )
        IF YESNO THEN PRINT,'X-axis suppressed' $
                 ELSE PRINT,'Draw X-axis'

        To find points in NEWSIPS which are outside calibrated region:
        YESNO = btest( ABS(NU),1 )             ; look for nu flag = -2
        IND = WHERE (YESNO EQ 0)            ; keep points where yesno = 0
        PLOT,W(IND),F(IND)                  ; plot calibrated points
        
 NOTES:

     Note that negative integers are stored in twos complement form.
     Therefore, the left-most bits are ON rather than OFF as they are for 
     positive numbers. Input the absolute value of X is negative numbers 
     to avoid this problem. 

     This procedure can be used to check the values of complex
     IDL system variables such as ![XYZ].STYLE.

 PROCEDURE:

     Checks whether (FIX(X) OR (NOT 2^N)) = -1 to set the output
     flag YESNO.

 MODIFICATION HISTORY:
	26-Oct-99 Convert from btest to make a function (like FORTRAN)
     Mar  6 1983 RJP GSFC initial program
     Aug 24 1987 RWT GSFC add PARCHECK
     Mar  7 1988 CAG GSFC all VAX RDAF-style prolog
     Jul 13 1990 RWT GSFC Sun mods: use examples pertinent to SUN IDL
                 and add listing of procedure call statement
     Jun 19 1991 PJL GSFC cleaned up; tested on SUN and VAX; updated prolog
     Mar  8 1993 RWT GSFC modify to allow X & YESNO to be vectors and 
                 add documentation about negative numbers.

(See src/idl_cvs/btest.pro)


CACHECKMONITOR

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

 PURPOSE:
       This function returns a non-zero value if there is a new (unread)
       monitor for this process variable, otherwise it returns zero.
       This function is particularly useful when a caGet() operation is
       expensive in time, e.g. reading large arrays.

 CATEGORY:
       EPICS Channel Access Interface

 CALLING SEQUENCE:
       state = caCheckMonitor(pvname)

 INPUTS:
       pvname: The name of the process variable on which to check the monitor.

 OUTPUTS:
       The function return value is zero if no new monitor value is available,
       and non-zero if a new monitor value is available.

 PROCEDURE:
       This routine uses ezcaNewMonitorValue(). The "type" parameter required
       by ezcaNewMonitorValue() is the native EZCA data type as determined
       by caGetCountAndType().

 EXAMPLES:
       IDL> state = caCheckMonitor('test_ao1',event)

 MODIFICATION HISTORY:
       Written by:     Mark Rivers
       June 28, 1995

(See src/idl_cvs/ezcaIDL.pro)


CACLEARMONITOR

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

 PURPOSE:
       This procedure clears a monitor on the specified process variable.
       It cancels the effect of caSetMonitor().

 CATEGORY:
       EPICS Channel Access Interface

 CALLING SEQUENCE:
       status = caClearMonitor(pvname)

 INPUTS:
       pvname: The name of the process variable on which to clear the monitor.

 OUTPUTS:
       The function return value of caClearMonitor is a status value.  The
       status is 0 if the routine was successful (i.e. the process variable
       exists) and non-zero if the routine failed.

 PROCEDURE:
       This routine uses ezcaClearMonitor(). The "type" parameter required
       by ezcaClearMonitor is the native EZCA data type as determined
       by caGetCountAndType().

 EXAMPLES:
       IDL> status = caClearMonitor('test_ao1')

 MODIFICATION HISTORY:
       Written by:     Mark Rivers
       June 28, 1995

(See src/idl_cvs/ezcaIDL.pro)


CADEBUG

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

 PURPOSE:
       This procedure turns the EZCA debugging flag on or off. Turning on
       the debugging flag prints lots of information, which is mainly
       useful to developers.

 CATEGORY:
       EPICS Channel Access Interface

 CALLING SEQUENCE:
       caDebug, state

 INPUTS:
       state:  state=1 turns debugging on, state=0 turns debugging off.

 OUTPUTS:
       None

 PROCEDURE:
       This routine uses ezcaDebugOn() and ezcaDebugOff().

 EXAMPLES:
       IDL> caDebug, 1     ; Turn on debugging
       setting Debug
       IDL> status = caGet('test_ao1', value)
       ca_pend_event(0.000010)
       --start end-of-prologue() report
       ****** Start State:
       AutoErrorMessage T InGroup F Debug T Trace F ErrorLocation LastOnly ListPrint
       LastOnly TimeoutSeconds 0.050000
       Workp : 9cf970 trashme F (nxt 0)
       Channel_avail_hdr 0 :
       ...
       ...
       IDL> caDebug, 0 ; Turn off debugging

 MODIFICATION HISTORY:
       Written by:     Mark Rivers
       June 28, 1995

(See src/idl_cvs/ezcaIDL.pro)


CAENDGROUP

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

 PURPOSE:
       This function ends an "asynchronous group". See caStartGroup for more
       information on asynchronous groups.
       caEndGroup flushes the queue of caGet and caPut calls and waits for
       replies from the channel access servers.

 CATEGORY:
       EPICS Channel Access Interface

 CALLING SEQUENCE:
       stat = caEndGroup(status)

 INPUTS:
       None.

 OUTPUTS:
       The function return value is 0 if the operation was successful,
       otherwise it is the first encountered non-successful return code.
       The optional status parameter can be used to return the status code
       of each operation in the group.

 OPTIONAL OUTPUT PARAMETERS:
       status: If this optional parameter is present then it returns a
               array of status information, one for each channel access
               call in the group.

 COMMON BLOCKS:
       EZCA_COMMON contains a flag (ingroup) which indicates if we
       are currently in an asynchronous group. This routine clears that flag.

 PROCEDURE:
       If the status parameter is present then this routine uses
       ezcaEndGroupWithReport().  If the parameter is not present then
       the routine calls ezcaEndGroup().

 RESTRICTIONS:
       When the status parameter is present, and ezcaEndGroupWithReport() is
       called, there is no way to know in advance how many status values
       will be returned.  This routine passes a status array with 1024
       elements, and then truncates it to the actual length.  The maximum
       number of status values which can be retrieved is thus 1024. No errors
       will occur if an asynchronous group has more than 1024 calls, but
       only the first 1024 status values can be obtained.
       This is probably sufficient for most applications!

 EXAMPLES:
       IDL> caStartGroup
       IDL> status = caget('test_ao1.SCAN', scan)
       IDL> status = caget('test_mca1.ERTM', ertm)
       IDL> ; Print out values - they will be zero.
       IDL> help, scan, ertm
       IDL> status = caEndGroup()
       IDL> ; Print out values after executing caEndGroup, they are non-zero
       IDL> help, scan, ertm
       Output:
           SCAN            INT       =        0
           ERTM            FLOAT     =      0.000000
           SCAN            INT       =        6
           ERTM            FLOAT     =       7.10000

 MODIFICATION HISTORY:
       Written by:     Mark Rivers
       June 28, 1995

(See src/idl_cvs/ezcaIDL.pro)


CAERROR

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

 PURPOSE:
       This procedure controls error printing and returns error strings.

 CATEGORY:
       EPICS Channel Access Interface

 CALLING SEQUENCE:
       caError, err_string, /ON, /OFF, /PRINT, prefix=prefix

 INPUTS:
       None

 KEYWORD PARAMETERS:
       /ON
           Setting this switch turns on automatic error message printing
           on stdout.  Automatic printing is initially enabled.

       /OFF
           Setting this switch turns off automatic error message printing
           on stdout.

       /PRINT
           Setting this switch prints the last error message on stdout.

       prefix=prefix
           The prefix keyword can be used to pass a string which is prefixed
           to error messages printed with /PRINT or fetched via the optional
           output parameter.

 OPTIONAL OUTPUT PARAMETERS:
       err_string:
           If this parameter is present then it will contain the text of the
           last error message.

 COMMON BLOCKS:
       EZCA_COMMON contains a flag (ingroup) which indicates if we
       are currently in an asynchronous group. This routine tests that flag.

 PROCEDURE:
       This routine uses ezcaPerror(), ezcaAutoErrorMessageOn(),
       ezcaAutoErrorMessageOff(), and ezcaGetErrorString()

 EXAMPLE:
       IDL> ; Define a prefix and turn on error messages
       IDL> caError, prefix='My program', /ON
       IDL> ; Fetch the last error message
       IDL> caError, err_string

 MODIFICATION HISTORY:
       Written by:     Mark Rivers
       June 28, 1995

(See src/idl_cvs/ezcaIDL.pro)


CAGET

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

 PURPOSE:
       This function reads the value of a Channel Access process variable.

 CATEGORY:
       EPICS Channel Access Interface

 CALLING SEQUENCE:
       Status = caGet(pvname, value, /string, max=n)

 INPUTS:
       pvname: The name of the process variable for which the value is to
               be returned.

 KEYWORD PARAMETERS:
       STRING: Set this flag to force caGet to return a string, rather than
               a number.  This flag is particularly useful when the native
               channel access data type is ENUM (3), since the string is
               more descriptive than the number.

       MAX_ELEMENTS: This keyword parameter is used to limit the number of
               values returned by caGet. caGet normally returns the native
               element count for a process variable. Setting MAX to a
               number less than this will cause caGet to return only the
               first MAX values in the array.

 OUTPUTS:
       value:  The value of the process variable. By default, caGet returns
               "value" with the native data type and number of elements
               of the process variable. It determines this information by
               calling caGetCountAndType().  Note that if caGet is called
               after calling caStartGroup but before calling caEndGroup then
               the IDL variable "value" is created, but will not actually
               contain the data until caEndGroup is called.

       The function return value of caGet is a status value.  The
       status is 0 if the routine was successful (i.e. the process variable
       exists) and non-zero if the routine failed.  If caGet is called from
       within an asynchronous group then the status return only indicates
       whether the operation was successfully queued.

 COMMON BLOCKS:
       EZCA_COMMON contains a flag (ingroup) which indicates if we
       are currently in an asynchronous group. This routine tests that flag.

 SIDE EFFECTS:
       This routine will causes a channel access search to take place if
       this is the first time this process variable has been referenced. It
       performs a ca_get, unless called as part of an asynchronous group.

 RESTRICTIONS:
       There are two important restrictions which must be kept in mind when
       calling caGet from inside a "group", i.e. after calling caStartGroup
       and before calling caEndGroup.

       1) The IDL "value" variable (i.e. the second parameter
       passed to caGet) must not be "re-used" or deleted before the call to
       caEndGroup. The reason for this is that EZCA has been passed the
       address of this variable as the location in which the data is to be
       copied when caEndGroup is called. Thus, this location must still
       point to a valid memory location when caEndGroup is called.
       If the "value" variable is re-used then IDL's behavior is
       unpredictable, and bus errors/access violations could occur.

       2) When using caGet to read strings, the data type returned will be
       a byte array, rather than a string.  The reason has to do with the
       manner in which IDL passes strings, which requires that EZCA actually
       be passed pointers to byte arrays. When caGet is called outside of a
       group it automatically converts the byte array to a string before
       returning the value. However when caGet is called inside of a group
       it cannot perform this conversion, since it cannot be done until after
       the data is read, which does not occur until caEndGroup is called.
       Thus, it is the user's responsibility to convert the data from a byte
       array to a string after calling caEndGroup. This is done very simply
       with the string() function. For more information see the example below.

 PROCEDURE:
       This routine uses ezcaGet().

 EXAMPLES:
       IDL> ; The following is an example of a single caGet
       IDL> status = caGet('test_mca1.VAL', value)

       IDL> ; The following is an example of a valid grouped operation
       IDL> ; It also shows how to handle strings.
       IDL> caStartGroup
       IDL> status = caGet('test_mca1.VAL', mca_value)
       IDL> status = caGet('test_vme1.DESC', vme_desc) ; This is a string PV
       IDL> status = caEndGroup()
       IDL> vme_desc = string(vme_desc)    ; Convert from byte array to string

       IDL> ; The following is an example of an INVALID grouped operation
       IDL> caStartGroup
       IDL> status = caGet('test_mca1.VAL', mca_value)
       IDL> status = caGet('test_vme1.VAL', vme_value)
       IDL> mca_value=0
       IDL> ; We have redefined mca_value, so the previous location is
       IDL> ; undefined. NO NOT DO THIS!
       IDL> status = caEndGroup()

 MODIFICATION HISTORY:
       Written by:     Mark Rivers
       June 28, 1995

(See src/idl_cvs/ezcaIDL.pro)


CAGETARRAY

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

 PURPOSE:
       This function reads values for a list of Channel Access process
       variable. It returns 0 if successful, returns -1 if failed.

 CATEGORY:
       EPICS Channel Access Interface

 CALLING SEQUENCE:
       Status = caGetArray(names,pdata,max=no,type=i,/TYPE,/EVENT)

 INPUTS:
       names:  The variable for a list of channel access PV names for which
               the array of data is to be returned.

 KEYWORD PARAMETERS:
      MAX:    Default to 1 for a list of PV names. If more than one values
              to be returned for a list of array type PV names, this keyword
              must be specified. If the `no' specified is greater than the
              native count, zeros will be padded in the output array.

              If only one PV name is input, then caGetArray returns
              the native element count for the process variable. Setting
              MAX to a number less than the native count this will cause
              caGetArray to return only the first MAX values for the PV.

      TYPE:   This keyword specifies the IDL data type to be returned by
              the output array. If not specified, it defaults to 5, i.e.
              double precision type of data will be returned by the
              output array.

                1 - byte      2 - short       3 - long      4 - float
                5 - double    7 - string

     /TYPE    Instead of type=i a user can use the IDL data type keyword
              directly, the data type keyword supercedes the type=i
              specification. Valid types given below

                            /double
                            /float
                            /string
                            /long
                            /short
                            /byte

    /EVENT    If specified use the ca_array_get_callback otherwise use
              the ca_array_get

 OUTPUTS:
     pdata:  The output variable,  pdata(max,noNames), returns the data
             array for the requested list of PV names. The `max' is the no
             of values specified by the keyword MAX, the `noNames' is the
             number of PV names in the input variable names.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       This routine will causes a channel access search to take place if
       this is the first time this process variable has been referenced.

 RESTRICTIONS:
       Only one type of data can be requested for a list of PV names.

 PROCEDURE:
       This routine uses Ezca_getArray() from the EzcaScan library.

 EXAMPLES:
       Three examples are given below.
       The first caGetArray call returns only the first value for each PV
       name, the second and third caGetArray call both returns 10 float
       values for each PV name

       IDL> names=['chademowf7','chademowf8']
       IDL> st = caGetArray(names,pdata)
       IDL> st = caGetArray(names,pdata,max=10,/float)
       IDL> st = caGetArray(names,pdata,max=10,type=4)

 MODIFICATION HISTORY:
       Written by:     Ben-chin Cha      Dec, 1995
      04-11-96     bkc    If array get failed, only the pvnames not found are
                          reported
      04-22-96     bkc    Replace caError by caGetError

(See src/idl_cvs/ezcaIDL.pro)


CAGETCONTROLLIMITS

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

 PURPOSE:
       This procedure reads the control limits for the specified channel
       access process variable.

 CATEGORY:
       EPICS Channel Access Interface

 CALLING SEQUENCE:
       status = caGetControlLimits(pvname, low, high)

 INPUTS:
       pvname: The name of the process variable from which to read the
               control limits.

 OUTPUTS:
       low:    The low control limit (double).

       high:   The high control limit (double).

       The function return value of caGetControlLimits is a status value.  The
       status is 0 if the routine was successful (i.e. the process variable
       exists) and non-zero if the routine failed.

 PROCEDURE:
       This routine uses ezcaGetControlLimits().

 EXAMPLE:
       IDL> status = caGetControlLimits('test_ao1', low, high)

 MODIFICATION HISTORY:
       Written by:     Mark Rivers
       June 28, 1995

(See src/idl_cvs/ezcaIDL.pro)


CAGETCOUNTANDTYPE

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

 PURPOSE:
       This function returns the number of elements and data type of a
       Channel Access process variable.

 CATEGORY:
       EPICS Channel Access Interface

 CALLING SEQUENCE:
       Status = caGetCountAndType(pvname, count, type)

 INPUTS:
       pvname: The name of the process variable for which information is to
               be returned.

 OUTPUTS:
       count:  The number of elements in the process variable. This is 1 for
               scalar process variables and more than 1 for arrays.

       type:   This is a 3 element array containing information about the data
               type of the process variable.
               type(0) = Channel access data type as defined in "cadef.h"
               type(1) = EZCA data type as defined in "ezca.h"
               type(2) = IDL/PV-WAVE data type as defined in size()
               These data types are as follows:

               Name    Channel Access      EZCA        IDL/PVWAVE
               String      0                 1             7
               Short       1                 2             2
               Float       2                 4             4
               Enum        3                 2 (short)     2 (short)
               Byte        4                 0             1
               Long        5                 3             3
               Double      6                 5             5

   The function return value of caGetCountAndType is a status value.  The
   status is 0 if the routine was successful (i.e. the process variable exists)
   and non-zero if the routine failed.

 SIDE EFFECTS:
       This routine will cause a Channel Access search to take place if this is
       the first time this process variable has been referenced.

 RESTRICTIONS:
       The channel access data type enum is mapped to EZCA and IDL short
       data types.  However, application programs can use this routine to
       determine if the native channel access data type is enum, and then
       use caGet(pvname, value, /string) to read the string equivalent of the
       process variable. Programs can also use
       caGetEnumStrings(pvname, strings) to read the strings for the all of
       the possible values of an enum process variable.

 PROCEDURE:
       This routine uses ezcaPvToChid() and then ca_element_count() and
       ca_field_type().
       Note that this routine always returns its values "immediately", even
       if it is called between a caStartGroup and caEndGroup.

 EXAMPLE:
       IDL> status = caGetCountAndType('test_mca1.VAL', count, type)
       IDL> print, status
       0                       ; Status = success
       IDL> print, count
       2048                    ; Array with 2048 elements
       IDL> print, type
           5       3       3   ; Long data type
 MODIFICATION HISTORY:
       Written by:     Mark Rivers
       June 28, 1995

(See src/idl_cvs/ezcaIDL.pro)


CAGETENUMSTRINGS

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

 PURPOSE:
       This function returns all of the choice strings associated with a
       Channel Access "enum" process variable. It is particularly useful
       for building menus of options.

 CATEGORY:
       EPICS Channel Access Interface

 CALLING SEQUENCE:
       Status = caGetEnumStrings(pvname, strings)

 INPUTS:
       pvname: The name of the process variable for which the enum strings
               are to be returned. The native channel access data type of
               this process variable must be enum (3).

 OUTPUTS:
       strings: A string array containing the strings for each possible
               value of the enum variable.

       The function return value of caGetEnumStrings is a status value.  The
       status is 0 if the routine was successful (i.e. the process variable
       exists and is of type enum) and non-zero if the routine failed.

 SIDE EFFECTS:
       This routine causes a channel access read. It does not use the
       grouping mechanism of EZCA, i.e. it always executes immediately.

 RESTRICTIONS:
       There must be less than MAX_ENUM_STATES enum strings and they must each be
       less than MAX_STRING_SIZE characters.

 PROCEDURE:
       This routine uses ezcaPvToChid and then ca_get() with a request type
       of DBR_GR_ENUM.  The functionality required by this routine is not
       presently provided directly in EZCA, although it should probably be
       added.

 EXAMPLES:
       IDL> status = caGetEnumStrings('test_mca1.SCAN', strings)
       IDL> for i=0, n_elements(strings)-1 do print, strings(i)
       Passive
       Event
       I/O Intr
       10 second
       5 second
       2 second
       1 second
       .5 second
       .2 second
       .1 second

 MODIFICATION HISTORY:
       Written by:     Mark Rivers
       June 28, 1995

(See src/idl_cvs/ezcaIDL.pro)


CAGETERROR

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

 PURPOSE:
       This function get CA return codes for a list of process variable names.
       Return code can be 0 or -1, 0 for success, -1 for failure.

 CATEGORY:
       EPICS Channel Access Interface

 CALLING SEQUENCE:
       Status = caGetError(Pvname,Err)

 INPUTS:
      Pvname: The variable for a list of process variables for which the
              channel access return code to be checked.

 KEYWORD PARAMETERS:
       None.

 OUTPUTS:
       Err:  The corresponding return code(s) for the Pvname(s) are returned.
             Returns array of 0 or 1. 0 indicates success, 1 indicates failed.

 COMMON BLOCKS:
       None.

 SIDE EFFECTS:
       This routine will causes a channel access search to take place if
       this is the first time pvnames has been referenced.

 RESTRICTIONS:
       None.

 PROCEDURE:
       This routine uses Ezca_get_error_array() from the EzcaScan library.

 EXAMPLES:
       IDL> print,caGetError('chademoai1')
       IDL> x = ['chademoai1','chademoai2']
       IDL> status = caGetError(x)

 MODIFICATION HISTORY:
       Written by:     Ben-chin Cha      Dec, 1995

(See src/idl_cvs/ezcaIDL.pro)


CAGETGRAPHICLIMITS

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

 PURPOSE:
       This procedure reads the graphic limits for the specified channel
       access process variable.

 CATEGORY:
       EPICS Channel Access Interface

 CALLING SEQUENCE:
       status = caGetGraphicLimits(pvname, low, high)

 INPUTS:
       pvname: The name of the process variable from which to read the
               graphic limits.

 OUTPUTS:
       low:    The low graphic limit (double).

       high:   The high graphic limit (double).

       The function return value of caGetGraphicLimits is a status value.  The
       status is 0 if the routine was successful (i.e. the process variable
       exists) and non-zero if the routine failed.

 PROCEDURE:
       This routine uses ezcaGetGraphicLimits().

 EXAMPLE:
       IDL> status = caGetGraphicLimits('test_ao1', low, high)

 MODIFICATION HISTORY:
       Written by:     Mark Rivers
       June 28, 1995

(See src/idl_cvs/ezcaIDL.pro)


CAGETPRECISION

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

 PURPOSE:
       This procedure reads the precision for the specified channel
       access process variable.

 CATEGORY:
       EPICS Channel Access Interface

 CALLING SEQUENCE:
       status = caGetPrecision(pvname, precision)

 INPUTS:
       pvname: