NAME ASTROLIB PURPOSE: Add the non-standrad system variables in use in the IDL Astronomy User's Library. Also defines the environment variable or VMS logical ASTRO_DATA pointing to the directory containing data files associated with the IDL Astronomy library (system dependent). CALLING SEQUENCE: ASTROLIB INPUTS: None. OUTPUTS: None. METHOD: The non-standard system variables !PRIV, !DEBUG, !TEXTUNIT, and !TEXTOUT are added using DEFSYSV. REVISION HISTORY: Written, Wayne Landsman, July 1986. Use DEFSYSV instead of ADDSYSVAR December 1990
(See /usr/local/idl/lib/zastron/misc/astrolib.pro)
NAME: AVG PURPOSE: Calculate the average value of an array, or calculate the average value over one dimension of an array as a function of all the other dimensions. CALLING SEQUENCE: RESULT = AVG( ARRAY, [ DIMENSION ] ) INPUTS: ARRAY = Input array. May be any type except string. OPTIONAL INPUT PARAMETERS: DIMENSION = Optional dimension to do average over, scalar OUTPUTS: The average value of the array when called with one parameter. If DIMENSION is passed, then the result is an array with all the dimensions of the input array except for the dimension specified, each element of which is the average of the corresponding vector in the input array. For example, if A is an array with dimensions of (3,4,5), then the command B = AVG(A,1) is equivalent to B = FLTARR(3,5) FOR J = 0,4 DO BEGIN FOR I = 0,2 DO BEGIN B(I,J) = TOTAL( A(I,*,J) ) / 4. ENDFOR ENDFOR RESTRICTIONS: Dimension specified must be valid for the array passed; otherwise the input array is returned as the output array. PROCEDURE: AVG(ARRAY) = TOTAL(ARRAY)/N_ELEMENTS(ARRAY) when called with one parameter. MODIFICATION HISTORY: William Thompson Applied Research Corporation July, 1986 8201 Corporate Drive Landover, MD 20785 Converted to Version 2 July, 1990 Replace SUM call with TOTAL W. Landsman May, 1992
(See /usr/local/idl/lib/zastron/misc/avg.pro)
NAME: BOOST_ARRAY PURPOSE: Add array APPEND to array DESTINATION, allowing the dimensions of DESTINATION to adjust to accomodate it. If both input arrays have the same number of dimensions, then the output array will have one additional dimension. Otherwise, the last dimension of DESTINATION will be incremented by one. CATEGOBY: Utility CALLING SEQUENCE: BOOST_ARRAY, DESTINATION, APPEND INPUT: DESTINATION = Array to be expanded. APPEND = Array to append to DESTINATION. OUTPUTS: DESTINATION = Expanded output array. RESTRICTIONS: DESTINATION and APPEND have to be either both of type string or both of numerical types. APPEND cannot have more dimensions than DESTINATION. MODIFICATION HISTOBY: Written Aug'88 (DMZ, ARC) Modified Sep'89 to handle byte arrays (DMZ) Modifed to version 2, Paul Hick (ARC), Feb 1991 Removed restriction to 2D arrays, William Thompson (ARC), Feb 1992.
(See /usr/local/idl/lib/zastron/misc/boost_array.pro)
NAME: BSORT PURPOSE: Function to sort data into ascending order, like a simple bubble sort. original subscript order is maintained when values are equal (FIFO). (This differs from the IDL SORT routine alone, which may rearrange order for equal values) CALLING SEQUENCE: result = bsort( array, [ asort, /INFO, /REVERSE ] ) INPUT: Array - array to be sorted OUTPUT: result - sort subscripts are returned as function value OPTIONAL OUTPUT: Asort - sorted array OPTIONAL KEYWORD INPUTS: /REVERSE - if this keyword is set, and non-zero, then data is sorted in descending order instead of ascending order. /INFO = optional keyword to cause brief message about # equal values. HISTORY written by F. Varosi Oct.90: uses WHERE to find equal clumps, instead of looping with IF ( EQ ). compatible with string arrays, test for degenerate array 20-MAY-1991 JKF/ACC via T AKE- return indexes if the array to be sorted has all equal values. Aug - 91 Added REVERSE keyword W. Landsman
(See /usr/local/idl/lib/zastron/misc/bsort.pro)
NAME: CIRRANGE PURPOSE: To force an angle into the range 0 <= ang < 360. CALLING SEQUENCE: cirrange, ang INPUTS/OUTPUTS: ang - The angle to modify, in degrees. This parameter is changed by this procedure. Can be a scalar or vector. KEYWORDS: RADIANS - If present and non-zero, the angle is specified in radians rather than degrees. It is forced into the range 0 <= ang < 2 PI. PROCEDURE: The upper limit is added to negative values until there are no more. Then the MOD operator is applied to all the angles to deal with values that are too large. MODIFICATION HISTORY: Written by Michael R. Greason, Hughes STX, 10 February 1994.
(See /usr/local/idl/lib/zastron/misc/cirrange.pro)
NAME: CONV_UNIX_VAX PURPOSE: To convert Unix IDL data types to VAX IDL data types. Currently assumes the Unix IDL data type is IEEE standard. CALLING SEQUENCE: CONV_UNIX_VAX, variable PARAMETERS: variable - The data variable to be converted. This may be a scalar or an array. Valid datatypes are integer, longword, floating point, and double precision. The result of the conversion is passed back in the original variable. RESTRICTIONS: Only tested for data from IEEE standard Unix machines (e.g. SUN0 EXAMPLE: Read a 100 by 100 matrix of floating point numbers from a data file created on a Sun. Then convert the matrix values into VAX format. IDL> openr,1,'vax_float.dat IDL> data = fltarr(100,100) IDL> forrd,1,data IDL> CONV_UNIX_VAX,data MODIFICATION HISTORY: Version 1 By John Hoegy 13-Jun-88 04-May-90 - WTT: Created CONV_UNIX_VAX from VAX2SUN, reversing floating point procedure.
(See /usr/local/idl/lib/zastron/misc/conv_unix_vax.pro)
NAME: CONV_VAX_BLOCK PURPOSE: To convert VMS Fortran unformatted block delimiters to their Unix counterparts. CALLING SEQUENCE: CONV_VAX_BLOCK, FILENAME [, /EXTEND ] INPUTS: FILENAME = Name(s) of files to be deblocked. Can include wildcard characters, e.g. "*.DAT" OPTIONAL INPUT PARAMETERS: None. OPTIONAL KEYWORD PARAMETERS: EXTEND = If passed, then block length checking is disabled. Allows blocks larger than 2048 bytes to be read in. TARGET_ARCH = Name (string) of desired target architecture if using this function on a VAX. Otherwise !VERSION.ARCH is used to determine the conversion. SUBROUTINES CALLED: READ_VAX_BLOCK RESTRICTIONS: The file to be deblocked must be copied over as binary. Files which have already been deblocked must not be reprocessed. The program tries to detect this situation. PROCEDURE: The file is read in block by block and the valid data is written to a new file with the added extension ".TEMP". When completed, the new file is renamed, replacing the original file. MODIFICATION HISTORY: William Thompson, January, 1990. December, 1990, added TARGET_ARCH keyword.
(See /usr/local/idl/lib/zastron/misc/conv_vax_block.pro)
NAME: CONV_VAX_UNIX PURPOSE: To convert VAX IDL data types to UNIX (Sun,MIPS,etc.) IDL data types. The architecture is obtained from IDL sys.var. !VERSION.ARCH. CALLING SEQUENCE: var_unix = conv_vax_unix( var_vax, TARGET_ARCH = ) INPUT-OUTPUT PARAMETER: variable - The data variable to be converted. This may be a scalar or an array. All IDL datatypes are valid (including structures). The result of the conversion is returned by the function. INPUT KEYWORD: TARGET_ARCH = name (string) of desired target architecture if using this function on a VAX. otherwise !VERSION.ARCH is used to determine the conversion. Valid names are 'sparc','386','386i',',or 'mipsel' EXAMPLE: Read a 100 by 100 matrix of floating point numbers from a data file created on a VAX. Then convert the matrix values into Sun format. IDL> openr,1,'vax_float.dat' IDL> data = fltarr(100,100) IDL> forrd,1,data IDL> data = conv_vax_unix( data ) MODIFICATION HISTORY: Written F. Varosi August 1990 Added support for MIPSEL (DecStation) P. Keegstra April 1992
(See /usr/local/idl/lib/zastron/misc/conv_vax_unix.pro)
NAME: DEFINE PURPOSE: Use the SETLOG procedure of VMS IDL to emulate the DCL DEFINE command, or use the SETENV procedure of UNIX IDL to set an environment variable. CALLING SEQUENCE: DEFINE ;Prompt for ENVIRONMENT and equivalence names DEFINE, Environment_name, Equivalence_name OPTIONAL INPUTS: Environment_name - scalar string giving the ENVIRONMENT name to be defined Equivalence_name - scalar or vector string giving equivalence name(s) to the ENVIRONMENT. If multiple names are to assigned to the ENVIRONMENT they can be supplied in either as a string vector or in a single string with the names delineated by commas. DEFINE will prompt for ENVIRONMENT_NAME and EQUIVALENCE_NAME if they are not supplied. EXAMPLE (VMS): Define the the logical name ZDBASE to point to the directories UIT$USER1:[JONES] and UIT$USER2:[SMITH] DEFINE, 'ZDBASE', 'UIT$USER1:[JONES],UIT$USER2:[SMITH]' REVISION HISTORY: Written W. Landsman June 1990 Modified for use on Unix M. Greason, STX, August 1990. Combined VAX and Unix versions for use on both machines, N. Collins, STX, Nov. 1990.
(See /usr/local/idl/lib/zastron/misc/define.pro)
NAME: DETABIFY PURPOSE: Replaces tabs in character strings with the appropriate number of spaces. The number of space characters inserted is calculated to space out to the next effective tab stop, each of which is eight characters apart. CALLING SEQUENCE: Result = DETABIFY( CHAR_STR ) INPUT PARAMETERS: CHAR_STR = Character string variable (or array) to remove tabs from. OUTPUT: Result of function is CHAR_STR with tabs replaced by spaces. RESTRICTIONS: CHAR_STR must be a character string variable. MODIFICATION HISTORY: William Thompson, Feb. 1992.
(See /usr/local/idl/lib/zastron/misc/detabify.pro)
NAME: DIR PURPOSE: Emulates the DCL command DIRECTORY or the UNIX command ls in its simplest (brief) form. CALLING SEQUENCE: DIR [, FILENAME ] OPTIONAL INPUT PARAMETERS: FILENAME - Filename specification. Can be of any form that DCL or UNIX recognizes, with some provisos listed below. If omitted, then "." is assumed if on a Sparc Station, or "*.*;*" is assumed if on a VAX. No parsing of the filename is performed on the Sparc Station. The following conventions should be used: Use DIR,'*.FOR' instead of DIR,'.FOR' to list all files with the extension ".FOR". Use DIR,'IDL$SYSPROG:' instead of DIR,'IDL$SYSPROG' to list all files in the directory IDL$SYSPROG on a VAX. OUTPUTS: None. UNIX PROCEDURE: The filename specification is formed, if necessary, and a command is spawned to the operating system to list the directory. VMS PROCEDURE: The filename specification is formed, and FINDFILE is used to find the filenames. These are then parsed to produce output at the terminal. MODIFICATION HISTORY: William Thompson Applied Research Corporation September, 1987 8201 Corporate Drive Landover, MD 20785 Changed for use on a SUN workstation from the VMS version. M. Greason, STX, August 1990. Combined VAX and SUN versions, N. Collins, Nov 1990. Initial 1X in format changed to T1. RSH, HSTX, 22-May-1992.
(See /usr/local/idl/lib/zastron/misc/dir.pro)
NAME: FDECOMP PURPOSE: Routine to decompose file name. On VMS machines the decomposition is disk + directory + name + qualifier + version On non-VMS machines the decomposition is directory + name + qualifier CALLING SEQENCE: fdecomp, filename, disk, dir, name, qual, version INPUT: filename - string file name, scalar OUTPUTS: All the output parameters are scalar strings disk - disk name, always '' on a non-VMS machine, scalar string dir - directory name, scalar string name - file name, scalar string qual - qualifier, set equal to the characters beyond the last "." version - version number, always '' on a non-VMS machine, scalar string NOTE: On a Vax the filenames "MOTD" and "MOTD." are distinguished by the fact that qual = '' for the former and qual = ' ' for the latter. ROUTINES CALLED: Function GETTOK HISTORY version 1 D. Lindler Oct 1986 converted to SUN IDL. M. Greason, STX, 30 July 1990. Include VMS DECNET machine name in disk W. Landsman HSTX Feb. 94 Converted to Mac IDL, I. Freedman HSTX March 1994
(See /usr/local/idl/lib/zastron/misc/fdecomp.pro)
NAME FORPRINT PURPOSE Print a set of vectors by looping over each index value. If W and F are equal length vectors, then the statement IDL> forprint, w, f is equivalent to IDL> for i = 0, N_elements(w)-1 do print,w(i),f(i) CALLING SEQUENCE: forprint, v1,[ v2, v3, v4,....v18, FORMAT = , TEXTOUT = ,STARTLINE = ] INPUTS: V1,V2,...V18 - Arbitary IDL vectors. If the vectors are not of equal length then the number of rows printed will be equal to the length of the smallest vector. Up to 18 vectors can be supplied. OPTIONAL KEYWORD INPUTS: TEXTOUT - Controls print output device, defaults to !TEXTOUT textout=1 TERMINAL using /more option textout=2 TERMINAL without /more option textout=3.prt textout=4 laser.tmp textout=5 user must open file textout = filename (default extension of .prt) FORMAT - Scalar format string as in the PRINT procedure. The use of outer parenthesis is optional. Ex. - format="(F10.3,I7)" This program will automatically remove a leading "$" from incoming format statments. Ex. - "$(I4)" would become "(I4)". STARTLINE - Integer scalar specifying the first line in the arrays to print. Default is STARTLINE = 1, i.e. start at the beginning of the arrays. OUTPUTS: None SYSTEM VARIABLES: If keyword TEXTOUT is not used, the default is !TEXTOUT. Set !TEXTOUT=3 to direct the FORPRINT output to a file FORPRINT.PRT If you want to use FORPRINT to write more than once to the same file, or use a different file name then set TEXTOUT=5, and open and close then file yourself (see TEXTOPEN). EXAMPLE: Suppose W,F, and E are the wavelength, flux, and epsilon vectors for an IUE spectrum. Print these values to a file 'output.dat' in a nice format. IDL> fmt = '(F10.3,1PE12.2,I7)' IDL> forprint, F = fmt, w, f, e, TEXT = 'output.dat' PROCEDURES CALLED: Function DATATYPE, procedures TEXTOPEN, TEXTCLOSE REVISION HISTORY: Written W. Landsman April, 1989 Keywords textout and format added, J. Isensee, July, 1990 Made use of parenthesis in FORMAT optional W. Landsman May 1992 Added STARTLINE keyword W. Landsman November 1992 Set up so can handle 18 input vectors. J. Isensee, HSTX Corp. July 1993 Handle string value of TEXTOUT W. Landsman, HSTX September 1993
(See /usr/local/idl/lib/zastron/misc/forprint.pro)
NAME: F_FORMAT PURPOSE: Choose a nice F format for displaying an array of REAL data. Called by TVLIST, IMLIST. CALLING SEQUENCE: fmt = F_FORMAT( minval, maxval, factor, [ length ] ) INPUTS: MINVAL - REAL scalar giving the minimum value of an array of numbers for which one desires a nice format. MAXVAL - REAL scalar giving maximum value in array of numbers OPTIONAL INPUT: LENGTH - length of the output F format (default = 5) must be an integer scalar > 2 OUTPUT: FMT - an F or I format string, e.g. 'F5.1' FACTOR - factor of 10 by which to multiply array of numbers to achieve a pretty display using format FMT. EXAMPLE: Find a nice format to print an array of numbers with a minimum of 5.2e-3 and a maximum of 4.2e-2. IDL> fmt = F_FORMAT( 5.2e-3, 4.2e-2, factor ) yields fmt = '(F5.2)' and factor = .01, i.e. the array can be displayed with a F5.2 format after multiplication by 100. REVISION HISTORY: Written W. Landsman December 1988 Deal with factors < 1. August 1991 Deal with factors < 1. *and* a large range October 1992 Now returns In format rather than Fn.0 February, 1994
(See /usr/local/idl/lib/zastron/misc/f_format.pro)
NAME: GETFILE DESCRIPTION: This function helps the user retrieve a file in IDL. Better than FileView since you can have several disks in your user defined tree under FILETREE.DAT in your home (VMS: SYS$LOGIN) directory. See notes for a detailed description. Best when used with Xwindows (or other devices that support the MENU function,) but it is functional in text mode. CALLING SEQUENCE: file = GETFILE( SRCHPATH = , SRCHSPEC = , TREE = ) OPTIONAL KEYWORD INPUT: SRCHPATH An optional starting search path. Often handy to keep this around and pass it every time so the user always starts where he left off in a program. SRCHSPEC An optional search filter to find certain types of files (e.g. '*.*', '*.*;', '*.*;*', '*.hhh', '*.%%h', '*.pro', etc.) TREE - string array giving a list of directories to be used instead of a FILETREE.DAT file. Note: All of these keyword parameters may be passed without prior definition. They will be returned with the last directory and specification displayed. OUTPUT: FILE The name of the returned file. Set to '+CANCEL' if the user canceled the operation. NOTES: For maximum flexibility, create a file called FILETREE.DAT in your login directory. In it put a list of directories that you use frequently and/or your root directory on each disk. This allows trivial hopping between different disks (better than FileView.) You may also include the names of certain files which you will access a lot with this function. HISTORY: 14-AUG-90 Version 1 written by E. Deutsch 11-JAN-91 Changed parameters to keywords, added listing of truncated files, removed unnecessary options. K. Bhagat, STX 20-AUG-91 Replaced line which was mysteriously removed in 11-JAN-91 modification caused GETFILE not to work with FILETREE.DAT. E.Deutsch 27-Aug-91 Use GETENV("HOME") instead of SYS$LOGIN W. Landsman
(See /usr/local/idl/lib/zastron/misc/getfile.pro)
NAME: GETFILES PURPOSE: This procedure will prompt the user to interactively specify a list of files by specifying a single file per line or a range of files separated by a dash or comma. Used, for example, by FITSRD to return a list of file numbers on tape to read CALLING SEQUENCE: getfiles, list OUTPUT: LIST - integer array containing file numbers SIDE EFFFECTS: User will be prompted to enter a list of file numbers REVISION HISTORY Written D. Lindler November, 1985 Converted to Version 2 IDL, August 1990
(See /usr/local/idl/lib/zastron/misc/getfiles.pro)
NAME: GETLOG PURPOSE: Returns the correct logical directory for the given operating system. E.G. dat: for vms, $DAT/ for unix. CALLING SEQUENCE: GETLOG,lname INPUTS: lname - the base name of the logical (without special characters). OUTPUTS: Returns appropriate string. RESTRICTIONS: Assumes that the created directory logical will have meaning to the host operating system. PROCEDURE: The operating system in !version.os is checked. If it equals: 'vms' then a ':' is appended. else unix os is assumed and the input string is uppercased, a '$' is prepended and a '/' is appended. MODIFICATION HISTORY: Written, JDNeill, May, 1990. Modified, JDNeill,Sep, 1990 -- for unix return full path instead of just environment variable name. Modified, I. Freedman, HSTX April 1994 -- for MacOS return full path Bug in CASE statement fixed. JDO, HSTX, May 2 1994.
(See /usr/local/idl/lib/zastron/misc/getlog.pro)
NAME: GETOPT PURPOSE: Function to convert a string supplied by the user into a valid scalar or vector. Distinct elements in the string may be separated by either a comma or a space. The output scalar or vector can be specified to be either integer or floating point. A null string is converted to a zero. !ERR is set to the number of elements supplied. CALLING SEQUENCE: option = GETOPT( input, [ type, numopt ]) INPUTS: input - string that was input by user in response to a prompt Arithmetic operations can be included in the string (see examples) OPTIONAL INPUTS: type - Either an "I" (integer) or an "F" (floating point) specifying the datatype of the output vector. Default is floating point numopt - number of values expected by calling procedure If less than NUMOPT values are supplied the output vector will be padded with zeros. OUTPUTS: option - scalar or vector containing the numeric conversion of the fields in the string INPUT. If NUMOPT is not supplied, the number of elements in OPTION will equal the number of distinct fields in INPUT. NOTES: (1) If an input is invalid, !ERR is set to -1 and the result is set to 999. (2) GETOPT uses the execute function to interpret the user string. Therefore GETOPT itself cannot be called with the EXECUTE function. (3) GETOPT has a hard limit of 10 tokens in the input string. EXAMPLES: (1) a = getopt( '3.4,5*4 ', 'I' ) yields a = [ 3, 20] (2) a = getopt( '5/2.', 'F', 5) yields a = [2.5,0.,0.,0.,0.] (3) a = getopt( '2*3,5,6') yields a = [6.,5.,6.] REVISON HISTORY: written by B. Pfarr, STX, 5/6/87 change value of !ERR W. Landsman STX, 6/30/88
(See /usr/local/idl/lib/zastron/misc/getopt.pro)
NAME: GETPRO PURPOSE: Extract a procedure from an IDL Library or directory given in the !PATH system variable and place it in the current default directory (presumably to be edited by the user). GETPRO can also be used to obtain a copy of the default startup file. CALLING SEQUENCE: GETPRO, [ proc_name ] ;Find PROC_NAME in !PATH and copy OPTIONAL INPUT: proc_name - Character string giving the name of the IDL procedure or function. Do not give an extension. If omitted, the program will prompt for PROC_NAME. Set PROC_NAME = 'STARTUP' to obtain the default startup file. OUTPUTS: None. SIDE EFFECTS: A file with the extension .PRO and a name given by PROC_NAME will be created on the user's directory. PROCEDURE: The system variable !PATH is parsed into individual libraries or directories. Each library or directory is then searched for the procedure name. When found, a SPAWN is used to extract or copy the procedure into the user's directory. If not found in !PATH, then the ROUTINES.HELP file is checked to see if it is an intrinsic IDL procedure. This procedure is not used with the Macintosh. EXAMPLE: Put a copy of the USER library procedure CURVEFIT on the current directory IDL> getpro, 'CURVEFIT' RESTRICTIONS: User will be unable to obain source code for a native IDL function or procedure, or for a FORTRAN or C routine added with CALL_EXTERNAL. User must have write privilege to the current directory REVISION HISTORY: Written W. Landsman, STX Corp. June 1990 Converted to SUN IDL. M. Greason, STX, August 1990. Revised to work on both UNIX and VMS, N. Collins,STX,Nov.1990 Display the directory where the procedure was found W. Landsman Dec 1990 Modified for MacOS I. Freedman April 1994
(See /usr/local/idl/lib/zastron/misc/getpro.pro)
NAME: GETTOK PURPOSE: Function to retrieve the first part of the string until the character char is encountered. CALLING SEQUENCE: token = gettok( st, char ) INPUT: char - character separating tokens, scalar string INPUT-OUTPUT: st - (scalar) string to get token from (on output token is removed) OUTPUT: token - scalar string value is returned EXAMPLE: If ST is 'abc=999' then gettok(ST,'=') would return 'abc' and ST would be left as '999' HISTORY version 1 by D. Lindler APR,86 Remove leading blanks W. Landsman (from JKF) Aug. 1991
(See /usr/local/idl/lib/zastron/misc/gettok.pro)
NAME: HOST_TO_IEEE PURPOSE: To translate an IDL variable from IEEE-754 representation (as used, for example, in FITS data ), into the host machine architecture. CALLING SEQUENCE: HOST_TO_IEEE, data, [ IDLTYPE = , ] INPUT-OUTPUT PARAMETERS: data - any IDL variable, scalar or vector. It will be modified by HOST_TO_IEEE to convert from host to IEEE representation. Byte and string variables are returned by HOST_TO_IEEE unchanged OPTIONAL KEYWORD INPUTS: IDLTYPE - scalar integer (1-7) specifying the IDL datatype according to the code given by the SIZE function. This keyword will usually be used when suppying a byte array that needs to be interpreted as another data type (e.g. FLOAT). EXAMPLE: Suppose FITARR is a 2880 element byte array to be converted to a FITS record and interpreted a FLOAT data. IDL> host_to_ieee, FITARR, IDLTYPE = 4 METHOD: The BYTEORDER procedure is called with the appropiate keywords RESTRICTION: Will run *much* faster for floating or double precision if the IDL version is since 2.2.2 when the /FTOXDR keyword became available to BYTEORDER. However, HOST_TO_IEEE should still work in earlier versions of IDL Note that in V3.0.0 there is a bug in the /DTOXDR keyword for BYTEORDER on DecStations so HOST_TO_IEEE has a workaround. MODIFICATION HISTORY: Adapted from CONV_UNIX_VAX, W. Landsman Hughes/STX January, 1992 Fixed Case statement for Float and Double September, 1992 Workaround for /DTOXDR on DecStations January, 1993
(See /usr/local/idl/lib/zastron/misc/host_to_ieee.pro)
NAME HPRINT PURPOSE: Print a FITS header (or any other string array) at the the terminal by printing 1 line at a time. Needed because IDL will add an extra space to the 80 character FITS lines, causing a space to appear betweeen lines. CALLING SEQUENCE: HPRINT, h, [ firstline ] INPUTS: H - FITS header (or any other string array). OPTIONAL INPUT: FIRSTLINE - scalar integer specifying the first line to begin displaying. The default is FIRSTLINE = 1, i.e. display all the lines. If Firstline is negative, then the first line to be printed is counted backward from the last line. NOTES: HPRINT has the following differences from the intrinsic PRINT procedure (1) Arrays are printed one line at a time to avoid a space between 80 character lines (2) Lines are trimmed with STRTRIM before being printed to speed up display (3) The /more option is used for output. EXAMPLE: Read the header from a FITS file named 'test.fits' and display it at the terminal beginning with line 50 IDL> h = headfits( 'test.fits') ;Read FITS header IDL> hprint, h, 50 ;Display starting at line 50 To print the last 25 lines of the header IDL> hprint, h, -25 REVISION HISTORY: Written W. Landsman July, 1990 Added test for user quit July, 1991 Added optional FIRSTLINE arguement November, 1992 Modifed for Mac IDL, I Freedman HSTX April 1994
(See /usr/local/idl/lib/zastron/misc/hprint.pro)
NAME: IEEE_TO_HOST PURPOSE: To translate an IDL variable in IEEE-754 representation (as used, for example, in FITS data ), into the host machine architecture. CALLING SEQUENCE: IEEE_TO_HOST, data, [ IDLTYPE = , ] INPUT-OUTPUT PARAMETERS: data - any IDL variable, scalar or vector. It will be modified by IEEE_TO_HOST to convert from IEEE to host representation. Byte and string variables are returned by IEEE_TO_HOST unchanged OPTIONAL KEYWORD INPUTS: IDLTYPE - scalar integer (1-7) specifying the IDL datatype according to the code given by the SIZE function. This keyword is usually when DATA is a byte array to be interpreted as another datatype (e.g. FLOAT). EXAMPLE: A 2880 byte array (named FITARR) from a FITS record is to be interpreted as floating and converted to the host representaton: IDL> IEEE_TO_HOST, bytarr, IDLTYPE = 4 METHOD: The BYTEORDER procedure is called with the appropiate keyword RESTRICTION: Will run *much* faster for floating or double precision if the IDL version is since 2.2.2 when the /XDRTOF keyword became available to BYTEORDER. However, IEEE_TO_HOST should still work in earlier versions of IDL. Note that V3.0.0 has a bug in the /XDRTOD keyword on DecStations so IEEE_TO_HOST has a workaround. MODIFICATION HISTORY: Written, W. Landsman Hughes/STX May, 1992 Fixed error Case statement for float and double September 1992 Workaround to /XDRTOD problem on DecStations January 1993
(See /usr/local/idl/lib/zastron/misc/ieee_to_host.pro)
NAME: MAKE_2D PURPOSE: Convert an N element X vector, and an M element Y vector, into N x M arrays giving all possible combination of X and Y pairs. Useful for obtaining the X and Y positions of each element of a regular grid. CALLING SEQUENCE: MAKE_2D, X, Y, [ XX, YY ] INPUTS: X - N element vector (usually REAL*4) of X positions Y - M element vector of Y positions OUTPUTS: XX - N x M element array giving the X position at each pixel YY - N x M element array giving the Y position of each pixel If only 2 parameters are supplied then X and Y will be updated to contain the output arrays EXAMPLE: To obtain the X and Y position of each element of a 30 x 15 array IDL> x = indgen(30) & y = indgen(15) IDL> make_2d, x, y REVISION HISTORY: Written, Wayne Landsman ST Systems Co. May, 1988 Added /NOZERO keyword W. Landsman Mar, 1991
(See /usr/local/idl/lib/zastron/misc/make_2d.pro)
NAME: MATCH PURPOSE: Routine to match values in two vectors. CALLING SEQUENCE: match, a, b, suba, subb INPUTS: a,b - two vectors to match elements OUTPUTS: suba - subscripts of elements in vector a with a match in vector b subb - subscripts of the positions of the elements in vector b with matchs in vector a. suba and subb are ordered such that a(suba) equals b(subb) OPTIONAL KEYWORD OUTPUT: COUNT - set to the number of matches, integer scalar SIDE EFFECTS: !ERR is set to the number of matches, can be used instead of COUNT RESTRICTIONS: a and b should not have duplicate values within them. You can use rem_dup function to remove duplicate values in a vector EXAMPLE: If a = [3,5,7,9,11] & b = [5,6,7,8,9,10] then IDL> match, a, b, suba, subb, COUNT = count will give suba = [1,2,3], subb = [0,2,4], COUNT = 3 and suba(a) = subb(b) = [5,7,9] HISTORY: D. Lindler Mar. 1986. Fixed "indgen" call for very large arrays W. Landsman Sep 1991 Added COUNT keyword W. Landsman Sep. 1992
(See /usr/local/idl/lib/zastron/misc/match.pro)
NAME: MINMAX PURPOSE: Return a 2 element array giving the minimum and maximum of a vector or array. This is faster than doing a separate MAX and MIN. CALLING SEQUENCE: value = minmax( array ) INPUTS: array - an IDL numeric scalar, vector or array. OUTPUTS: value = a two element vector, value(0) = minimum value of array value(1) = maximum value of array EXAMPLE: Print the minimum and maximum of an image array, im IDL> print, minmax( im ) PROCEDURE: The MIN function is used with the MAX keyword REVISION HISTORY: Written W. Landsman January, 1990
(See /usr/local/idl/lib/zastron/misc/minmax.pro)
NAME: NINT PURPOSE: Nearest integer function. Similar to the intrinsic ROUND function introduced in IDL V3.1, but the default type returned by NINT is INTEGER rather than LONG CALLING SEQUENCE: result = nint( x, [ /LONG] ) INPUT: X - An IDL variable, scalar or vector, usually floating or double Unless the LONG keyword is set, X must be between -32767.5 and 32767.5 to avoid integer overflow OUTPUT RESULT - Nearest integer to X OPTIONAL KEYWORD INPUT: LONG - If this keyword is set and non-zero, then the result of NINT is of type LONG. Otherwise, the result is of type INTEGER If the /LONG keyword is set, then NINT is identical to the intrinsic ROUND function introduced in IDL V3.1 EXAMPLE: If X = [-0.9,-0.1,0.1,0.9] then NINT(X) = [-1,0,0,1] REVISION HISTORY: Written W. Landsman January 1989 Added LONG keyword November 1991 Use ROUND if since V3.1.0 June 1993
(See /usr/local/idl/lib/zastron/misc/nint.pro)
NAME: NULLTRIM PURPOSE: Function to trim a string of all characters after and including the first null character (ascii 0) CALLING SEQUENCE: result = nulltrim( st ) INPUTS: st = input string OUTPUTS: trimmed string returned as the function value. HISTORY: D. Lindler July, 1987
(See /usr/local/idl/lib/zastron/misc/nulltrim.pro)
NAME: ONE_ARROW PURPOSE: Draws an arrow labeled with a single character on the current graphics device. Called, for example, by ARROWS to create a "weathervane" showing the N-E orientation of an image. CALLING SEQUENCE: one_arrow, xcen, ycen, angle, label, CHARSIZE = , THICK = , COLOR = ARROWSIZE= ] INPUT PARAMETERS: xcen, ycen = starting point of arrow in device coordinates, floating point scalars, angle = angle of arrow in degrees counterclockwise from +X direction label = single-character label (may be blank) OUTPUT PARAMETERS: none OPTIONAL INPUT PARAMETERS: CHARSIZE = usual IDL meaning, default = 2.0 THICK = usual IDL meaning, default = 2.0 COLOR = usual IDL meaning, default = 255 ARROWSIZE = 3-element vector defining appearance of arrow. Default = [30.0, 9.0, 35.0], meaning arrow is 30 pixels long; arrowhead lines 9 pixels long and inclined 35 degrees from arrow shaft. If you try to use a non-TV device, you will probably want to change this. EXAMPLE: Draw an triple size arrow emanating from the point (212,224) and labeled with the character 'S' IDL> one_arrow,212,224,270,'S',charsize=3 PROCEDURE: Calls one_ray to vector-draw arrow. MODIFICATION HISTORY: Written by R. S. Hill, Hughes STX Corp., 20-May-1992.
(See /usr/local/idl/lib/zastron/misc/one_arrow.pro)
NAME: ONE_RAY PURPOSE: Draws a ray from a given starting point for a given length at a given angle. CALLING SEQUENCE: one_ray, xcen, ycen, len, angle, terminus, [ THICK=, COLOR =, /NODRAW ] INPUT PARAMETERS: xcen, ycen = starting point in device coordinates, floating point scalars len = length in pixels, device coordinates angle = angle in degrees counterclockwise from +X direction OUTPUT PARAMETERS: terminus = two-element vector giving ending point of ray in device coordinates OPTIONAL KEYWORD INPUT PARAMETERS: thick usual IDL meaning, default = 1.0 color usual IDL meaning, default = 255 nodraw if non-zero, the ray is not actually drawn, but the terminus is still calculated EXAMPLE: Draw a double thickness line of length 32 pixels from (256,256) 45 degrees counterclockwise from the X axis IDL> one_ray, 256, 256, 32, 45 ,term, THICK = 2 PROCEDURE: straightforward matrix arithmetic MODIFICATION HISTORY: Written by R. S. Hill, Hughes STX Corp., 20-May-1992.
(See /usr/local/idl/lib/zastron/misc/one_ray.pro)
NAME: ORDINAL PURPOSE: Convert an integer to a correct English ordinal string: i.e., 1st, 2nd, 3rd, 4th .... CALLING SEQUENCE: result = ordinal( num ) INPUT PARAMETERS: num = number to be made an ordinal. If float, will be FIXed. OUTPUT PARAMETERS: result = string such as '1st' '3rd' '164th' '87th', etc. MODIFICATION HISTORY: Written by R. S. Hill, STX, 8 Aug. 1991
(See /usr/local/idl/lib/zastron/misc/ordinal.pro)
NAME: OSFCNVRT PURPOSE: Returns the correctly formatted logical directory syntax for the host operating system. CALLING SEQUENCE: OSFCNVRT,lname INPUTS: lname - the file specification as a logical name + file name string OUTPUTS: Returns appropriate string. SIDE EFFECTS: None. RESTRICTIONS: Assumes that the input is composed of only a logical and a filename combination without lower directory garbage. PROCEDURE: The operating system in !version.os is checked. If it equals: 'vms' then a ':' is appended. else unix os is assumed and the logical portion is uppercased, a '$' is prepended and a '/' is appended. MODIFICATION HISTORY: Written, JDNeill, May, 1990.
(See /usr/local/idl/lib/zastron/misc/osfcnvrt.pro)
NAME: PRODUCT PURPOSE: Calculates the product of all the elements of an array--the multiplicative equivalent of total. CALLING SEQUENCE: Result = PRODUCT(ARRAY) INPUT PARAMETERS: ARRAY = Array of elements to multiply together. For instance, ARRAY could contain the dimensions of another array--then PRODUCT(ARRAY) would be the total number of elements of that other array. OUTPUT: The result of the function is the total product of all the elements of ARRAY. OPTIONAL KEYWORD PARAMETERS: None. COMMON BLOCKS: None. SIDE EFFECTS: The result will always be of at least floating point type. RESTRICTIONS: ARRAY must be a numerical type. PROCEDURE: Straightforward. MODIFICATION HISTORY: William Thompson, Feb. 1992.
(See /usr/local/idl/lib/zastron/misc/product.pro)
NAME: QGET_STRING PURPOSE: To get a string from the keyboard without echoing it to the screen. CALLING SEQUENCE: string = qget_string(0) INPUTS: None. OUTPUTS: string The string read from the keyboard. SIDE EFFECTS: A string variable is created and filled. PROCEDURE: The IDL GET_KBRD functions is used to get each character in the string. Each character is added to the string until a carriage return is struck. The carriage return is not appended to the string. Striking the delete key or the backspace key removes the previous character from the string (only the backspace key will work in VAX IDL). This procedure may be used with either the VMS or UNIX versions of IDL. MODIFICATION HISTORY: Written by Michael R. Greason, STX, 8 January 1991.
(See /usr/local/idl/lib/zastron/misc/qget_string.pro)
NAME: READCOL PURPOSE: Read a free-format ASCII data file with columns of data into IDL variables. Lines of data not meeting the specified format (e.g. comments) are ignored. Columns may be separated by commas or spaces. Use READFMT to read a fixed-format ASCII file. CALLING SEQUENCE: readcol, name, v1, [ v2, v3, v4, v5, ... v25 , FORMAT = , /DEBUG, /SILENT, SKIPLINE = , NUMLINE = ] INPUTS: NAME - Name of ASCII data file, scalar string. In VMS, an extension of .DAT is assumed, if not supplied. OPTIONAL INPUT KEYWORDS: FORMAT - scalar string containing a letter specifying an IDL type for each column of data to be read. Allowed letters are A - string data, B - byte, D - double precision, F- floating point, I - integer, L - longword, and X - skip a column. Columns without a specified format are assumed to be floating point. Examples of valid values of FMT are 'A,B,I' ;First column to read as 6 character string, then 1 column of byte data, 1 column integer data 'L,L,L,L' ;Four columns will be read as longword arrays. ' ' ;All columns are floating point If a FORMAT keyword string is not supplied, then all columns are assumed to be floating point. SILENT - Normally, READCOL will display each line that it skips over. If SILENT is set and non-zero then these messages will be suppressed. DEBUG - If this keyword is non-zero, then additional information is printed as READCOL attempts to read and interpret the file. SKIPLINE - Scalar specifying number of lines to skip at the top of file before reading. Default is to start at the first line. NUMLINE - Scalar specifying number of lines in the file to read. Default is to read the entire file OUTPUTS: V1,V2,V3,...V15 - IDL vectors to contain columns of data. Up to 25 columns may be read. The type of the output vectors are as specified by FORMAT. EXAMPLES: Each row in a file POSITION.DAT contains a star name and 6 columns of data giving an RA and Dec in sexigesimal format. Read into IDL variables. (NOTE: The star names must not contain internal spaces.) IDL> FMT = 'A,I,I,F,I,I,F' IDL> READCOL,'POSITION',F=FMT,name,hr,min,sec,deg,dmin,dsec The HR,MIN,DEG, and DMIN variables will be integer vectors. Alternatively, all except the first column could be specified as floating point. IDL> READCOL,'POSITION',F='A',name,hr,min,sec,deg,dmin,dsec To read just the variables HR,MIN,SEC IDL> READCOL,'POSITION',F='X,I,I,F',HR,MIN,SEC RESTRICTIONS: This procedure is designed for generality and not for speed. If a large ASCII file is to be read repeatedly, it may be worth writing a specialized reader. Columns to be read as strings must not contain spaces or commas, since these are interpreted as column delimiters. Use READFMT to read such files. Numeric values are converted to specified format. For example, the value 0.13 read with an 'I' format will be converted to 0. PROCEDURES CALLED GETTOK, SPEC_DIR, REPCHR, STRNUMBER REVISION HISTORY: Written W. Landsman November, 1988 Modified J. Bloch June, 1991 (Fixed problem with over allocation of logical units.) Added SKIPLINE and NUMLINE keywords W. Landsman March 92 Read a maximum of 25 cols. Joan Isensee, Hughes STX Corp., 15-SEP-93.
(See /usr/local/idl/lib/zastron/misc/readcol.pro)
NAME: READFMT PURPOSE: Quickly read a fixed format ASCII data file into IDL variables. Lines of data not meeting the specified format (e.g. comments) are ignored. To read a free format ASCII data file use the procedure READCOL CALLING SEQUENCE: READFMT, name, fmt, v1,[ v2, v3, v4, ..., v25 , /SILENT, /DEBUG, SKIPLINE= , NUMLINE =] INPUTS: NAME - Name of ASCII data file. An extension of .DAT is assumed, if not supplied. FMT - scalar string containing a valid FORTRAN read format. Must include a field length specification. Cannot include internal parenthesis. A format field must be included for each output vector. Multiple format fields are allowed, but the repetition factor must be less than 100, (.i.e. 19X is allowed but 117X is illegal) Examples of valid FMT values are FMT = 'A7,3X,2I4' or FMT = '1H ,5I7,2A7' Examples of INVALID FMT values are FMT = 'A7,B3' ;'B' is not a valid FORTRAN format FMT = 'A7,2(I3,F5.1)' ;Internal parenthesis not allowed FMT = 'A7,F,I' ;Field length not included OUTPUTS: V1,V2,V3,V4... - IDL vectors to contain columns of data. Up to 25 output vectors may be read. The type of the output vectors are specified by FMT. OPTIONAL KEYWORD INPUTS: SILENT - If this keyword is set and non-zero, then certain terminal output is suppressed while reading the file DEBUG - Set this keyword to display additional information while reading the file. SKIPLINE - Scalar specifying number of lines to skip at the top of file before reading. Default is to start at first line NUMLINE - Scalar specifying number of lines in the file to read. Default is to read the entire file EXAMPLES: Each row in a fixed-formated file POSITION.DAT contains a 5 character star name and 6 columns of data giving an RA and Dec in sexigesimal format. A possible format for such data might be IDL> FMT = 'A5,2I3,F5.1,2x,3I3' and the file could be quickly read with IDL> READFMT,'POSITION', fmt, name, hr, min, sec, deg, dmin, dsec NAME will be a string vector,SEC will be a floating point vector, and the other vectors will be of integer type. RESTRICTIONS: This procedure is designed for generality and not for speed. If a large ASCII file is to be read repeatedly, it may be worth writing a specialized reader. NOTES: When reading a field with an integer format I, the output vector is byte - if n = 1 integer*2 - if 1 < n < 5 integer*4 - in all other cases PROCEDURE CALLS: ZPARCHECK, SPEC_DIR, REMCHAR REVISION HISTORY: Written W. Landsman November, 1988 Added SKIPLINE and NUMLINE keywords March 92 Allow up to 25 columns to be read June 92
(See /usr/local/idl/lib/zastron/misc/readfmt.pro)
NAME: READ_KEY PURPOSE: To read a keystroke and return its ASCII equivalent, unless an ESCAPE sequence was produced. In that case, if the sequence is recognized, a code is returned. CALLING SEQUENCE: key = READ_KEY(Wait) INPUTS: Wait - The wait flag. If non-zero, execution is halted until a key is struck. If zero, execution returns immediately and a zero is returned if there was no keystroke waiting in the keyboard buffer. If not specified, zero is assumed. OUTPUT: Returned - The key struck. The ASCII code for non-escape sequences. Escape sequence equivalents: Up Arrow -- 128 Down Arrow -- 130 Left Arrow -- 129 Right Arrow -- 131 Else -- 0 The return value is a byte value. MODIFICATION HISTORY: Written by Michael R. Greason, STX, 22 June 1990. Rewritten for a SUN workstation. MRG, STX, 23 August 1990.
(See /usr/local/idl/lib/zastron/misc/read_key.pro)
NAME: READ_VAX_BLOCK PURPOSE: Reads one block from a VAX Fortran unformatted file. CALLING SEQUENCE: READ_VAX_BLOCK, UNIT, BYTE_ARRAY, END_OF_FILE [, ERROR_FLAG ] INPUTS: UNIT = Logical unit number of VAX Fortran unformated file. OUTPUTS: BYTE_ARRAY = Data in block returned as byte array. END_OF_FILE = Switch containing whether end-of-file was reached before data could be read. OPTIONAL OUTPUT PARAMETER: ERROR_FLAG = Switch containing whether or not an error occurred during processing. OPTIONAL KEYWORD PARAMETER: EXTEND = If passed, then block length checking is disabled. Allows blocks larger than 2048 bytes to be read in. TARGET_ARCH = Name (string) of desired target architecture if using this function on a VAX. Otherwise !VERSION.ARCH is used to determine the conversion. SUBROUTINES CALLED: CONV_VAX_UNIX RESTRICTIONS: The VAX file must be copied over as binary. The file must be opened *WITHOUT* the /F77_UNFORMATTED switch. PROCEDURE: The block header is read, and the number of bytes, and a code word, are read in and checked. The data is then read in as a byte array. If necessary, an extra byte is read in to word align. MODIFICATION HISTORY: William Thompson, January, 1990. December, 1990, added TARGET_ARCH keyword.
(See /usr/local/idl/lib/zastron/misc/read_vax_block.pro)
NAME: REMCHAR PURPOSE: Remove all appearances of character (char) from string (st) CALLING SEQUENCE: REMCHAR, ST, CHAR INPUTS: ST - String from which character will be removed. CHAR- Character to be removed from string. EXAMPLE: If a = 'a,b,c,d,e,f,g' then IDL> remchar,a, ',' will give a = 'abcdefg' REVISIONS HISTORY Written D. Lindler October 1986 Test if empty string needs to be returned W. Landsman Feb 1991
(See /usr/local/idl/lib/zastron/misc/remchar.pro)
NAME: REMOVE PURPOSE: Contract a vector or up to 7 vectors by removing specified elements. CALLING SEQUENCE: REMOVE, index, vector1,[ vector2, vector3, vector4, vector5,vector6, vector7] INPUTS: INDEX - scalar or vector giving the index number of elements to be removed from vectors. Duplicate entries in index are ignored. An error will occur if one attempts to remove all the elements of a vector. INPUT-OUTPUT: VECTOR1 - Vector or array. Elements specifed by INDEX will be removed from VECTOR1. Upon return VECTOR1 will contain N fewer elements, where N is the number of values in INDEX. OPTIONAL INPUT-OUTPUTS: VECTOR2,VECTOR3,...VECTOR7 - additional vectors containing the same number of elements as VECTOR1. These will be contracted in the same manner as VECTOR1. EXAMPLES: (1) If INDEX = [2,4,6,4] and V = [1,3,4,3,2,5,7,3] then after the call IDL> remove,index,v V will contain the values [1,3,3,5,3] (2) Suppose one has a wavelength vector W, and three associated flux vectors F1, F2, and F3. Remove all points where a quality vector, EPS is negative IDL> bad = where( EPS LT 0, Nbad) IDL> if Nbad GT 0 then remove, bad, w, f1, f2, f3 METHOD: If only 1 element is to be removed, then the vectors are shortend by simple subscripting. If more than 1 elements is to be removed, then a "keep" vector of indicies to save is formed, and applied to the input vectors REVISION HISTORY: Written W. Landsman ST Systems Co. April 28, 1988 Cleaned up code W. Landsman September, 1992
(See /usr/local/idl/lib/zastron/misc/remove.pro)
NAME: REM_DUP PURPOSE: Function to remove duplicate values from a vector. CALLING SEQUENCE: result = rem_dup( a, [ flag ] ) INPUTS: a - vector of values from which duplicates are to be found flag - (optional) if supplied then when duplicates occur, the one with the largest value of flag is selected. If not supplied the the first occurence of the value in a is selected. Should be a vector with the same number of elements as a. OUTPUT: A vector of subscripts in a is returned. Each subscript points to a selected value such that a(rem_dup(a,flag)) has no duplicates. SIDE EFFECTS: The returned subscripts will sort the values in a in ascending order with duplicates removed. EXAMPLES: Remove duplicate values in vector a. a = a( rem_dup(a) ) Remove duplicates in vector WAVE. When duplicate values are found, select the one with the largest intensity, INTE. sub = rem_dup( wave, inte) wave = wave( sub ) inte = inte( sub ) NOTES: The UNIQ function in the User's Library uses a faster algorithm, but has no equivalent of the "flag" parameter MODIFICATION HISTORY: D. Lindler Mar. 87 11/16/90 JKF ACC - converted to IDL Version 2.
(See /usr/local/idl/lib/zastron/misc/rem_dup.pro)
NAME: REPSTR PURPOSE: String substitution as in many text editors. Replace all occurences of one substring by another. CALLING SEQUENCE: result = repstr( obj, in, out ) INPUT PARAMETERS: obj = object string for editing in = substring of 'obj' to be replaced out = what 'in' is replaced with OUTPUT PARAMETERS: Result returned as function value. Input object string not changed unless assignment done in calling program. PROCEDURE: Searches for 'in', splits 'obj' into 3 pieces, reassembles with 'out' in place of 'in'. Repeats until all cases done. EXAMPLE: If a = 'I am what I am' then print,repstr(a,'am','was') will give 'I was what I was'. MODIFICATION HISTORY: Written by Robert S. Hill, ST Systems Corp., 12 April 1989.
(See /usr/local/idl/lib/zastron/misc/repstr.pro)
NAME: SCREEN_SELECT PURPOSE: Routine to allow a user to make an interactive screen selection from a list (array) of strings. This procedure determines whether to use dumb terminal version, the non- widget x-windows version or the widget version by examining the !D.NAME system variable. CALLING SEQUENCE: screen_select, selections, iselected, comments, command_line, only_one INPUTS: selections - string array giving list of items that can be selected. OPTIONAL INPUTS: comments - comments which can be requested for each item in array selections. It can be: string array - same length as array selections. null string - no comments available scalar string - name of a procedure which will return comments. It will take selections as its first argument and return comments as its second argument. command_line - optional command line to be placed at the bottom of the screen. It is usually used to specify what the user is selecting. only_one - integer flag. If set to 1 then the user can only select one item. The routine returns immediately after the first selection is made. OUTPUTS: iselected - list of indices in selections giving the selected items. SIDE EFFECTS: !err is set to the number of selections made PROCEDURE: The actual processing is farmed out to different procedures depending on the terminal type. Widget Terminal ==> SELECT_W.PRO Vanilla X windows ==> SELECT_X.PRO VT100 Terminal ==> SELECT_O.PRO HISTORY: Written by M. Greason, STX, May 1990. Added widget support W. Landsman January, 1992
(See /usr/local/idl/lib/zastron/misc/screen_select.pro)
NAME: SCR_ATTRIB PURPOSE: To set the screen attribute to those given, in the given order. CALLING SEQUENCE: scr_attrib [, a1, a2, a3, a4, a5] INPUTS: a1 - a5 -- The attribute codes. The attributes are set in the command string in the given order. Thus, if a1 turns the attributes off and a2 sets reverse video, the final attribute will reset and then set to reverse video. If the order were reversed, then the current attribute would have reverse video added to it, and then would be reset, leaving the terminal with all attributes off. Up to five attribute codes may be specified. The codes are: 0 : all attributes off (default) 1 : bold on 2 : underscore on 3 : blink on 4 : reverse video on OUTPUTS: None. SIDE EFFECTS: None. RESTRICTIONS: This procedure will only work with DEC compatible equipment (or terminal emulators). PROCEDURE: A string containing the appropriate DEC terminal command is put together and printed. NOTE: In general, the DEC commands correspond to the ANSI escape sequences. MODIFICATION HISTORY: Written by Michael R. Greason, STX, May 1990.
(See /usr/local/idl/lib/zastron/misc/scr_attrib.pro)
NAME: SCR_CHARSET PURPOSE: To change the character sets. CALLING SEQUENCE: scr_charset [, g, cset] INPUTS: g -- The terminal character set to change (either 0, for the G0 designator, or 1, for the G1 designator). 0 = default. cset -- The character set to use: 0 : United Kingdom. 1 : United States (USASCII) -- default. 2 : Special graphics characters and line drawing set. 3 : Alternate character ROM. 4 : Alternate character ROM special graphics chars. OUTPUTS: None. SIDE EFFECTS: None. RESTRICTIONS: This procedure will only work with DEC compatible equipment (or terminal emulators). PROCEDURE: A string containing the appropriate DEC terminal command is put together and printed. NOTE: In general, the DEC commands correspond to the ANSI escape sequences. MODIFICATION HISTORY: Written by Michael R. Greason, STX, May 1990.
(See /usr/local/idl/lib/zastron/misc/scr_charset.pro)
NAME: SCR_CURMOV PURPOSE: To mov the cursor around the screen relative to its original position. CALLING SEQUENCE: scr_curmov [, cmd, n] INPUTS: cmd -- An integer indicating the direction in which to move the curs. 0 : Up 1 : Down (Default) 2 : Left 3 : Right n -- The number of spaces to move the cursor. If not specified (or if less than or equal to zero), this is set to one. OUTPUTS: None. SIDE EFFECTS: None. RESTRICTIONS: This procedure will only work with DEC compatible equipment (or terminal emulators). PROCEDURE: A string containing the appropriate DEC terminal command is put together and printed. NOTE: In general, the DEC commands correspond to the ANSI escape sequences. MODIFICATION HISTORY: Written by Michael R. Greason, STX, May 1990.
(See /usr/local/idl/lib/zastron/misc/scr_curmov.pro)
NAME: SCR_CURPOS PURPOSE: To position the cursor at the specified screen location. Unspecified coordinates are set to one. Please note that the ESCAPE sequence expects the coordinates to be counted from (1,1). CALLING SEQUENCE: scr_curpos [, lin, col] INPUTS: lin -- The screen line coordinate. col -- The screen column coordinate. OUTPUTS: None. SIDE EFFECTS: None. RESTRICTIONS: This procedure will only work with DEC compatible equipment (or terminal emulators). PROCEDURE: A string containing the appropriate DEC terminal command is put together and printed. NOTE: In general, the DEC commands correspond to the ANSI escape sequences. MODIFICATION HISTORY: Written by Michael R. Greason, STX, May 1990.
(See /usr/local/idl/lib/zastron/misc/scr_curpos.pro)
NAME: SCR_ERASE PURPOSE: To erase portions of the terminal screen. CALLING SEQUENCE: scr_erase [, cmd] INPUTS: cmd -- An integer telling the procedure what part of the screen to erase. If not specified, it is set to 5. Key: 0 : From cursor to end-of-line. 1 : From beginning-of-line to cursor. 2 : Entire line containing cursor. 3 : From cursor to end-of-screen. 4 : from beginning-of-screen to cursor. ELSE : Entire screen. OUTPUTS: None. SIDE EFFECTS: None. RESTRICTIONS: This procedure will only work with DEC compatible equipment (or terminal emulators). PROCEDURE: A string containing the appropriate DEC terminal command is put together and printed. NOTE: In general, the DEC commands correspond to the ANSI escape sequences. MODIFICATION HISTORY: Written by Michael R. Greason, STX, May 1990.
(See /usr/local/idl/lib/zastron/misc/scr_erase.pro)
NAME: SCR_OTHER PURPOSE: To allow the user to issue any ESCAPE sequence. CALLING SEQUENCE: scr_other, str INPUTS: str -- A string containing the escape sequence. The initial ESCAPE should not be included; this will be added by this procedure. This parameter is NOT optional; if not available, the procedure will return without doing anything. OUTPUTS: None. SIDE EFFECTS: None. RESTRICTIONS: This procedure will only work with DEC compatible equipment (or terminal emulators). PROCEDURE: A string containing the appropriate DEC terminal command is put together and printed. NOTE: In general, the DEC commands correspond to the ANSI escape sequences. MODIFICATION HISTORY: Written by Michael R. Greason, STX, May 1990.
(See /usr/local/idl/lib/zastron/misc/scr_other.pro)
NAME: SCR_RESET PURPOSE: To reset the terminal. CALLING SEQUENCE: scr_reset INPUTS: None. OUTPUTS: None. SIDE EFFECTS: None. RESTRICTIONS: This procedure will only work with DEC compatible equipment (or terminal emulators). PROCEDURE: A string containing the appropriate DEC terminal command is put together and printed. NOTE: In general, the DEC commands correspond to the ANSI escape sequences. MODIFICATION HISTORY: Written by Michael R. Greason, STX, May 1990.
(See /usr/local/idl/lib/zastron/misc/scr_reset.pro)
NAME: SCR_SCROLL PURPOSE: To define the scrolling area on the screen. Please note that the line coordinates should be counted from 1. CALLING SEQUENCE: scr_scroll [, top, bot] INPUTS: top -- The line to be the top of the scrolling area. The default value is 1 and the maximum value is 23. bot -- The line to be the bottom of the scrolling area. The default value is 24 and the minimum value is 2. OUTPUTS: None. SIDE EFFECTS: NOTE: The screen coordinate system is NOT effected. (1,1) is not the top of the scrolling area but the top of the screen. RESTRICTIONS: This procedure will only work with DEC compatible equipment (or terminal emulators). PROCEDURE: A string containing the appropriate DEC terminal command is put together and printed. NOTE: In general, the DEC commands correspond to the ANSI escape sequences. MODIFICATION HISTORY: Written by Michael R. Greason, STX, May 1990.
(See /usr/local/idl/lib/zastron/misc/scr_scroll.pro)
NAME: SELECT_O PURPOSE: Routine to allow a user to make an interactive screen selection from a list (array) of strings. This assumes a non-x-windows device. CALLING SEQUENCE: select_o, selections, iselected, comments, command_line, only_one INPUTS: selections - string array giving list of items that can be selected. OPTIONAL INPUTS: comments - comments which can be requested for each item in array selections. It can be: string array - same length as array selections. null string - no comments available scalar string - name of a procedure which will return comments. It will take selections as its first argument and return comments as its second argument. command_line - optional command line to be placed at the bottom of the screen. It is usually used to specify what the user is selecting. only_one - integer flag. If set to 1 then the user can only select one item. The routine returns immediately after the first selection is made. OUTPUTS: iselected - list of indices in selections giving the selected items. SIDE EFFECTS: !err is set to the number of selections made HISTORY: version 1, D. Lindler April 88. modified to IDL V2 (from screen_select). M. Greason, May 1990. changed name from screen_select_o W. Landsman January 1993
(See /usr/local/idl/lib/zastron/misc/select_o.pro)
NAME: SELECT_W PURPOSE: This procedure creates a non-exclusive menu of items in widget form. More than one item may be selected or 'de-selected'. Normally called by SCREEN_SELECT CALLING SEQUENCE: SELECT_W, items ,iselected, [ comments, command_line, only_one ] INPUTS: items - string array giving list of items that can be selected. OPTIONAL INPUTS: comments - comments which can be requested for each item in array selections. NOT YET IMPLEMENTED command_line - optional command line to be placed at the bottom of the screen. It is usually used to specify what the user is selecting. only_one - integer flag. If set to 1 then the user can only select one item. The routine returns immediately after the first selection is made. OUTPUT: iselected - list of indices in selections giving the selected items. COMMON BLOCKS: SELECT_W - Used to communicate with the SELECT_W_EVENT procedure MODIFICATION HISTORY: Written, K. Venkatakrishna & W. Landsman, Hughes/STX January, 1992 Widgets made MODAL. M. Greason, Hughes STX, 15 July 1992.
(See /usr/local/idl/lib/zastron/misc/select_w.pro)
NAME: SELECT_X PURPOSE: Routine to allow a user to make an interactive screen selection from a list (array) of strings. This assumes an x-windows device. CALLING SEQUENCE: select_x, selections, iselected, comments, command_line, only_one INPUTS: selections - string array giving list of items that can be selected. OPTIONAL INPUTS: comments - comments which can be requested for each item in array selections. It can be: string array - same length as array selections. null string - no comments available scalar string - name of a procedure which will return comments. It will take selections as its first argument and return comments as its second argument. command_line - optional command line to be placed at the bottom of the screen. It is usually used to specify what the user is selecting. only_one - integer flag. If set to 1 then the user can only select one item. The routine returns immediately after the first selection is made. OUTPUTS: iselected - list of indices in selections giving the selected items. SIDE EFFECTS: !err is set to the number of selections made A window is opened and closed. RESTRICTIONS: The screen must be X-windows compatible. As of Mar 91, the comments option does not appear to be working HISTORY: version 1, D. Lindler April 88. modified to IDL V2 (from screen_select). M. Greason, May 1990. Changed name from screen_select_x W. Landsman January 1993 Removed RETAIN = 2, not needed W. Landsman May 1993
(See /usr/local/idl/lib/zastron/misc/select_x.pro)
NAME: SINCE_VERSION PURPOSE: Determine if the current release of IDL (as given in the !VERSION.RELEASE system variable) comes after the user specified release. CALLING SEQUENCE: test = SINCE_VERSION( release ) INPUT: release - scalar string, must be formatted exactly like the !VERSION.RELEASE system variable (e.g. '3.0.0') OUTPUT: test - 1 if current release is identical or later than the specified 'release' else 0 EXAMPLE: Use the /FTOXDR keyword to the BYTEORDER procedure if the current release of IDL is 2.2.2 or later IDL> if since_version('2.2.2') then byteorder, a, /FTOXDR REVISION HISTORY: Written Wayne Landsman Hughes/STX January, 1992 Corrected algorithm W. Landsman April, 1992
(See /usr/local/idl/lib/zastron/misc/since_version.pro)
NAME: SPEC_DIR PURPOSE: Provide a complete file specification by appending a default disk or directory if necessary. CALLING SEQUENCE: File_spec = SPEC_DIR(filename,[extension]) INPUT: filename - character string giving partial specification of a file name. VMS examples include 'UIT$USER2:TEST.DAT', or '[.SUB]TEST'. Unix examples include '/home/idl/lib', or '$IDL_HOME/pro'. OPTIONAL INPUT: exten - string giving a default file name extension to be used if filename does not contain one. Do not include the period. OUTPUT: File_spec - Complete file specification using default disk or directory when necessary. If the default directory is UIT$USER1:[IDL] then, for the above VMS examples, the output would be 'UIT$USER2:[IDL]TEST.DAT' 'UIT$USER2:[IDL.SUB]TEST'. METHOD: For Unix, SPEC_DIR will simply append the default directory obtained from the CD command (if necessary). Under VMS one must also determine if the disk and/or directory is already specified. Under VMS, SPEC_DIR will also try to translate disk and directory logical names. REVISION HISTORY: Written W. Landsman STX July, 1987 Revised for use on VAXes and on SUNs, W. Landsman, STX August 1991
(See /usr/local/idl/lib/zastron/misc/spec_dir.pro)
NAME: STORE_ARRAY PURPOSE: Insert array INSERT into array DESTINATION, allowing the dimensions of DESTINATION to adjust to accomodate it. CATEGOBY: Utility CALLING SEQUENCE: STORE_ARRAY, DESTINATION, INSERT, INDEX INPUT: DESTINATION = Array to be expanded. INSERT = Array to insert into DESTINATION. INDEX = Index of the final dimension of DESTINATION to insert INSERT into. OUTPUTS: DESTINATION = Expanded output array. If both input arrays have the same number of dimensions, then the DESTINATION will be replaced with INSERT. RESTRICTIONS: DESTINATION and INSERT have to be either both of type string or both of numerical types. INSERT must not have more dimensions than DESTINATION. MODIFICATION HISTOBY: William Thompson, Feb. 1992, from BOOST_ARRAY by D. Zarro and P. Hick.
(See /usr/local/idl/lib/zastron/misc/store_array.pro)
NAME: STREBCASC PURPOSE: Function to converts an EBCDIC string scalar or array to its ASCII equivalent. Similar to the IDL Version 1 routine of the same name. CALLING SEQUENCE: result = STREBCASC( ebcstring ) INPUT PARAMETERS: EBCSTRING - String scalar or array written in EBCDIC OUTPUT: RESULT - the input string converted to ASCII DATA FILES: STREBCASC reads a file EBCASC.DAT containing the EBCDIC-ASCII conversion code. This file must be in the directory specified by the logical name or the environment variable ASTRO_DATA (see the first line of the program) COMMON BLOCKS: The conversion matrix read in from EBCASC.DAT is saved in the common block EBCASC for subsequent use. PROCEDURE: Each EBCDIC character is converted to its ASCII equivalent. NOTES: The conversion of non-printable characters differs somewhat from the Version 1 procedure. MODIFICATION HISTORY: Adapted from the IUE program EBCDIC, Wayne Landsman December, 1990
(See /usr/local/idl/lib/zastron/misc/strebcasc.pro)
NAME: STRN PURPOSE: The main and original purpose of this procedure is to convert a number to an unpadded string (i.e. with no blanks around it.) However, it has been expanded to be a multi-purpose formatting tool. You may specify a length for the output string; the returned string is either set to that length or padded to be that length. You may specify characters to be used in padding and which side to be padded. Finally, you may also specify a format for the number. NOTE that the input "number" need not be a number; it may be a string, or anything. It is converted to string. CALLING SEQEUNCE: tmp = STRN( number, [ LENGTH=, PADTYPE=, PADCHAR=, FORMAT = ] ) INPUT: NUMBER This is the input variable to be operated on. Traditionally, it was a number, but it may be any scalar type. OPTIONAL INPUT: LENGTH This KEYWORD specifies the length of the returned string. If the output would have been longer, it is truncated. If the output would have been shorter, it is padded to the right length. PADTYPE This KEYWORD specifies the type of padding to be used, if any. 0=Padded at End, 1=Padded at front, 2=Centered (pad front/end) IF not specified, PADTYPE=1 PADCHAR This KEYWORD specifies the character to be used when padding. The default is a space (' '). FORMAT This keyword allows the FORTRAN type formatting of the input number (e.g. '(f6.2)') OUTPUT: tmp The formatted string USEFUL EXAMPLES: print,'Used ',strn(stars),' stars.' ==> 'Used 22 stars.' print,'Attempted ',strn(ret,leng=6,padt=1,padch='0'),' retries.' ==> 'Attempted 000043 retries.' print,strn('M81 Star List',length=80,padtype=2) ==> an 80 character line with 'M81 Star List' centered. print,'Error: ',strn(err,format='(f15.2)') ==> 'Error: 3.24' or ==> 'Error: 323535.22' HISTORY: 03-JUL-90 Version 1 written by Eric W. Deutsch 10-JUL-90 Trimming and padding options added (E. Deutsch) 29-JUL-91 Changed to keywords and header spiffed up (E. Deutsch) Ma7 92 Work correctly for byte values (W. Landsman) 19-NOV-92 Added Patch to work around IDL 2.4.0 bug which caused an error when STRN('(123)') was encountered. (E. Deutsch)
(See /usr/local/idl/lib/zastron/misc/strn.pro)
NAME: STRNUMBER PURPOSE: Function to determine if a string is a valid numeric value. CALLING SEQUENCE: result = strnumber( st, [val] ) INPUTS: st - any IDL scalar string OUTPUTS: 1 is returned as the function value if the string st has a valid numeric value, otherwise, 0 is returned. OPTIONAL OUTPUT: val - (optional) value of the string. real*8 WARNING: (1) In V2.2.2 there was a bug in the IDL ON_IOERROR procedure that will cause the following statement to hang up IDL IDL> print,'' + string( strnumber('xxx') ) This bug was fixed in V2.3.0 (2) In V2.3.2, an IDL bug is seen in the following statements IDL> st = 'E' IDL> q = strnumber(st) & print,st The variable 'st' gets modified to an empty string. This problem is related to the ambiguity of whether 'E' is a number or not (could be = 0.0E). This bug was fixed in V3.0.0 (3) STRNUMBER was modified in February 1993 to include a special test for empty or null strings, which now returns a 0 (not a number). Without this special test, it was found that a empty string (' ') could corrupt the stack. HISTORY: version 1 By D. Lindler Aug. 1987 test for empty string, W. Landsman February, 1993
(See /usr/local/idl/lib/zastron/misc/strnumber.pro)
NAME: TEXTCLOSE PURPOSE: procedure to close file for text output as specifed by the (non-standard) system variable !TEXTOUT. CALLING SEQUENCE: textclose, [ TEXTOUT = ] KEYWORDS: textout - Indicates output device that was used by TEXTOPEN SIDE EFFECTS: if !textout is not equal to 5 and the textunit is opened. Then unit !textunit is closed and released HISTORY: D. Lindler Dec. 1986 (Replaces PRTOPEN) Test if TEXTOUT is a scalar string W. Landsman August 1993 Can't close unit -1 (Standard Output) I. Freedman April 1994
(See /usr/local/idl/lib/zastron/misc/textclose.pro)
NAME: TEXTOPEN PURPOSE Procedure to open file for text output. The type of output device (disk file or terminal screen) is specified by the TEXTOUT keyword or the (nonstandard) system variable !TEXTOUT. CALLING SEQUENCE: textopen, program, [ TEXTOUT = ] INPUTS: program - scalar string giving name of program calling textopen OPTIONAL INPUT KEYWORDS: TEXTOUT - Integer scalar (0-6) specifying output file/device to be opened (see below) or scalar string giving name of output file. If TEXTOUT is not supplied, then the (non-standard) system variable !TEXTOUT is used. SIDE EFFECTS: The following dev/file is opened for output. textout=0 Nowhere textout=1 TERMINAL using /more option textout=2 TERMINAL without /more option textout=3.prt textout=4 laser.tmp textout=5 user must open file textout = filename (default extension of .prt) The unit it is opened to is obtained with the procedure GET_LUN unless !TEXTOUT=5. The unit number is placed in system variable !TEXTUNIT. For !TEXTOUT=5 the user must set !TEXTUNIT to the appropriate unit number. NOTES: Note that TEXTOUT = 1 or TEXTOUT = 2 will open a unit to the terminal, SYS$OUTPUT (VMS) or /dev/tty (Unix). However, this terminal output will *not* appear in an IDL JOURNAL session, unlike text printed with the PRINT command. There is no terminal device for a Macintosh. NON-STANDARD SYSTEM VARIABLES: DEFSYSV,'!TEXTOUT',1 DEFSYSV,'!TEXTUNIT',0 HISTORY: D. Lindler Dec. 1986 Keyword textout added, J. Isensee, July, 1990 Made transportable, D. Neill, April, 1991 Trim input PROGRAM string W. Landsman Feb 1993 Don't modify TEXTOUT value W. Landsman Aug 1993 Modified for MacOS I. Freedman April 1994
(See /usr/local/idl/lib/zastron/misc/textopen.pro)
NAME: TO_HEX PURPOSE: Translate a non-negative decimal integer to a hexadecimal string CALLING SEQUENCE: HEX = TO_HEX( D, [ NCHAR ] ) INPUTS: D - non-negative decimal integer, scalar. All leading blanks are removed. OPTIONAL INPUT: NCHAR - number of characters in the output hexadecimal string. If not supplied, then the hex string will contain no leading zeros. OUTPUT: HEX - hexadecimal translation of input integer, string EXAMPLES: IDL> A = TO_HEX(11) ==> A = 'B' IDL> A = TO_HEX(100,3) ==> A = '064' METHOD: The hexadecimal format code '(Z)' is used to convert. No parameter checking is done. REVISION HISTORY: Written W. Landsman November, 1990
(See /usr/local/idl/lib/zastron/misc/to_hex.pro)
NAME: TYPE PURPOSE: Emulates VMS TYPE command. On a Unix machine, TYPE simply spawns to the more(1) command. On a Macintosh, refers user to editor. CALLING SEQUENCE: TYPE ;Prompt for filename to be typed TYPE, FILENAME ;Type the file FILENAME at the terminal OPTIONAL INPUTS: FILENAME - Scalar String giving name of file. On a VAX, the Extension defaults to".LIS". User will be prompted if FILENAME is not supplied. OUTPUTS: None. PROCEDURE: The file is opened and read line by line. Procedure pauses after a page (22 lines) of text is displayed, user presses [SPACEBAR] to continue display, [RETURN] for a single line, Q to quit ,and H or ? for help. This is similar to the Unix more command COMMON BLOCKS: The name of the last file typed is stored in the common block TYPENAME. MODIFICATION HISTORY: W. Landsman Version 2 IDL January 1990 Revised for use on VAXes and SUNs, N. Collins, November 1990 Recognize logical names and wildcards W. Landsman August 1991 Recognize version numbers W.Landsman October 1991 Modified for Mac IDL I. Freedman April 1994
(See /usr/local/idl/lib/zastron/misc/type.pro)
NAME: VECT PURPOSE: This function returns the given vector in parenthesized coordinates as in the form (X,Y). No limit on the number of dimensions. Also note that the vector does not need to be numbers. It may also be a string vector. e.g. ['X','Y'] CALLING SEQEUNCE: tmp = VECT( vctr, [ form, FORMAT = , DELIM = ] ) INPUT: VCTR The vector to be displayed e.g. [56,44] OPTIONAL KEYWORD INPUT: FORMAT This KEYWORD allows the specification of a format for the elements. e.g.: VECT([2,3],format='(f7.1)') gives '(2.0,3.0)' DELIM This KEYWORD specifies the delimeter. The default is ',' but other useful examples might be ', ' or ':' OPTIONAL INPUT FORM This parameter may be used instead of the keyword FORMAT OUTPUT: tmp A returned string of the parenthesized vector Other Procedures/Functions Called: STRN HISTORY: 03-JUL-90 Version 1 written by Eric W. Deutsch 24-AUG-91 Format='' keyword added (E. Deutsch) 29-AUG-91 FORM parameter added (E. Deutsch)
(See /usr/local/idl/lib/zastron/misc/vect.pro)
NAME: WHERENAN PURPOSE: Find the positions of all values within an array that correspond to the IEEE NaN (not-a-number) special values. CALLING SEQUENCE: Result = WHERENAN( ARRAY [, COUNT ] ) INPUT PARAMETERS: ARRAY = Array to test against the IEEE NaN special values. Must be of either floating point, double-precision, or complex type. OUTPUTS: The result of the function is the indices of all values of ARRAY corresponding to the IEEE NaN specification, similar to the IDL WHERE function. OPTIONAL OUTPUT PARAMETERS: COUNT = Number of values found corresponding to IEEE NaN. SIDE EFFECTS: If no NaN values are found, or if ARRAY is not of type float, double precision, or complex, then -1 is returned, and COUNT is set to 0. RESTRICTIONS: ARRAY must be of type float, double-precision, or complex. PROCEDURE: The bit patterns of the numbers being tested are compared against the IEEE NaN standard. MODIFICATION HISTORY: William Thompson, Feb. 1992. William Thompson, Oct. 1992, fixed bug regarding order of bytes on VAX machines.
(See /usr/local/idl/lib/zastron/misc/wherenan.pro)
NAME: ZPARCHECK PURPOSE: Routine to check user parameters to a procedure CALLING SEQUENCE: zparcheck, progname, parameter, parnum, types, dimens, [ message ] INPUTS: progname - scalar string name of calling procedure parameter - parameter passed to the routine parnum - integer parameter number types - integer scalar or vector of valid types 1 - byte 2 - integer 3 - int*4 4 - real*4 5 - real*8 6 - complex 7 - string 8 - structure dimens - integer scalar or vector giving number of allowed dimensions. OPTIONAL INPUT: message - string message describing the parameter to be printed if an error is found OUTPUTS: none EXAMPLE: IDL> zparcheck, 'HREBIN', hdr, 2, 7, 1, 'FITS Image Header' This example checks whether the parameter 'hdr' is of type string (=7) and is a vector (1 dimension). If either of these tests fail, a message will be printed "Parameter 2 (FITS Image Header) is undefined" "Valid dimensions are 1" "Valid types are string" SIDE EFFECTS: If an error in the parameter is a message is printed a RETALL issued HISTORY version 1 D. Lindler Dec. 86 documentation updated. M. Greason, May 1990.
(See /usr/local/idl/lib/zastron/misc/zparcheck.pro)