function sin
Returns the trigonometric sine of its argument. The returned value will be real, complex, or a matrix, depending on the argument. By default, the argument is in radians. This can be changed by specifying the switch /deg.

Syntax
result = sin(angle [, /deg])

Arguments
angle: a number (integer, real, complex) or a matrix, specifying the angle for which the sine is to be calculated. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

Switches
/deg: The argument is in degrees

Examples
To find the sine of the angle 90 degrees, type:
   print sin(90, /deg)

See also
function cos function tan
function cos
Returns the trigonometric cosine of its argument. The returned value will be real, complex, or a matrix, depending on the argument. By default, the argument is in radians. This can be changed by specifying the switch /deg.

Syntax
result = cos(angle [, /deg])

Arguments
angle: a number (integer, real, complex) or a matrix, specifying the angle for which the cosine is to be calculated. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

Switches
/deg: The argument is in degrees

Examples
To find the cosine of the angle 90 degrees, type:
   print cos(90, /deg)

See also
function sin function tan
function tan
Returns the trigonometric tangent of its argument. The returned value will be real, complex, or a matrix, depending on the argument. By default, the argument is in radians. This can be changed by specifying the switch /deg.

Syntax
result = tan(angle [, /deg])

Arguments
angle: a number (integer, real, complex) or a matrix, specifying the angle for which the tangent is to be calculated. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

Switches
/deg: The argument is in degrees

Examples
To find the tangent of the angle 45 degrees, type:
   print tan(45, /deg)

See also
function sin function cos
function sinh
Returns the hyperbolic sine of its argument. The returned value will be real, complex, or a matrix, depending on the argument. By default, the argument is in radians. This can be changed by specifying the switch /deg.

Syntax
result = sinh(angle [, /deg])

Arguments
angle: a number (integer, real, complex) or a matrix, specifying the angle for which the hyperbolic sine is to be calculated. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

Switches
/deg: The argument is in degrees

Examples
To find the hyperbolic sine of the angle 90 degrees, type:
   print sinh(90, /deg)

See also
function cosh function tanh
function cosh
Returns the hyperbolic cosine of its argument. The returned value will be real, complex, or a matrix, depending on the argument. By default, the argument is in radians. This can be changed by specifying the switch /deg.

Syntax
result = cosh(angle [, /deg])

Arguments
angle: a number (integer, real, complex) or a matrix, specifying the angle for which the hyperbolic cosine is to be calculated. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

Switches
/deg: The argument is in degrees

Examples
To find the hyperbolic cosine of the angle 90 degrees, type:
   print cosh(90, /deg)

See also
function sinh function tanh
function tanh
Returns the hyperbolic tangent of its argument. The returned value will be real, complex, or a matrix, depending on the argument. By default, the argument is in radians. This can be changed by specifying the switch /deg.

Syntax
result = tanh(angle [, /deg])

Arguments
angle:a number (integer, real, complex) or a matrix, specifying the angle for which the hyperbolic tangent is to be calculated. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

Switches
/deg: The argument is in degrees

Examples
To find the hyperbolic tangent of the angle 45 degrees, type:
   print tanh(45, /deg)

See also
function sinh function cosh
function asin
Returns the arcus sine of its argument, which can be either real, complex or a matrix. The returned value's type is changed to complex if necessary (when the absolute value of the argument is greater than 1). By default, the returned value is in radians. This can be changed by specifying the switch /deg.

Syntax
result = asin(X [, /deg])

Arguments
X: a number (integer, real, complex) or a matrix, specifying the sine of the angle to be returned. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

Switches
/deg: The result will be in degrees

Examples
To find the angle (in degrees) whose sine is 0.5, type:
   print asin(0.5, /deg)

See also
function acos function atan
function acos
Returns the arcus cosine of its argument, which can be either real, complex or a matrix. The returned value's type is changed to complex if necessary (when the absolute value of the argument is greater than 1). By default, the returned value is in radians. This can be changed by specifying the switch /deg.

Syntax
result = acos(X [, /deg])

Arguments
X: a number (integer, real, complex) or a matrix, specifying the cosine of the angle to be returned. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

Switches
/deg: The result will be in degrees

Examples
To find the angle (in degrees) whose cosine is 0.5, type:
   print acos(0.5, /deg)

See also
function asin function atan
function atan
Returns the arcus tangent of its argument, which can be either real, complex
or a matrix. The returned value has the same type as the argument. By default, the returned value is in radians. This can be changed by specifying the switch /deg.

Syntax
result = atan(X [, Y] [, /deg])

Arguments
X: a number (integer, real, complex) or a matrix, specifying the tangent of the angle to be returned. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.
Y: a real number. If given, returns atan(X / Y) for real numbers, quadrant correct.

Switches
/deg: The result will be in degrees

Examples
To find the angle (in degrees) whose tangent is 0.5, type:
   print atan(0.5, /deg)

See also
function asin function acos
function asinh
Returns the hyperbolic arcus sine of its argument, which can be either real, complex or a matrix. By default, the returned value is in radians. This can be changed by specifying the switch /deg.

Syntax
result = asinh(X [, /deg])

Arguments
X: a number (integer, real, complex) or a matrix, specifying the hyperbolic sine of the angle to be returned. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

Switches
/deg: The result will be in degrees

Examples
To find the angle (in degrees) whose hyperbolic sine is 0.5, type:
   print asinh(0.5, /deg)

See also
function acosh function atanh
function acosh
Returns the hyperbolic arcus cosine of its argument, which can be either real, complex or a matrix. By default, the returned value is in radians. This can be changed by specifying the switch /deg.

Syntax
result = acosh(X [, /deg])

Arguments
X: a number (integer, real, complex) or a matrix, specifying the hyperbolic cosine of the angle to be returned. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

Switches
/deg: The result will be in degrees

Examples
To find the angle (in degrees) whose hyperbolic cosine is 0.5, type:
   print acosh(0.5, /deg)

See also
function asinh function atanh
function atanh
Returns the hyperbolic arcus tangent of X, which can be either real, complex or a matrix. By default, the returned value is in radians. This can be changed by specifying the switch /deg.

Syntax
result = atanh(X [, /deg])

Arguments
X: a number (integer, real, complex) or a matrix, specifying the hyperbolic tangent of the angle to be returned. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

Switches
/deg: The result will be in degrees

Examples
To find the angle (in degrees) whose hyperbolic tangent is 0.5, type:
   print atanh(0.5, /deg)

See also
function acosh function asinh
function exp
Returns the exponential function of X. The returned value will be real, complex, or a matrix, depending on the argument.

Syntax
result = exp(X)

Arguments
X: a number (integer, real, complex) or a matrix. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

See also
function ln
function log
Returns the logarithm of X. If no base is supplied, the logarithm to the base 10 is returned.

Syntax
result = log(X [, base])

Arguments
X: The value whose logarithm is to be returned. This can be a number (integer, real, complex) or a matrix. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.
base: If given, the logarithm of X to this base will be returned

See also
function ln
function ln
Returns the logarithm of X to the base e (the natural logarithm).

Syntax
result = ln(X)

Arguments
X: The value whose logarithm is to be returned. This can be a number (integer, real, complex) or a matrix. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

See also
function log
function sqrt
Returns the square root of X.

Syntax
result = sqrt(X)

Arguments
X: The value whose square root is to be returned. This can be a number (integer, real, complex) or a matrix. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.
function erf
Returns the error function of X.

Syntax
result = erf(X)

Arguments
X: A real number.
function bessel
Returns the bessel function of X.

Syntax
result = bessel(X, kind, order)

Arguments
X: A real number.
kind: An integer number (1 or 2), specifying the kind of the bessel function to be computed.
order: An integer number >= 0, specifying the order of the bessel function to be computed.
function int
Returns the integer part of X.

Syntax
result = int(X)

Arguments
X: a real number.

Examples
To print the integer part of the real number -6.7 which is -6, type:
   print int(-6.7)

See also
function round
function round
Returns X rounded to the nearest integer.

Syntax
result = round(X)

Arguments
X: a real number.

See also
function int
function frac
Returns the fractional part of X.

Syntax
result = frax(X)

Arguments
X: a real number.
function abs
Returns the absolute value of X.

Syntax
result = abs(X)
X: The value whose absolute value is to be returned. This can be a number (integer, real, complex) or a matrix. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

See also
function sign function arg function real function imag
function sign
Returns the sign of X.

Syntax
result = sign(X)

Arguments
X: a real number.

See also
function abs
function rad2deg
Returns X in radians converted to degrees. This is equivalent to X*180/pi.

Syntax
result = rad2deg(X)

Arguments
X: The value which is to be converted to degrees. This can be any number (integer, real, complex).

See also
function deg2rad
function deg2rad
Returns X in degrees converted to radians. This is equivalent to X*pi/180.

Syntax
result = deg2rad(X)

Arguments
X: The value which is to be converted to radians. This can be any number (integer, real, complex).

See also
function rad2deg
function float
Returns the string X converted to a real number.

Syntax
result = float(X)

Arguments
X: A string.
function strlen
Returns the length of the string X.

Syntax
result = strlen(X)

Arguments
X: A string.

See also
function nelements
function min
Returns the minimum value in X.

Syntax
result = min(X)

Arguments
X: A matrix.

See also
function max function avg function total function median function stddev function meddev
function max
Returns the maximum value in X.

Syntax
result = max(X)

Arguments
X: A matrix.

See also
function min function avg function total function median function stddev function meddev
function avg
Returns the average value of X.

Syntax
result = avg(X)

Arguments
X: A matrix.

See also
function max function min function total function median function stddev function meddev
function total
Returns the sum of all values in X.

Syntax
result = total(X)

Arguments
X: A matrix.

See also
function max function min function avg function median function stddev function meddev
function median
Returns the median value of X.

Syntax
result = median(X)

Arguments
X: A matrix.

See also
function max function min function total function avg function stddev function meddev
function naxis
Returns the number of axes in X.

Syntax
result = naxis(X)

Arguments
X: A matrix.

See also
function nelements function naxis1 function naxis2 function naxis3
function naxis1
Returns the length of axis #1 in X.

Syntax
result = naxis1(X)

Arguments
X: A matrix.

See also
function nelements function naxis function naxis2 function naxis3
function naxis2
Returns the length of axis #2 in X.

Syntax
result = naxis2(X)

Arguments
X: A matrix.

See also
function nelements function naxis function naxis1 function naxis3
function naxis3
Returns the length of axis #3 in X.

Syntax
result = naxis3(X)

Arguments
X: A matrix.

See also
function nelements function naxis function naxis1 function naxis2
function xmax
Returns the x coordinate of the maximum in X.

Syntax
result = xmax(X)

Arguments
X: A matrix.

See also
function ymax function xcen function ycen function maxima function centroids procedure centroid
function ymax
Returns the y coordinate of the maximum in X.

Syntax
result = ymax(X)

Arguments
X: A matrix.

See also
function xmax function xcen function ycen function maxima function centroids procedure centroid
function xcen
Returns the x coordinate of the centroid in X.

Syntax
result = xcen(X)

Arguments
X: A matrix.

See also
function xmax function ymax function ycen function maxima function centroids procedure centroid
function ycen
Returns the y coordinate of the centroid in X.

Syntax
result = ycen(X)

Arguments
X: A matrix.

See also
function xmax function ymax function xcen function maxima function centroids procedure centroid
function real
Returns the real part of the complex number X.

Syntax
result = real(X)
X: The value whose real part is to be returned. This can be a number (integer, real, complex) or a matrix. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

See also
function imag function arg function abs function complex function conj
function imag
Returns the imaginary part of the complex number X. If X is not a complex number, 0 is returned.

Syntax
result = imag(X)
X: The value whose imaginary part is to be returned. This can be a number (integer, real, complex) or a matrix. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

See also
function real function arg function abs function complex function conj
function arg
Returns the argument of the complex number X (the angle of the polar representation of a complex number).

Syntax
result = arg(X)
X: The value whose imaginary part is to be returned. This can be a number (integer, real, complex) or a matrix. If X is a matrix, a matrix of the same size is returned where each element represents the result of the operation.

See also
function real function imag function abs function complex function conj
function jd
Returns the Julian Date of given date. Hour, minute, and second default to 0.

Syntax
result = jd(day, month, year [, hour [, minute [,second]]])

Arguments
day: An integer number.
month: An integer number.
year: An integer number.
hour: An integer number.
minute: An integer number.
second: A real number.

See also
function jdnumber function jdfraction function calday function now
function jdnumber
Returns the integer part of the Julian Date of given date. Hour, minute, and second default to 0.

Syntax
result = jdnumber(day, month, year [, hour [, minute [,second]]])

Arguments
day: An integer number.
month: An integer number.
year: An integer number.
hour: An integer number.
minute: An integer number.
second: A real number.

See also
function jd function jdfraction function calday function now
function jdfraction
Returns the fractional part of the Julian Date of given date. Hour, minute, and second default to 0.

Syntax
result = jdfraction(day, month, year [, hour [, minute [,second]]])

Arguments
day: An integer number.
month: An integer number.
year: An integer number.
hour: An integer number.
minute: An integer number.
second: A real number.

See also
function jd function jdnumber function calday function now
function upper
Converts the string X to upper case.

Syntax
result = upper(X)

Arguments
X: A string.

See also
function lower procedure upper
function lower
Converts the string X to lower case.

Syntax
result = lower(X)

Arguments
X: A string.

See also
function upper procedure lower
function string
Converts the number X to a string.

Syntax
result = string(X [,/time] [,/deg] [,/rad]

Arguments
X: Any number (integer, real, complex).

Switches
/time: Convert to hours, minutes, and seconds
/deg: Convert to degrees, arcminutes, and arcseconds
/rad: Same as /deg, but the argument is converted to degrees
function calday
Returns a nicely formatted string telling the calendar date of given Julian Date JD. If JD_fraction is nonzero, it describes the fractional part.

Syntax
result = calday(JD, JD_fraction)

Arguments
JD: The julian date
JD_fraction: If nonzero, the calendar date for JD+JD_fraction will be returned

See also
function jd function now
function header
Returns the FITS header of X.

Syntax
result = header(X)

Arguments
X: A matrix.
function dayofweek
Returns the day of the week of specified (julian) date.

Syntax
result = dayofweek(DAY, MONTH, YEAR)
result = dayofweek(JD [,JD_fraction])

Arguments
DAY: An integer number.
MONTH: An integer number.
YEAR: An integer number.
JD: Julian Date.
JD_fraction: A real number.

See also
function calday function jd
function fits
Creates an array (or a matrix) of size X x Y x Z. The arguments Y and Z are optional. The resulting matrix will be of type R4 (single precision).

Syntax
result = fits(X [, Y [, Z]])

Arguments
X: An integer number giving the length of the first dimension.
Y: An integer number giving the length of the second dimension.
Z: An integer number giving the length of the third dimension.

See also
function bytearray function shortarray function longarray function floatarray function doublearray function complexarray
function gauss
Creates an elliptical Gaussian. This is defined by respective FWHM1 and FWHM2, axis position angle (in degrees) and Gaussian center position (x, y) in the array. Optional keywords are naxis1, naxis2 which determine the size of the array. If not set, the size of the array is determined from global variables.

Syntax
result = gauss(X, Y, FWHM1 [, FWHM2 [, ANGLE]] [, naxis1=value] [, naxis2 = value])

Arguments
X: The center of the gaussian in the x-axes
Y: The center of the gaussian in the y-axes
FWHM1: Full-width at half maximum of the major axes
FWHM2: Optional, full-width at half maximum of the minor axes
ANGLE: Optional, position angle of the gaussian
naxis1=value: Optional, the size of the resulting array in the first dimension
naxis2=value: Optional, the size of the resulting array in the second dimension

See also
function quickgauss
function ellipse
Creates an ellipse. This is defined by respective RADIUS1 and RADIUS2, axis position angle (in degrees) and Ellipse center position (x, y) in the array. Optional keywords are naxis1, naxis2 which determine the size of the array. If not set, the size of the array is determined from global variables.

Syntax
result = ellipse(X, Y, RADIUS1 [, RADIUS2 [, ANGLE]] [, naxis1=value] [, naxis2 = value])

Arguments
X: The center of the ellipse in the x-axes
Y: The center of the ellipse in the y-axes
RADIUS1: Radius of the major axes
RADIUS2: Optional, radius of the minor axes
ANGLE: Optional, position angle of the ellipse
naxis1=value: Optional, the size of the resulting array in the first dimension
naxis2=value: Optional, the size of the resulting array in the second dimension

See also
function circle
function circle
Creates a circle centered on X, Y with the respective radius. Optional keywords are naxis1, naxis2 which determine the size of the array. If not set, the size of the array is determined from global variables.

Syntax
result = circle(X, Y, RADIUS [, naxis1=value] [, naxis2 = value])

Arguments
X: The center of the circle in the x-axes
Y: The center of the circle in the y-axes
RADIUS: The radius of the circle
naxis1=value: Optional, the size of the resulting array in the first dimension
naxis2=value: Optional, the size of the resulting array in the second dimension

See also
function ellipse
function rect
Creates a rectangular filter. This is defined by: Respective width and height and center position (X, Y) in the array. Optional keywords are naxis1, naxis2 which determine the size of the array. If not set, the size of the array is determined from global variables.

Syntax
result = rect(X, Y, WIDTH, HEIGHT [, naxis1=value] [, naxis2 = value])

Arguments
X: The center of the rectangle in the x-axes
Y: The center of the rectangle in the y-axes
WIDTH: The width of the rectangle
HEIGHT: the height of the rectangle
naxis1=value: Optional, the size of the resulting array in the first dimension
naxis2=value: Optional, the size of the resulting array in the second dimension
function delta
Creates a delta function. This is defined by: All values in the array 0 except for (x, y) which is set to value. If value is not set, 1 will be used. Optional keywords are naxis1, naxis2 which determine the size of the array. If not set, the size of the array is determined from global variables.

Syntax
result = delta(X, Y [, VALUE] [, naxis1=value] [, naxis2 = value])

Arguments
X: The x-position of the nonzero pixel
Y: The y-position of the nonzero pixel
VALUE: Optional, the value of the nonzero pixel
naxis1=value: Optional, the size of the resulting array in the first dimension
naxis2=value: Optional, the size of the resulting array in the second dimension
function cosbell
Creates a cosine bell filter. This is defined by: Center position (x, y), inner radius r1, and outer radius r2. Optional keywords are naxis1, naxis2 which determine the size of the array. If not set, the size of the array is determined from global variables.

Syntax
result = cosbell(X, Y, RADIUS1, RADIUS2 [, naxis1=value] [, naxis2 = value])

Arguments
X: The center of the cosine bell filter in the x-axes
Y: The center of the cosine bell filter in the y-axes
RADIUS1: The inner radius where the filter is equal to 1
RADIUS2: The outer radius where the filter is equal to 0
naxis1=value: Optional, the size of the resulting array in the first dimension
naxis2=value: Optional, the size of the resulting array in the second dimension
function chinhat
Creates a chinese hat filter. This is defined by: Center position (x, y) and radius. Optional keywords are naxis1, naxis2 which determine the size of the array. If not set, the size of the array is determined from global variables.

Syntax
result = chinhat(X, Y, RADIUS [, naxis1=value] [, naxis2 = value])

Arguments
X: The center of the chinese hat filter in the first dimension
Y: The center of the chinese hat filter in the second dimension
RADIUS: The radius of the chinese hat filter
naxis1=value: Optional, the size of the resulting array in the first dimension
naxis2=value: Optional, the size of the resulting array in the second dimension
function airy
Creates an airy function at the center of the array. This is defined by: Telescope diameter [meters], pixel scale [arcsec/pixel], and wavelength [microns]. Optional keywords are naxis1, naxis2 which determine the size of the array. If not set, the size of the array is determined from global variables.

Syntax
result = airy(DIAMETER, PIXELSCALE, WAVELENGTH)

Arguments
DIAMETER: The telescope diameter in meters
PIXELSCALE: The size of a pixel in arcseconds
WAVELENGTH: The observing wavelength in microns
naxis1=value: Optional, the size of the resulting array in the first dimension
naxis2=value: Optional, the size of the resulting array in the second dimension
function cubemedian
Does a median of all images in X. If X is a FITS file enclosed in single quotes, the range of images to be used for calculating the median can be limited by setting FIRST and LAST. If X is a matrix in memory, the value reject can be used to exclude a value to be taken when calculating the median.

Syntax
result = cubemedian(X [, reject] [, FIRST [, LAST]])

Arguments
X: A matrix or a FITS file name. If a FITS file name is given, the global variable tmpmem determines how many bytes of data are read in at a time.
reject: If X is in memory, a value which should be discarded.
FIRST: If X is a FITS file, the first image in the cube to process.
LAST: If X is a FITS file, the last image to process.

See also
function collapse
function cubeavg
Does an average of all images in X. If first is set, all images in the datacube before first are ignored. If last is set, first and last determine which images to use.

Syntax
result = cubeavg(X [, FIRST [, LAST]])

Arguments
X: A matrix or a FITS file name. If a FITS file name is given, only one image is read into memory at a time thus saving memory.
FIRST: Optional, the first image in the cube to process
LAST: Optional, the last image to process
function ssa
Calculates the simple shift-and-add of all images in the x datacube. If x is a fits file, a memory saving method will be used to do the ssa. If x is a string, this points to a text file where an arbitrary amount of fits filenames is given as a list. The first image in each of these files will be used for the ssa. If sky, flat, dpl, mask are given, they will be used. An optional keyword method can be given: method = 0 : Shift the brightest pixel to xcen, ycen method = 1 : Integer shift the centroid to xcen, ycen method = 2 : Subpixel shift the centroid to xcen, ycen If method < 0, the same is done as if method were set to 0, but the brightest pixel is searched in a smoothed version of the image. The smoothing is done by convolving with a gaussian of fwhm the negative of method.

Syntax
result = ssa(X, XCENTER, YCENTER, SKY, FLAT, DPL, MASK [, METHOD])

Arguments
X: A FITS datacube
XCENTER: The pixel where to shift in the first dimension
YCENTER: The pixel where to shift in the second dimension
SKY: A sky to be subtracted
FLAT: A flatfield to be multiplied
DPL: A dead pixel list to be applied
MASK: The peak pixel will be searched for in an image multiplied by this mask
METHOD: Optional, controls how the SSA will be done:
METHOD = 0: Shift the brightest pixel to XCENTER, YCENTER (default)
METHOD = 1: Integer shift the centroid to XCENTER, YCENTER
METHOD = 2: Subpixel shift the centroid to XCENTER, YCENTER
METHOD < 0: the same is done as if METHOD were set to 0, but the brightest pixel is searched in a smoothed version of the image. The smoothing is done by convolving with a gaussian of fwhm the negative of method.
function mosaic
Make a mosaic of the images specified in the file pointed to by FNAME. The file formatis as follows: 3(4) Columns: Filename, xshift, yshift, (scale factor). Negative Shifts result in clipping of the image.

Syntax
result = mosaic(FNAME)

Arguments
FNAME: A string specifying the file name to use.
function shift
Shifts X by XSHIFT, YSHIFT.

Syntax
result = shift(X, XSHIFT, YSHIFT [, METHOD]

Arguments
X: The matrix to be shifted
XSHIFT: Shift vector in the first dimension
YSHIFT: Shift vector in the second dimension
METHOD: Optional, can have the following values:
METHOD = 0: Shifts to fraction of a pixel; wraps image
METHOD = 1: Shifts by integer number of pixels; wraps image
METHOD = 2: Shifts by integer number of pixels; no wrap (default)
METHOD = 3: same as 1, but shifts maximum to center of X
METHOD = 4: same as 2, but shifts maximum to center of x
function rotate
Rotates X by ANGLE (in degrees, counterclockwise)

Syntax
result = rotate(X, ANGLE [, XCENTER, YCENTER])

Arguments
X: The matrix to be rotated
ANGLE: Rotation angle in degrees. Rotation will we counterclockwise
XCENTER: Optional, the center of the rotation in the first dimension (defaults to the center of X).
YCENTER: Optional, the center of the rotation in the second dimension (defaults to the center of X).
function fft
Calculates the fast fourier transform of X. If X is real, the forward transform is computed. If X is complex, the inverse transform is computed.

Syntax
result = fft(X)

Arguments
X: A matrix.

Notes
The fft function uses the FFTW (Fastest Fourier Transform in the West) library, which is not limited to any array size. Still, computing a fft is fastest for arrays of size 2^N (N being an integer number).
function reass
Reassembles X.

Syntax
result = reass(X)

Arguments
X: A matrix.
function norm
Normalizes X.

Syntax
result = norm(X [, /unity] [, /total] [, /average])

Arguments
X: A matrix.

Switches
/unity: All values are scaled to be between 0 and 1 (default)
/total: The total flux in the resulting array will be 1
/average: The average flux in the resulting array will be 1
function clip
Clips values in X. If VALUE is not set, all values below low will be set to low, and all values above high will be set to high. If value is set, all values above low AND below high are set to value.

Syntax
result = clip(X, LOW, HIGH [, VALUE])

Arguments
X: The matrix to be clipped
LOW: All values below this value will be set to LOW
HIGH: All values above this value will be set to HIGH. If HIGH < LOW, no upper clipping will be done
VALUE: Optional, if given then all values above LOW and below HIGH will be set to this value (inclusive clipping)
function smooth
Smooths X by multiplying with a gaussian of width FWHM in fourier space. The total flux is kept constant. This is equivalent to reass(fft(fft(X)*fft(gauss(naxis1(X)/2+1,naxis2(X)/2+1,FWHM))))

Syntax
result = smooth(X, FWHM)

Arguments
X: A matrix.
FWHM: The full width at half maximum of the gaussian used for smoothing.
function boxcar
Computes a running boxcar with radius WIDTH. By default, the value is replaces by the average in the box. This can be changed by specifying one of the switches /minimum, /maximum, or /median.

Syntax
result = boxcar(X, WIDTH [, /minimum] [, /maximum] [, /median])

Arguments
X: A matrix.
WIDTH: An integer number specifying the radius of the box.

Switches
/minimum: Each value is replaced with the minimum within a box with radius WIDTH
/maximum: Each value is replaced with the maximum within a box with radius WIDTH
/median: Each value is replaced with the median within a box with radius WIDTH
function 3dmerge
Merges X and Y (see GIPSY help for more information).

Syntax
result = 3dmerge(X, Y, TWEAK)

Arguments
X: A matrix.
Y: A matrix.
TWEAK: An integer number.
function 3dmegacal
Calculates a 3D calibration file (see GIPSY help for more information).

Syntax
result = 3dmegacal(X, RUN, BAND)

Arguments
X: A matrix
RUN: A string.
BAND: A string.
function 3dcal
Calibrates a 3D dataset using calset (see GIPSY help for more information).

Syntax
result = 3dcal(X, CALSET)

Arguments
X: A matrix.
CALSET: A matrix.
function 3dcubin
Creates a 3D data cube from X (see GIPSY help for more information).

Syntax
result = 3dcubin(X, YEAR, BAND, SCALE)

Arguments
X: A matrix.
YEAR: An integer number.
BAND: A string.
SCALE: A real number.
function 3dexpand
Replaces all values in the single images of a datacube by the average in the respective images.

Syntax
result = 3dexpand(X)

Arguments
X: A matrix.
function dpixcreate
Creates a dead pixel list of X using a magic threshold. Boxsize defaults to 3 and gives the radius of the running boxcar used. NPASS defaults to 3 and gives the number of passes used.

Syntax
result = dpixcreate(X, THRESHOLD [, BOXSIZE [, NPASS]])

Arguments
X: On this array the dead pixel list will be created
THRESHOLD: Sensitivity of the algorithm (use 5 for a start)
BOXSIZE: Optional, the size of the square box for comparing pixel values (default: 3)
NPASS: Optional, number of iterations
function dpixapply
Corrects dead pixels in X using DPL by interpolation. BOXSIZE defaults to 1 and gives the radius of the boxcar used. Each value where DPL is not 0 will be regarded as a dead pixel. Those are not used in the interpolation process.

Syntax
result = dpixapply(X, DPL [, BOXSIZE [, method = value]])

Arguments
X: The array to be corrected for dead pixels
DPL: A dead pixel list in which all non-zero pixels mark dead pixels in X
BOXSIZE: Optional, gives the size of the averaging box for interpolation
method = value: Optional, gives the type of correction:
method = 0: Interpolation from boxcar average (default)
method = 1: Interpolation along first dimension
method = 2: Interpolation along second dimension
function flip
Flips X by specified AXIS

Syntax
result = flip(X, AXIS)

Arguments
X: The array to be flipped
AXIS: Which axis to flip: 1 = x, 2 = y
function enlarge
Enlarges X by specified integer SCALE.

Syntax
result = enlarge(X, SCALE [, method = value])

Arguments
X: The array to be enlarged
SCALE: The resulting array will be SIZE times bigger than X
method = value: Optional, determines how to enlarge:
method = 0: Center original image (default)
method = 1: Center original image, edge values are mean of edge
method = 2 : Blow up pixels
function resize
Resizes X to the new axis lengths. The argument NAXIS3 is optional. If the new dimension is smaller than in X, the image will be clipped, else the image will be in the upper left corner.

Syntax
result = resize(X, NAXIS1, NAXIS2 [, NAXIS3])

Arguments
X: A matrix.
NAXIS1: The new length in the first dimension.
NAXIS2: The new length in the second dimension.
NAXIS3: The new length in the third dimension.
function wien
Performs a wiener filtered deconvolution of X using PSF as dirty beam. HEIGHT gives the maximum of the delta function used as filter function and defaults to 1.

Syntax
result = wien(X, PSF [, HEIGHT])

Arguments
X: A matrix.
PSF: A matrix.
HEIGHT: A real number.

Notes
The memory required for wiener deconvolution (in bytes) calculates as 33*(Number of pixels in the image).
function lucy
Performs a lucy deconvolution of X using PSF as dirty beam and N iterations. THRESHOLD defaults to 0.000003.

LUCY DECONVOLUTION ALGORITHM. "Lucy has shown that his iterative scheme is related to the maximum likelihood solution of the deconvolution problem and would converge to that solution after an infinite number of iterations."

   iteration number : k
   dirty beam : dbeam
   dirty map : dmap
   estimated object : o(k)
   reconvolved estimated
   object : oc(k)
   correctin function : t(k)
   multiplication : *
   convolution : (*)

   start: o(0) = dmap

   iteration:
   oc(k) = o(k) (*) dbeam
   t(k) = (dmap/oc(k)) (*) dbeam
   o(k+1)= o(k) * t(k)

Due to calculation of the quotient for t(k) the algorithm is sensitive to noise. Therefore a weighting function has been implemented which is unity if the dmap singal is larger than "thresh" and zero elsewhere. t(k) is only calculated in that area and hence the deconvolution is only effective there. Threshhold equals input if positive. If input is negative thresh is determined via mean and rms in the area below abs(thresh). If thresh is zero thresh is determined in the area below -0.1 times the maximum flux in dmap. The redetermined threshhold is mean value plus 3 times rms.

To check on convergence of algorithm the rms between input dmap and current lucy deconvolved map reconvolved with dbeam is calculated.


Syntax
result = lucy(X, PSF, N [, THRESHOLD])

Arguments
X: A matrix.
PSF: A matrix.
N: An integer number.
THRESHOLD: A real number.

See also
function clean function wien
Notes
The memory required for lucy deconvolution (in bytes) calculates as 44*(Number of pixels in the image).
function center
Shifts the brightest pixel in X to the center.

Syntax
result = center(X)

Arguments
X: A matrix.
function 3dnorm
Normalizes a 3D datacube.

Syntax
result = 3dnorm(X)

Arguments
X: A matrix.
function conj
Returns the complex conjugate of X.

Syntax
result = conj(X)
X: A matrix or a complex number.

See also
function complex function real function imag function arg function abs
function correl
Returns the cross-correlation of X and Y.

Syntax
result = correl(X, Y)

Arguments
X: A matrix.
Y: A matrix.
function readfits
Read specified FITS file into memory.

Syntax
result = readfits(FILENAME)

Arguments
FILENAME: A string.
function 3dspec
Returns an average 3D spectrum of X (dispersion along the third dimension) using the mask Y (2-dim) or the center (x,y) with radii r1 and r2.

Syntax
result = 3dspec(X, Y)
result = 3dspec(X, xcenter, ycenter [, r1 [, r2]])

Arguments
X: A three dimensional matrix.
Y: A two dimensional matrix.
xcenter: The central pixel of the spectrum in the first dimension.
ycenter: The central pixel of the spectrum in the second dimension.
r1: The radius of the circular aperture to be used.
r2: The scaled average of all values in the annulus defined by r1 and r2 will be subtracted from the spectrum (local sky subtraction).
function stddev
Returns the standard deviation of X.

Syntax
result = stddev(X)

Arguments
X: A matrix.

See also
function max function min function avg function total function median function stddev
function variance
Returns the variance of X.

Syntax
result = variance(X)

Arguments
X: A matrix.
function meddev
Returns the median deviation from the median in X.

Syntax
result = meddev(X)

Arguments
X: A matrix.

See also
function max function min function avg function total function median function stddev
function saomark
Interactively mark pixels on an SAO image display which are marked red on the display. The resulting array will have a value of 1 in each marked pixel, a value of 0 elsewhere.

Syntax
result = saomark()

Arguments
none
function random
Returns a random number between 0 and 1. If SEED is not set, a seed based on the current time is used.

Syntax
result = random([SEED])

Arguments
SEED: An integer number.
function import
Imports a text file. If the first character in the file is numeric, the values in the file are written into a numerical array. The number of lines in the file then determine NAXIS2, the number of individual entries in the first line of the file determines NAXIS1. Else the text file will be written into a string array.

Syntax
result = import(FILENAME [, /text] [, /number])

Arguments
FILENAME: A string.

Switches
/text: Force to read into a string array
/number: Force to read into a numerical array
function rebin
Rebins X to the new axis lengths X1 and X2 using a bilinear interpolation. The aspect ratio is not preserved.

Syntax
result = rebin(X, X1, X2)

Arguments
X: A matrix.
X1: An integer number.
X2: An integer number.
function stringarray
Returns a string array. If X is an integer number, a string array will have X entries which are all initialized to empty strings. If X is a string, the string array will initially have one element which is set to X.

Syntax
result = stringarray(X)

Arguments
X: A positive integer number.
function nelements
Returns the number of elements in X. For a matrix, this is the total number of pixels, for a string, the number of characters, and for a stringarray, the number of strings.

Syntax
result = nelements(X)

Arguments
X: A matrix, string, or string array.
function ssastat
Returns statistics for ssa. Arguments like ssa. The resulting array will be [xshift, yshift, min, max, flux, fwhm, flag].

Syntax
result = ssastat(X, XCENTER, YCENTER, SKY, FLAT, DPL, MASK [, METHOD])

Arguments
X: A FITS datacube
XCENTER: The pixel where to shift in the first dimension
YCENTER: The pixel where to shift in the second dimension
SKY: A sky to be subtracted
FLAT: A flatfield to be multiplied
DPL: A dead pixel list to be applied
MASK: The peak pixel will be searched for in an image multiplied by this mask
METHOD: Optional, controls how the SSA will be done:
METHOD = 0: Shift the brightest pixel to XCENTER, YCENTER (default)
METHOD = 1: Integer shift the centroid to XCENTER, YCENTER
METHOD = 2: Subpixel shift the centroid to XCENTER, YCENTER
METHOD < 0: the same is done as if METHOD were set to 0, but the brightest pixel is searched in a smoothed version of the image. The smoothing is done by convolving with a gaussian of fwhm the negative of method.

See also
function ssa function sssa
function sssa
Calculates the simple shift-and-add of all images in X. If X is a FITS file, a
memory saving method will be used to do the ssa.

Syntax
result = sssa(X, STATS, SKY, FLAT, DPL, MASK [, METHOD])

Arguments
X: A FITS datacube
STATS: An array created with the ssastat function. If its flag is not 1, the image will be skipped
SKY: A sky to be subtracted
FLAT: A flatfield to be multiplied
DPL: A dead pixel list to be applied
MASK: The peak pixel will be searched for in an image multiplied by this mask
METHOD: Optional, controls how the SSA will be done:
METHOD = 0: Shift the brightest pixel to XCENTER, YCENTER (default)
METHOD = 1: Integer shift the centroid to XCENTER, YCENTER
METHOD = 2: Subpixel shift the centroid to XCENTER, YCENTER

See also
function ssa function ssastat
function ssaselect
Obsolete function
function maxentropy
Maximum entropy deconvolution of X using PSF. N is the number of iterations, THRESHOLD is the magic threshold of the deconvolution (defaults to 1e-9). NOTE THAT THIS SEEMS NOT TO WORK.

Syntax
result = maxentropy(X, PSF, N [, THRESHOLD])

Arguments
X: A matrix.
PSF: A matrix.
N: An integer number.
THRESHOLD: A real number.
function cubeminimum
Returns the minimum of each pixel along the 3rd axis if X is a cube.

Syntax
result = cubeminimum(X)

Arguments
X: A matrix or a FITS file name. If a FITS file name is given, only one image is read into memory at a time thus saving memory.
function cubemaximum
Returns the maximum of each pixel along the 3rd axis if X is a cube.

Syntax
result = cubemaximum(X)

Arguments
X: A matrix or a FITS file name. If a FITS file name is given, only one image is read into memory at a time thus saving memory.
function fwhm
Returns the second order moment of X centered at [XCENTER, YCENTER] within RADIUS, which corresponds to the FWHM at that location. The parameter RADIUS is optional. If skipped, a default of 5 pixels will be used.

Syntax
result = fwhm(X, XCENTER, YCENTER [, RADIUS])

Arguments
X: A matrix.
XCENTER: An integer number.
YCENTER: An integer number.
RADIUS: An integer number.
function setbitpix
Change the pixel type of X.

Syntax
result = setbitpix(X, BITPIX [, BSCALE [, BZERO]])

Arguments
X: The array whose pixel type is to be changed
BITPIX: Desired pixel type:
BITPIX = -128: Complex (note that this does not conform to FITS standard)
BITPIX = -64: Floating point, double precision
BITPIX = -32: Floating point, single precision
BITPIX = 8: Unsigned char
BITPIX = 16: Short
BITPIX = 32: Long
BSCALE, BZERO: For integer BITPIX, optionally BSCALE and BZERO can be given. The value represented by each pixel is given by value * BSCALE + BZERO (the defaults are BSCALE = 1 and BZERO = 0)
function bytearray
Returns an array with bitpix = 8 (all pixels are of type unsigned char). bscale will be set to 1.0, bzero to 0.0.

Syntax
result = bytearray(X [, Y [, Z]])

Arguments
X: An integer number specifying the length of the first dimension.
Y: An integer number specifying the length of the second dimension.
Z: An integer number specifying the length of the third dimension.

See also
function fits function shortarray function longarray function floatarray function doublearray function complexarray
function shortarray
Returns an array with bitpix = 16 (all pixels are of type short). bscale will be set to 1.0, bzero to 0.0.

Syntax
result = short(array(X [, Y [, Z]])

Arguments
X: An integer number specifying the length of the first dimension.
Y: An integer number specifying the length of the second dimension.
Z: An integer number specifying the length of the third dimension.

See also
function fits function bytearray function longarray function floatarray function doublearray function complexarray
function longarray
Returns an array with bitpix = 32 (all pixels are of type long). bscale will be set to 1.0, bzero to 0.0.

Syntax
result = longarray(X [, Y [, Z]])

Arguments
X: An integer number specifying the length of the first dimension.
Y: An integer number specifying the length of the second dimension.
Z: An integer number specifying the length of the third dimension.

See also
function fits function bytearray function shortarray function floatarray function doublearray function complexarray
function floatarray
Returns an array with bitpix = -32 (all pixels are of type float).

Syntax
result = floatarray(X [, Y [, Z]])

Arguments
X: An integer number specifying the length of the first dimension.
Y: An integer number specifying the length of the second dimension.
Z: An integer number specifying the length of the third dimension.

See also
function fits function bytearray function shortarray function longarray function doublearray function complexarray
function doublearray
Returns an array with bitpix = -64 (all pixels are of type double).

Syntax
result = doublearray(X [, Y [, Z]])

Arguments
X: An integer number specifying the length of the first dimension.
Y: An integer number specifying the length of the second dimension.
Z: An integer number specifying the length of the third dimension.

See also
function fits function bytearray function shortarray function longarray function floatarray function complexarray
function complexarray
Returns an array with bitpix = -128 (all pixels are of type complex). !!! WARNING: bitpix = -128 does NOT conform to the FITS standard !!!

Syntax
result = complexarray(X [, Y [, Z]])

Arguments
X: An integer number specifying the length of the first dimension.
Y: An integer number specifying the length of the second dimension.
Z: An integer number specifying the length of the third dimension.

See also
function fits function bytearray function shortarray function longarray function floatarray function doublearray
function shrink
Shrinks X by specified FACTOR

Syntax
result = shrink(X, FACTOR)

Arguments
X: A matrix.
FACTOR: An integer number.
function getfitskey
Returns the value of specified FITS key in the header of X. The returned type can be either a string, an integer number or a real number.

Syntax
result = getfitskey(X, KEY)

Arguments
X: A matrix or a FITS file.
KEY: A string.
function polyfit
Returns a N-th order polynomial fit to X. X must be 1-dimensional. The function returns a vector of size (N+1)*2. The fittet polynomial has the following form:
   f(x) = a0 + a1 * x + ... + aN * X^N
The values a0, ..., aN are returned in the first N elements of the returned vector, their respective errors in the elements N+1...2*N.

Syntax
result = polyfit(X, N [, CHISQ])

Arguments
X: A vector.
N: An integer number.
CHISQ: If set to a named variable, the variable is overwritten with the chi-squared of the fit.
function sprintf
RETURNS X (either a real number or an integer) as a string using specified format string. The formatting is done like in the C printf function. The total length of the formatted string is limited to 256 characters.

Syntax
result = sprintf(FORMAT, X)
function photometry
Perform aperture photometry on X. This function returns a 3xn matrix with the following information: measured counts, normalized counts (Jansky), magnitude.

Syntax
result = photometry(X, POSLIST, REFLIST, SEARCHBOX, RADIUS, [,/u | /b | /v | /r | /i | /j | /h | /k | /l | /m | /n])

Arguments
X: The image on which to do aperture photometry
POSLIST: A 2xn matrix containing the positions of the stars
REFLIST: A 1xm matrix containing magnitudes of reference stars (in the same order as in poslist), with a value > 20.0 if not to be used
SEARCHBOX: Within a box with this radius the local maximum of the stars are searched
RADIUS: The radius of the circular aperture used for photometry

Switches
/u: Do photometry for U-Band
/b: Do photometry for B-Band
/v: Do photometry for V-Band
/r: Do photometry for R-Band
/i: Do photometry for I-Band
/j: Do photometry for J-Band
/h: Do photometry for H-Band
/k: Do photometry for K-Band (default)
/l: Do photometry for L-Band
/m: Do photometry for M-Band
/n: Do photometry for N-Band
function transcoords
Transform a set of coordinates from one image to another. The coordinate transformation matrix is described by a first order polynomial if the number of reference sources is < 6, else a second order polynomial is used. The transformation function will be calculated using a least squares fit to given coordinates. Note that if either in REFSTARS or in IMSTARS a coordinate is exactly (-1, -1), this star will not be used to calculate the transformation matrix.

Syntax
result = transcoords(MASTERLIST, REFSTARS, IMSTARS [, xerror, yerror])

Arguments
MASTERLIST: A matrix 2xn with the coordinates to be transformed
REFSTARS: A matrix 2xm (m >= 3) with positions of the reference stars in the reference frame (= masterlist)
IMSTARS: A matrix 2xm (same size as REFSTARS) with the positions of the same stars in the image to be transformed.
xerror: If set to a named variable, the residual error of the coordinate transform in the first axis is returned.
yerror: If set to a named variable, the residual error of the coordinate transform in the second axis is returned.
function findfile
Returns all files that satisfy given PATTERN. All occurences of \ are replaced by /. Also, a / is appended to all directories. The search is started from the corrent directory and is done recursively through the directory structure.

Syntax
result = findfile(PATTERN)

Arguments
PATTERN: A string.

Examples
Find all text files (files with the suffix .txt) from the current working directory:
   print findfile("*.txt")

See also
function dir function fileexists
function markpos
Mark positions using saoimage. The positions are returned as a 2xn matrix, where n denotes the number of positions marked. Pressing the key 'q' will quit marking positions.

Syntax
result = markpos(X [, int radius] [, /nocenter])

Arguments
X: The image to be displayed on saoimage
radius: Optional, the radius around which the brightest pixel is searched for

Switches
nocenter: Return positions as marked, and do not search for local maximum

See also
function saomark
function lmst
Calculate the local mean siderial time for given Julian date. If longitude is given (east negative), the local mean sidereal time for that location is returned, else the lmst for Greenwich (longitude 0). NOTE that timezones for given longitude are not taken into account, so always give jd in Universal Time.

Syntax
result = lmst(JD [, LATITUDE])

Arguments
JD: A real number.
LATITUDE: A real number.

See also
function jd
function wsa
Compute weighted shift-and-add of the fits cube X (must be a file). The shift location is defined by xcen, ycen. thresh gives the fraction of the maximum pixel which will be regarded as a speckle. speckles determines the maximum number of speckles used (if there are more, then the image will be smoothed until it is not exceeded). smooth optionally gives the fwhm of a gaussian with which the image where speckles are searched for is smoothed. If bigmask is given, the centroid of mask will be shifted to the centroid of bigmask for each individual image.

Syntax
result = wsa(X, XCENTER, YCENTER, THRESHOLD, SPECKLES, SMOOTH, SKY, FLAT, DPL, MASK, BIGMASK)

Arguments
X: A FITS filename (enclosed in single quotes).
XCENTER: An integer number specifying the shift position in the first dimension.
YCENTER: An integer number specifying the shift position in the second dimension.
THRESHOLD: A real number.
SPECKLES: An integer number.
SMOOTH: An integer number.
SKY: A matrix.
FLAT: A matrix.
DPL: A matrix.
MASK: A matrix.
BIGMASK: A matrix.
function swsa
Compute weighted shift-and-add of the fits cube X (must be a file). flags is a 1-dimensional array that has a value of zero for each image that is to be skipped. The shift location is defined by xcen, ycen. thresh gives the fraction of the maximum pixel which will be regarded as a speckle. speckles determines the maximum number of speckles used (if there are more, then the image will be smoothed until it is not exceeded). smooth optionally gives the fwhm of a gaussian with which the image where speckles are searched for is smoothed. If bigmask is given, the centroid of mask will be shifted to the centroid of bigmask for each individual image.

Syntax
result = wsa(X, FLAGS, XCENTER, YCENTER, THRESHOLD, SPECKLES, SMOOTH, SKY, FLAT, DPL, MASK, BIGMASK)

Arguments
X: A FITS filename (enclosed in single quotes).
FLAGS: A vector.
XCENTER: An integer number specifying the shift position in the first dimension.
YCENTER: An integer number specifying the shift position in the second dimension.
THRESHOLD: A real number.
SPECKLES: An integer number.
SMOOTH: An integer number.
SKY: A matrix.
FLAT: A matrix.
DPL: A matrix.
MASK: A matrix.
BIGMASK: A matrix.
function centroids
Returns a 2xn matrix with the centroids (in a RADIUS) on given POSITIONS in X.

Syntax
result = centroids(X, POSITIONS, RADIUS)

Arguments
X: A matrix.
POSITIONS: A 2xn matrix with initial positions.
RADIUS: An integer number.

See also
function maxima
function maxima
Refind local maxima in X given POSITIONS around RADIUS.

Syntax
result = maxima(X, POSITIONS, RADIUS [, /circle, /box])

Arguments
X: A matrix.
POSITIONS: A 2xn matrix with initial positions.
RADIUS: An integer number.

Switches
/circle: Local maxima are searched for within a circle with RADIUS
/box: Local maxima are search for within a quadratic box with RADIUS

See also
function centroids
function fileexists
Test for existance of a file. Returns 1 if the file exist, 0 otherwise.

Syntax
result = fileexists(FILENAME)

Arguments
FILENAME: A string.

See also
function findfile function dir function filesize
function filesize
Return the length in bytes of a file. Returns -1 if the file does not exist.

Syntax
result = filesize(FILENAME)

Arguments
FILENAME: A string.

See also
function findfile function dir function fileexists
function dir
Return a directory listing.

Syntax
result = dir([DIRECTORY], [, /recursive])

Arguments
DIRECTORY: Optional, do a directory listing of specified directory, else of the current working directory

Switches
/recursive: Do a recursive listing

Examples
To print a recursive listing of the current directory, type
   print dir("", /recursive)

See also
function findfile function filesize function fileexists
function polyfitxy
Return an n-th order polynomial fit to the vectors X and Y, where y = f(x). If a variable is given as the 4th argument, it will be overwritten with the chi squared of the fit.

Syntax
result = polyfitxy(X, Y, N [, CHISQ])

Arguments
X: A vector.
Y: A vector.
N: An integer number.
CHISQ: If set to a named variable, the variable is overwritten with the chi-squared of the fit.
function sort
Returns an index list of X in ascending order.

Syntax
result = sort(X [, /reverse])

Arguments
X: A matrix, a string or a string array.

Switches
/reverse: The index list will be in descending order

Examples
To sort a directory listing in alphabetical order, type:
   list = dir("/tmp"); list = list[sort(list)]
function char
Returns the ASCII character which number is N. N is truncated to the range 0...255.

Syntax
result = char(N)

Arguments
N: An integer number.

Examples
To print out the ASCII character set, type:
   for (i = 32; i < 256; i++) print char(i)
function complex
Returns a complex number generated of the two given values.
syntax
result = complex(r, i)

Arguments
r: The real part (either a real number or a matrix)
i: the imaginary part (either a real number or a matrix)

See also
function real function imag function conj function arg function abs
function strpos
Returns the position of a substring within a string, or -1 if the substring does not occur. If the first argument is a string array, a matrix with the same number of elements as the string is returned.

Syntax
result = strpos(X, Y)

Arguments
X: A string or a string array
Y: The substring to be searched for

Switches
/nocase: The search is done case-insensitive
function clean
Performs "cleaning" of the input image. This iterative deconvolution algorithm searches for the global maximum in the image, shifts to psf to that position and subtracts a scaled psf (multiplied by the gain). The subtracted flux is added to a delta map at the position of the maximum (this is the clean map). Note that clean does not conserve the total flux in the image.

Syntax
result = clean(IMAGE, PSF, N, GAIN [, variable SUB])

Arguments
IMAGE: input map to be cleaned (dirty map)
PSF: Point spread function (dirty beam)
N: Number of iterations
GAIN: Loop gain factor
SUB: Optional, the variable SUB will contain an image in which the sources are subtracted

See also
function lucy function wien
function collapse
Collapse one axis of an array. All values along the specified axis will be summed up. The resulting array will have one dimension less than the input.

Syntax
result = collapse(IMAGE, AXIS)

Arguments
IMAGE: A matrix.
AXIS: An integer number.

Examples
Do a sum of all images in a datacube:
   s = collapse(cube, 3)
This is exactly the same as:
   s = cubeavg(cube) * naxis3(cube)

See also
function cubeavg
function magnify
Resize given array by the scaling factor. Each pixel in the resized array will be blown up and consequently contain scale^2 pixels. The optional argument smooth gives the fwhm of a gaussian with which the resultant array will we smoothed. The total flux in the array will be conserved.

Syntax
result = magnify(IMAGE, scale [, fwhm])

Arguments
IMAGE: A matrix
scale: An integer number.
fwhm: A real number.
function wsastat
Compute statistics for the weighted shift-and-add of the fits cube X (must be a file). The shift location is defined by xcen, ycen. thresh gives the fraction of the maximum pixel which will be regarded as a speckle. speckles determines the maximum number of speckles used (if there are more, then the image will be smoothed until it is not exceeded). smooth optionally gives the fwhm of a gaussian with which the image where speckles are searched for is smoothed. If bigmask is given, the centroid of mask will be shifted to the centroid of bigmask for each individual image.

Syntax
result = wsastat(X, XCENTER, YCENTER, THRESHOLD, SPECKLES, SMOOTH, SKY, FLAT, DPL, MASK, BIGMASK)

Arguments
X: A FITS filename (enclosed in single quotes).
XCENTER: An integer number specifying the shift position in the first dimension.
YCENTER: An integer number specifying the shift position in the second dimension.
THRESHOLD: A real number.
SPECKLES: An integer number.
SMOOTH: An integer number.
SKY: A matrix.
FLAT: A matrix.
DPL: A matrix.
MASK: A matrix.
BIGMASK: A matrix.
function polyfitxyerr
Return an n-th order polynomial fit to the vectors X and Y, where y = f(x). The typical error of the dependent variables is given in ERROR. If a variable is given as the 4th argument, it will be overwritten with the chi squared of the fit.

Syntax
result = polyfitxy(X, Y, N, ERROR [, CHISQ])

Arguments
X: A vector.
Y: A vector.
N: An integer number.
ERROR: The error of the X-values. If this is a real number, all X-values are assumed to have the same error. If ERROR is a vector, it must have the same length as X and Y and gives the error or each individual X value.
CHISQ: If set to a named variable, the variable is overwritten with the chi-squared of the fit.

See also
function polyfitxy
function psf
Return the average (or median, minimum, maximum) of several stars in an image. The stars locations are given in the second argument.

Syntax
result = psf(X, POSITIONS [, /median] [, /average] [, /minimum] [, /maximum])

Arguments
X: A matrix.
POSITIONS: A 2xn matrix giving the positions of the stars to be averaged.

Switches
/median: Return the median of the stars.
/average: Return the average of the stars (default).
/minimum: Return the minimum of the stars.
/maximum: Return the maximum of the stars.
function pwd
Return the absolute path of the current directory.

Syntax
result = pwd()

Arguments
none

Returns
A string with the absolute path of the current directory.

See also
function dir procedure cd
function quickgauss
Create a circular gaussian.

Syntax
result = quickgauss(X, Y, FWHM, speed [, naxis1=value] [, naxis2=value])

Arguments
X: The center of the gaussian in the x-axes
Y: The center of the gaussian in the y-axes
FWHM: Full-width at half maximum of the circular gaussian
speed: The gaussian is calculated up to a distance of speed*FWHM from the center location
naxis1=value: Optional, the size of the resulting array in the first dimension
naxis2=value: Optional, the size of the resulting array in the second dimension

Returns
A two-dimensional circular gaussian.

See also
function gauss
function getenv
Return the content of an environment variable.

Syntax
result = getenv(S)

Arguments
S: A string with the name of the environment variable.

Returns
A string with the content of the environment variable. If the environment variable does not exist, an empty string is returned.

See also
procedure setenv
function cblank
Replace all undefined values (like NaN or Inf) by another value. If no value is specified, 0.0 will be replaced.

Syntax
result = cblank(ARRAY [, value])

Arguments
ARRAY: A matrix
value: Optional, the value to be assigned (defaults to 0)

See also
procedure cblank
function now
Return the julian date of the current system time. The timezone (and daylight saving time, if appropriate) are taken into account.

Syntax
result = now()

Arguments
none

See also
function jd function calday
function polar
Returns a complex number generated of the two given values in polar representation. This is equivalent to complex(a * cos(b), a * sin(b)).
syntax
result = complex(ampl, arg)

Arguments
ampl: The amplitude (either a real number or a matrix)
arg: The argument (either a real number or a matrix)

See also
function complex function real function imag function conj function arg function abs