a.abs
SYNTAX:
a.abs inArray = outArray
FUNCTION:
Calculates the absolute value of elements of the input Array to produce
the output Array. The absolute value of each component of the input is
calculated for the vector data types.
EXAMPLE:
# create a two-dimensional Array
a.tilt 100 100 0.0 0.1 0.2 = plane
# find the sine of each element
a.sin plane = fringes
# find the absolute value
a.abs fringes = humps
a.acos
SYNTAX:
a.acos inArray = outArray
FUNCTION:
Calculates the arc cos of the elements of the input Array to produce the
output Array. This only makes sense for scalar and complex data types.
The output Array will be of type "f" or "d" for scalar input, and it will
be of type "com" for complex input. The output is in radians.
EXAMPLE:
# create a two-dimensional Array
a.tilt 100 100 0.0 0.1 0.2 = pdata
# find the cosine of each element
a.cos pdata = fringes
# find the arc-cosine
a.acos fringes = ramps
a.add
SYNTAX:
a.add array1 array2 ... arrayN = sum Array
FUNCTION:
Adds the elements of the input arrays together to produce the
output Array.
EXAMPLE:
# load files into arrays
a.tilt 10 10 0 1 10 = arrayA
a.tilt 10 10 0 10 100 = arrayB
# add the arrays
a.add arrayA arrayB = arrayC
a.amp
SYNTAX:
a.amp inArray = outArray
FUNCTION:
Returns the amplitude (square root of sum of the squares of real and
imaginary parts) of the input Array. The input data must be COMPLEX.
The returned Array will have the same number of columns, rows, etc., as
the input Array. See also a.arg.
EXAMPLE:
# create a flat 128x128 Array initialized to zero
a.flat 32 32 0.0 = flat
# create a 10x10 square Array and insert into the center of flat
a.flat 10 10 1 = block
a.ins block flat 14 14 = hat
# find the forward FFT
a.fft hat "f" = out
# find its amplitude
a.amp out = ampl
a.arg
SYNTAX:
a.arg inArray = outArray
FUNCTION:
Returns the argument (atan2[imaginary,real]) of the input Array. The
input data must be COMPLEX. The returned Array will have the same
number of columns, rows, etc., as the input Array. See also a.amp.
EXAMPLE:
# create a flat 128x128 Array initialized to zero
a.flat 32 32 0.0 = flat
# create a 10x10 square Array and insert into the center of flat
a.flat 10 10 1 = block
a.ins block flat 14 14 = hat
# find the forward FFT
a.fft hat "f" = out
# find the argument
a.arg out = args
a.asin
SYNTAX:
a.asin inArray = outArray
FUNCTION:
Calculates the arc sin of the elements of the input Array to produce the
output Array. This only makes sense for scalar and complex data types.
The output Array will be of type "f" or "d" for scalar input, and it will
be of type "com" for complex input. The output is in radians.
EXAMPLE:
# create an Array
a.tilt 100 100 0.0 0.1 0.2 = plane
# calculate its sine
a.sin plane = fringes
# Now finds the inverse sine. The values in "ramps" will
# be segments of planes like the data in PLANE, except for
# periodic pi jumps.
a.asin fringes = ramps
a.atan
SYNTAX:
a.atan inArray = outArray
FUNCTION:
Calculates the arc tan of the elements of the input Array to produce the
output Array. This only makes sense for scalar and complex data types.
The output Array will be of type "f" or "d" for scalar input, and it will
be of type "com" for complex input. The output is in radians.
EXAMPLE:
# create an Array
a.tilt 100 100 0.0 0.1 0.2 = plane
# calculate its sine, cosine and ratio
a.sin plane = sfringes
a.cos plane = cfringes
a.div sfringes cfringes = fringes
# Now finds the inverse tangent. The values in "ramps" will
# be segments of planes like the data in PLANE, except for
# periodic pi jumps.
a.atan fringes = ramps
a.ave
SYNTAX:
a.ave Array1 Array2 ... ArrayN = AveArray
FUNCTION:
Returns the average of the input Arrays.
EXAMPLE:
# create an Array
a.tilt 100 100 0.0 0.1 0.2 = plane
# find the sine and cosine of its elements
a.sin plane = sfringes
a.cos plane = cfringes
# now get the average
a.ave cfringes sfringes = fringes
a.avemask
SYNTAX:
a.avemask Array1 Array2 ... ArrayN MaskArray = AveArray
FUNCTION:
Returns the average all elements in the input Arrays weighted
by the elements of the mask Array. For non-scalar data Arrays, the
average of each component weighted by the scalar mask is calculated.
EXAMPLE:
# generate a gaussian blob
a.gauss 400 400 1 200 200 200 200 = bump
# generate a circular disk
a.disk 400 400 1 200 200 200 200 = mask
# takes the average of the
# gaussian over the circular area
a.avemask bump mask = avearray
a.catcol
SYNTAX:
a.catcol array1 array2 ... arrayN = catArray
FUNCTION:
Concatenates the elements of the input Arrays together along their
column dimension to produce the output Array. The output Array will
have the same number of rows, planes, etc., as the input Arrays, but
will have a number of columns equal to the sum of the number of
columns of the input Arrays.
EXAMPLE:
# generateE two 2D arrays with dimensions 2x100 and 4x100, respectively
a.tilt 2 100 0 1 2 = x
a.tilt 4 100 0 2 3 = y
# concatenate them
a.catcol x y = z
# check the number of columns, which should be 6
a.cols z
a.catpln
SYNTAX:
a.catpln array1 array2 ... arrayN = catArray
FUNCTION:
Concatenates the elements of the input Arrays together along their
plane dimension to produce the output Array. The output Array will
have the same number of rows, planes, etc., as the input Arrays, but
will have a number of planes equal to the sum of the number of
planes of the input Arrays.
EXAMPLE:
# generate two 4D arrays
a.tilt 1 2 5 4 0 1 2 3 4 = x
a.tilt 1 2 10 4 0 2 3 4 5 = y
# concatenate
a.catpln x y = z
# check that number of planes is 15
a.plns z
a.catrow
SYNTAX:
a.catrow array1 array2 ... arrayN = catArray
FUNCTION:
Concatenates the elements of the input Arrays together along their
row dimension to produce the output Array. The output Array will
have the same number of rows, planes, etc., as the input Arrays, but
will have a number of rows equal to the sum of the number of
rows of the input Arrays.
EXAMPLE:
# generate two 2D arrays
a.tilt 4 50 0 1 2 = x
a.tilt 4 100 0 2 3 = y
# concatenate rows
a.catrow x y = z
# check that result have 150 rows
a.rows z
a.catslc
SYNTAX:
a.catslc array1 array2 ... arrayN = catArray
FUNCTION:
Concatenates the elements of the input Arrays together along their
slice dimension to produce the output Array. The output Array will
have the same number of rows, planes, etc., as the input Arrays, but
will have a number of slices equal to the sum of the number of
slices of the input Arrays.
EXAMPLE:
# generate two 4D arrays
a.tilt 1 2 3 5 0 1 2 3 4 = x
a.tilt 1 2 3 10 0 2 3 4 5 = y
# concatenate along slice dimension
a.catslc x y = z
# check that result have 15 slices
a.slcs z
a.cols
SYNTAX:
a.cols Array = Cols
FUNCTION:
Returns the number of columns of the input Array.
EXAMPLE:
# generate a 4-dimensional ramp in X with 10 columns,
# 20 rows, 30 planes, and 40 slices
a.tilt 10 20 30 40 0 -1 -2 -3 -4 = x
# verify the number of columns
a.cols x
a.conj
SYNTAX:
a.conj inArray = outArray
FUNCTION:
Returns the complex conjugate of the input Array. The input data must
be COMPLEX. The output Array will have the same number of columns,
rows, etc., as the input Array.
EXAMPLE:
# create a flat 128x128 Array initialized to zero
a.flat 32 32 0.0 = flat
# create a 10x10 square Array and insert in flat
a.flat 10 10 1 = block
a.ins block flat 14 14 = hat
# find the forward FFT
a.fft hat "f" = out
# find the complex conjugate
a.conj out = conj
a.conv
SYNTAX:
a.conv inArray kernArray = outArray
FUNCTION:
Convolves the input Array by the kernel Array and puts the result in the
output Array. The input must have a power of 2 columns and rows. The
kernel Array is not restricted in this way, but must be smaller than
or equal in size to the input Array.
EXAMPLE:
# create a 128x128 Array with all elements equal to zero
a.make 0 128 128 = n
# replace element in column 50, row 60 with 10
a.repele 10 n 50 60 = n
# create a 10x10 Array and initialize all elements to 2
a.make 2.0 10 10 = k
# convolve
a.conv n k = o
# the result should be the product of the sum of n and the sum of k
# i.e. ( 100 * 2 ) * ( 10 ) = 2000
a.sum o
a.copy
SYNTAX:
a.copy inArray = outArray
FUNCTION:
Makes a copy of the input Array to produce the output Array.
EXAMPLE:
# makes a two-dimensional sinc squared function
a.sinc 100 100 1.0 30 40 10 20 = x
# copy the function
a.copy x = y
# subtract copy from original
a.sub x y = z
# check that it is zero
a.ave z
a.cos
SYNTAX:
a.cos inArray = outArray
FUNCTION:
Calculates cos of the elements of the input Array to produce the
output Array. This only makes sense for scalar and complex data types.
The output Array will be of type "f" or "d" for scalar input, and it will
be of type "com" for complex input. The input is assumed to be in units
of radians.
EXAMPLE:
# create a two-dimensional Array
a.tilt 100 100 0.0 0.1 0.2 = pdata
# find the cosine of each element
a.cos pdata = fringes
a.cut
SYNTAX:
a.cut inArray level = outArray
FUNCTION:
Any elements of the input Array that are greater than or equal to the
number "level" are represented by 1 in the output Array. All other
elements are represented by 0 in the output Array. The input must
be scalar.
EXAMPLE:
# create a two-dimensional Array
a.tilt 10 10 0.0 0.1 0.2 = pdata
# find the cosine of each element
a.cos pdata = fringes
# replace elements larger than 0.5 with 1,
# smaller with 0, and print result
a.cut fringes 0.5
a.cutlow
SYNTAX:
a.cutlow inArray level = outArray
FUNCTION:
Any elements of the input Array that are less than the number
"level" are represented by 1 in the output Array. All other
elements are represented by 0 in the output Array. The input must
be scalar.
EXAMPLE:
# create a two-dimensional Array
a.tilt 10 10 0.0 0.1 0.2 = pdata
# find the cosine of each element
a.cos pdata = fringes
# replace elements larger than 0.5 with 0,
# smaller with 1, and print result
a.cutlow fringes 0.5
a.disk
SYNTAX:
a.disk m = NewArray
or nc m cx rx
or nc nr m cx cy rx ry
or nc nr np m cx cy cz rx ry rz
or nc nr np ns m cx cy cz cw rx ry rz rw
FUNCTION:
Generates an Array that is initialized to "m" everywhere inside or on an
ellipse of radius "rx," "ry," etc., and 0.0 outside the ellipse. The number
of dimensions is determined from the number of arguments in the
command line.
EXAMPLE:
# generate a 20x20 2D Array and initialize so that the values
# are -4.0 inside a disk centered at (11.3,19.2) with x radius
# 2.0 and y radius 3.0
a.disk 20 20 -4.0 11.3 19.2 2. 3. = Circ
a.div
SYNTAX:
a.div array1 array2 = quotientarray
FUNCTION:
Divides the elements of "Array2" into the elements of "Array1" to produce
the output Array.
EXAMPLE:
# create two ramps
a.tilt 9 9 .5 1 0 = x
a.tilt 9 9 .5 0 1 = y
# divide their elements
a.div x y = z
a.dotprod
SYNTAX:
a.dotprod inArray1 inArray2 = outArray
FUNCTION:
Calculates the dot product of "inArray1" and "inArray2" and puts
the answer in "outArray." Both Arrays must have the same number
of elements and must be either scalar or COMPLEX.
EXAMPLE:
# create two ramps that represent weights for centroiding
# objects in a 9x9 image.
a.tilt 9 9 .5 1 0 = wx
a.tilt 9 9 .5 0 1 = wy
# creates a blob in "image", centered at (3,4)
a.gauss 9 9 1 3 4 1 1 = image
# calculate the dot product of the blob with the two sets of
# weights and print out the answers.
a.dotprod wx image
a.dotprod wy image
# the dot products should be 3 and 4 times the value of the sum
# of all elements in "image"
a.sum image
a.dump
SYNTAX:
a.dump arrayname
FUNCTION:
Converts an Array called "arrayname" into a string. It is limited
to outputs of less than 10000 characters. Components of each
element of COM or Vector data types are enclosed by <> brackets.
EXAMPLE:
a.tilt 2 3 0 1 10 = x
a.dump x
# the printed values are
(
( 0.00000 1.00000 )
( 10.0000 11.0000 )
( 20.0000 21.0000 )
)
a.exp
SYNTAX:
a.exp inArray = outArray
FUNCTION:
Calculates the exp(x) (e to the power x) of the elements of the input
Array to produce the output Array. This only makes sense of scalar and
complex data types. The output Array will be of the "f" or "d" for
scalar input. a.exp is not yet implemented for COM type.
EXAMPLE:
# This is the hard way to generate a one dimensional gaussian shaped
# lump. First a ramp is generated to represent X coordinate values.
# The X values are then squared and negated. Finally, we calculate
# exp( -X^2[i] ) and save the result in lump.
# generate an Array
a.tilt 100 -4.95 .1 = x2
# find the square
a.sq x2 = x2
# get negative of the square
a.neg x2 = x2 # find the exponent
a.exp x2 = lump
a.exp10
SYNTAX:
a.exp10 inArray = outArray
FUNCTION:
Calculates the exp10(x) (10 to the power x) of the elements of the input
Array to produce the output Array. This only makes sense of scalar and
complex data types. The output Array will be of the "f" or "d" for
scalar input. a.exp10 is not yet implemented for COM type.
EXAMPLE:
# This example creates a 1-dimensional ramp, calculates 10^( x[i] ),
# and then takes the log base 10 of the result. The arrays x and z
# should be the same except for round off error.
a.tilt .10 0 0.1 = x
a.exp10 x = y
a.log10 y = z
# check that x and z are the close
a.sub x z
a.ext
SYNTAX:
a.ext inArray = outArray
or inArray c0 cols = outArray
or inArray c0 r0 cols rows = outArray
or inArray c0 r0 p0 cols rows plns = outArray
or inArray c0 r0 p0 s0 cols rows plns slcs = outArray
FUNCTION:
Extracts a region from "inArray" and puts the result in "outArray." The
number of arguments must match the rank or number of dimensions of the
input Array. The rank and type of the output Array will be the same as
the input Array, and the number of columns, rows, planes, etc., will be
as specified on the command line. The extraction region must lie inside
the input Array.
EXAMPLE:
# This creates a gaussian blob centered in the 20 column 30
# row 40 plane 60 slice Array X, then extracts the middle of
# it from columns 10 to 19 rows 15 to 24 planes 20 to 29 and
# slices 25 to 34.
a.gauss 20 30 40 60 1 10 25 20 25 5 5 5 5 = x
a.ext x 10 15 20 25 10 10 10 10 = s
a.extcol
SYNTAX:
a.extcol inArray column = outArray
FUNCTION:
Extracts one column from "inArray" and puts the result into "outArray."
The number of dimensions of the output Array will be one less than the
number of dimensions of the input Array. It does not make sense to
extract a column from a 0D Array.
EXAMPLE:
# create a gaussian blob centered in x
a.gauss 100 200 1 50 100 10 10 = x
# extract column 50 and place in "c" - will be 1D with 200 columns.
a.extcol x 50 = c
a.extele
SYNTAX:
a.extele inArray col row pln ... = outArray
FUNCTION:
Extracts one element from the input Array at the location specified
by "col," "row," etc. The output will be zero-dimensional with the
same data type as the input Array.
EXAMPLE:
# create a two-dimensional Array
a.tilt 10 10 0. .1 .2 = pdata
# print it
a.dump pdata
# print the element in the 3rd row, 3rd column
a.extele pdata 3 3
a.extpln
SYNTAX:
a.extpln inArray pln = outArray
FUNCTION:
Extracts one plane from "inArray" and puts the result into "outArray."
The number of dimensions of the output Array will be one less than the
number of dimensions of the input Array. It does not make sense to
extract a plane from a 0D, 1D, or 2D Array.
EXAMPLE:
# create a gaussian blob centered in x
a.gauss 20 30 40 60 1 10 25 20 25 5 5 5 5 = x
# extract plane 50 and place it in p - p will be 3D with
# 20 columns, 30 rows and 60 planes.
a.extpln x 20 = p
a.extrow
SYNTAX:
a.extrow inArray row = outArray
FUNCTION:
Extracts one row from "inArray" and puts the result into "outArray."
The number of dimensions of the output Array will be one less than the
number of dimensions of the input Array. It does not make sense to
extract a row from a 0D or 1D Array.
EXAMPLE:
# create a gaussian blob centered in x
a.gauss 100 200 1 50 100 10 10 = x
# extract row 50 and place it in r - r will be 1D with 100 columns.
a.extrow x 50 = r
a.extslc
SYNTAX:
a.extslc inArray slc = outArray
FUNCTION:
Extracts one slice from "inArray" and puts the result into "outArray."
The number of dimensions of the output Array will be one less than the
number of dimensions of the input Array. It does not make sense to
extract a slice from a 0D, 1D, or 2D Array.
EXAMPLE:
# create blob
a.gauss 20 30 40 50 1 10 25 20 25 5 5 5 5 = x
# extract slice 20
# p will be 3D with 20 columns, 30 rows, and 40 planes
a.extpln x 20 = p
a.fft
SYNTAX:
a.fft inArray [f|i] = outArray
FUNCTION:
Calculates the FFT of the input Array and places the result in the
output. The input must be a scalar type or COMPLEX. The output will be
COMPLEX with the same number of columns, rows, etc., as the input. The
number of columns, rows, etc. of the input must be a power of 2. The
forward transform will be performed if the second argument begins with "f"
and the inverse transform will be performed if the argument begins
with "i."
EXAMPLE:
# create a flat 128x128 Array initialized to zero
a.flat 128 128 0.0 = flat
# create a 10x10 square Array and insert into the center of flat
a.flat 10 10 1 = block
a.ins block flat 54 54 = hat
# find the forward FFT
a.fft hat "f" = out
a.fillmask
SYNTAX:
a.fillmask inArray maskArray = outArray
FUNCTION:
This fills in data in "inArray" by interpolation from the surrounding
points to produce data in "outArray." The places where this filling
in operation occurs is indicated by zero values in "maskArray." All
other values will simply be copied from "inArray" to "outArray."
EXAMPLE:
# create a tilted surface
a.tilt 10 10 0 1 2 = surf
# create a mask with few sparse zero values
a.flat 10 10 0 = mask
a.normalnoise mask 1 = mask
a.cut mask -1.7 = mask
# interpolate surf over the places where mask is
# zero
a.fillmask surf mask = out
a.sub surf out = out
# rms should be close to zero
a.rms out
a.flat
SYNTAX:
a.flat [cols rows plns slcs] value = NewArray
FUNCTION:
Generates a new Array with the specified number of columns, rows, planes, and
slices initialized to a particular scalar value.
EXAMPLE:
# create a new Array with 20 columns, 10 rows and five planes
# all elements are initialized to 2.5
a.flat 20 10 5 2.5 = x
a.gauss
SYNTAX:
a.gauss m = NewArray
or nc m cx sx
or nc nr m cx cy sx sy
or nc nr np m cx cy cz sx sy sz
or nc nr np ns m cx cy cz cw sx sy sz sw
FUNCTION:
Generates an Array that is initialized to a multidimensional gaussian.
For example
a.gauss 50 50 7.0 25.2 29.2 5.5 4.5 = Blob
will generate a 50x50 2D Array that is initialized so that the values
are derived from the following formulas:
x = col + 0.5 - 25.2
y = row + 0.5 - 29.2
f(col, row) = 7.0 * exp( -.5*( x*x/(5.5*5.5) + y*y/(4.5*4.5) ) )
The number of dimensions is determined from the number of arguments in
the command line.
EXAMPLE:
# create a new 50 column Array. The initial value of the members of
# the Array will be determined by the equations
# ux = (col-centcolnum)^2/(2*sigcolnum^2)
# z = maxnum * exp( -ux )
a.gauss 50 2 25.5 4. = blob
a.grad
SYNTAX:
a.grad inArray = outArray
FUNCTION:
Calculates the gradient of elements of the input Array to produce the
output Array. The input must be a scalar Array with 1 to 4 dimensions.
The output will be scalar if the input is 1D, VECTOR2 if the input is
2D, VECTOR3 if the input is 3D, and VECTOR4 if the input is 4D.
EXAMPLE:
# make a gaussian profile with a maximum of 17
a.gauss 20 17 53.5 19 = x
# find the gradient
a.grad x = y
a.hist
SYNTAX:
a.hist inArray min binwidth nbins = outArray
or inArray min1 w1 n1 min2 w2 n2 = outArray
or inArray min1 w1 n1 min2 w2 n2 min3 w3 n3 = outArray
or inArray min1 w1 n1 min2 w2 n2 min3 w3 n3 min4 w4 n4 = outArray
FUNCTION:
A histogram of the input Array "inArray" is calculated and the result
is placed in the Array "outArray." The histogram counts how many times
the values of the input fall into various bins. The "nbins" bins
extend from "min" and are each "binwidth" wide. The first form
works with all scalar data types. The output is a 1D Array of integers
representing the number of times the values of the input fall within
the range of each bin. The next form works with COMPLEX and VECTOR2
data types. The two components are histogrammed separately, and the
result is a 2D Array of integers. Similarly, for the last two
versions, the various components are histogrammed separately, and
there is one dimension in the output per component of the input.
EXAMPLE:
# make a gaussian profile with a maximum of 17
a.gauss 100 17 53.5 19 = x
# find histogram
a.hist x 0 1 20 = hgram
a.imag
SYNTAX:
a.imag inArray = outArray
FUNCTION:
Returns the "imag" part of the input Array. The input data must be
COMPLEX. The returned Array will have the same number of columns, rows,
etc., as the input Array. See also a.real. The "imag" and imaginary parts
can be combined into a COMPLEX Array using the command
a.to imagArray imagArray COM = outArray
EXAMPLE:
# create a flat 128x128 Array initialized to zero
a.flat 32 32 0.0 = flat
# create a 10x10 square Array and insert into the center of flat
a.flat 10 10 1 = block
a.ins block flat 14 14 = hat
# find the forward FFT
a.fft hat "f" = out
# find the real and imaginary parts
a.real out = R
a.imag out = I
a.info
SYNTAX:
a.info Array = Info
FUNCTION:
Returns a summary of information about the input Array as a string.
Information includes size of the Array, type of data in the Array,
storage size, and dimensions.
EXAMPLE:
# generate a four dimensional cubical 10x10x10x10 data set that is
# initially zero
a.flat 10 10 10 10 0 = flat
# request information
a.info flat
a.ins
SYNTAX:
a.ins inArray1 inArray2 = outArray
or inArray1 inArray2 c0 = outArray
or inArray1 inArray2 c0 r0 = outArray
or inArray1 inArray2 c0 r0 p0 = outArray
or inArray1 inArray2 c0 r0 p0 s0 = outArray
FUNCTION:
Adds values of "inArray1" to those of "inArray2" at coincident element locations and puts the result
in "outArray." The number of arguments must match the rank or number
of dimensions of the input Arrays. The rank and type of the output
Array will be the same as the input Arrays, and the number of columns,
rows, planes, etc. will be the same as "inArray2." The insertion
region must lie inside "inArray2."
EXAMPLE:
# generate a four-dimensional cubical 10x10x10x10 data set that is
# initially zero
a.flat 10 10 10 10 0 = flat
# create a 2 by 2 by 4 by 6 data set that is initially 1.0
a.flat 2 2 4 6 1 = block
# insert "block" inside "flat" and store in "hat"
a.ins block flat 4 4 3 2 = hat
# there are 96 ones in hat's 10000 elements - the average should be 0.0096
a.ave hat
a.inscol
SYNTAX:
a.inscol inArray1 inArray2 column = outArray
FUNCTION:
Adds values of "inArray1" to those of selected column in "inArray2" and puts the
result in "outArray." The number of dimensions of the first input Array
must be one less than the number of dimensions of the second input
Array. It does not make sense to insert a column of a 0D Array.
EXAMPLE:
# create a 1D Array with 60 elements initialized to -1
a.make -1 10 = x
# make a 2D gaussian blob
a.gauss 10 10 1 30 30 10 10 = y
# insert x at column 3
a.inscol x y 3 = z
a.inspln
SYNTAX:
a.inspln inArray1 inArray2 plane = outArray
FUNCTION:
Adds values of "inArray1" to those of selected plane of "inArray2" and puts the
result in "outArray." The number of dimensions of the first input Array
must be one less than the number of dimensions of the second input
Array. It does not make sense to insert a plane of a 0D, 1D, or 2D,
Array.
EXAMPLE:
# create a 2D Array with 50 columns and 60 rows initialized to 0
a.flat 50 60 0 = x
# make a 3D gaussian blob with 50 columns 60 rows and 70 planes
a.gauss 50 60 70 1 30 30 30 10 10 10 = y
# insert the 2D Array into the 3D Array at plane 35
a.inspln x y 35 = z
a.insrow
SYNTAX:
a.insrow inArray1 inArray2 row = outArray
FUNCTION:
Adds values of "inArray1" to those of selected row of "inArray2" and puts the
result in "outArray." The number of dimensions of the first input Array
must be one less than the number of dimensions of the second input
Array. It does not make sense to insert a row of a 0D or 1D Array.
EXAMPLE:
# create a 1D Array with 50 elements initialized to -1
a.flat 50 -1 = x
# make a 2D gaussian blob with 50 columns and 60 rows
a.gauss 50 60 1 30 30 10 10 = y
# insert the 50 element 1D Array into the 2D Array at row 30
# and store in z
a.insrow x y 30 = z
a.insslc
SYNTAX:
a.insslc inArray1 inArray2 slice = outArray
FUNCTION:
Adds values of "inArray1" to those of selected slice of "inArray2" and puts the
result in "outArray." The number of dimensions of the first input Array
must be one less than the number of dimensions of the second input
Array. It does not make sense to insert a slice of a 0D, 1D, 2D, or
3D Array.
EXAMPLE:
# create a 3D Array with 10 columns 20 rows and 30 slices
# initialized to -1
a.flat 10 20 30 -1 = x
# make a 4D gaussian blob with 10 columns 20 rows 30 planes
# and 16 slices
a.gauss 10 20 30 16 2 5 10 15 8 5 10 15 8 = y
# inserts the 3D Array into the 4D Array at slice 5 and
# put the result in Array
a.insslc x y 5 = z
a.inv
SYNTAX:
a.inv inArray = outArray
FUNCTION:
Calculates 1/x of elements of the input Array to produce the
output Array. This only makes sense for scalar and complex data types.
The output Array will be of type "f" or "d" for scalar input, and it will
be of type "com" for complex input.
EXAMPLE:
# create a two-dimensional gaussian blob
a.gauss 10 10 1. 50 50 20 20 = x
# invert each element
a.inv x = y
# product should yield all ones
a.mul x y
a.lim
SYNTAX:
a.lim inArray level = outArray
FUNCTION:
Any elements of the input Array that are greater than or equal to the
number "level" are replaced by "level" in the output Array. All other
elements are copied to the output Array. The input Array must
be scalar.
EXAMPLE:
# create a 1D ramp
a.tilt 10 0 .1 = x
# replace elements above 0.4 with 0.4
a.lim x 0.4 = y
a.limlow
SYNTAX:
a.limlow inArray level = outArray
FUNCTION:
Any elements of the input Array that are less than the
number "level" are represented by "level" in the output Array.
All other elements are copied to the output Array. The input Array must
be scalar.
EXAMPLE:
# create a 1D ramp
a.tilt 10 0 .1 = x
# replace elements below 0.4 with 0.4
a.limlow x 0.4 = y
a.load
SYNTAX:
a.load filename = arrayname
FUNCTION:
Loads an Array file called "filename" into an internal Array called
"arrayname." The previous contents of "arrayname," if any, are lost.
EXAMPLE:
a.flat 32 32 1.0 = offset
a.save offset "Dark"
a.load "Dark" = dark
a.loadasc
SYNTAX:
a.loadasc filename type = arrayname
FUNCTION:
Loads an ASCII Array file "filename" into an internal Array called
"arrayname" of type "type," where "type" can be one of the following:
c signed 8-bit integer
uc unsigned 8-bit integer
s signed 16-bit integer
us unsigned 16-bit integer
i signed 32-bit integer
ui unsigned 32-bit integer
f 32-bit floating point
d 64-bit floating point
com complex (2-element) 32-bit floating point
v2 2D vector (2-element) 32-bit floating point
v3 3D vector (3-element) 32-bit floating point
v4 4D vector (4-element) 32-bit floating point
The previous contents of "arrayname," if any, are lost.
EXAMPLE:
a.flat 32 32 1.0 = offset
a.saveasc offset "Dark"
# Load data set file "Dark" into symbol DARK
a.loadasc "Dark" = DARK
a.loadbin
SYNTAX:
a.loadbin filename type = arrayname
FUNCTION:
Loads a binary Array file "filename" into an internal Array called
"arrayname" of type "type," where "type" can be one of the following:
c signed 8-bit integer
uc unsigned 8-bit integer
s signed 16-bit integer
us unsigned 16-bit integer
i signed 32-bit integer
ui unsigned 32-bit integer
f 32-bit floating point
d 64-bit floating point
com complex (2-element) 32-bit floating point
v2 2D vector (2-element) 32-bit floating point
v3 3D vector (3-element) 32-bit floating point
v4 4D vector (4-element) 32-bit floating point
The previous contents of "arrayname," if any, are lost.
EXAMPLE:
a.flat 32 32 1.0 = offset
a.savebin offset "Dark"
# Load data set file "Dark" into symbol DARK
a.loadbin "Dark" = DARK
a.log
SYNTAX:
a.log inArray = outArray
FUNCTION:
Calculates the log(x) (log base e) of the elements of the input
Array to produce the output Array. This only makes sense for scalar and
complex data types. The output Array will be of type "f" or "d" for
scalar input and it will be of type "com" for complex input.
EXAMPLE:
# create a 1D ramp
a.tilt 10 0 .1 = x
# find the exponential
a.exp x = y
# now find the log - should yield x back
a.log y = z
a.log10
SYNTAX:
a.log10 inArray = outArray
FUNCTION:
Calculates the log10(x) (log base 10) of the elements of the input
Array to produce the output Array. This only makes sense for scalar and
complex data types. The output Array will be of type "f" or "d" for
scalar input, and it will be of type "com" for complex input.
EXAMPLE:
# create a 1D ramp
a.tilt 10 0 .1 = x
# find the exponential
a.exp10 x = y
# now find the log - should yield x back
a.log10 y = z
a.make
SYNTAX:
a.make constArray = outArray
or constArray cols = outArray
or constArray cols rows = outArray
or constArray cols rows planes = outArray
or constArray cols rows planes slices = outArray
FUNCTION:
Creates a new multidimensional Array with all of its elements set to
the value of the input Array. The type of the output Array will be
the same as the type of the input Array. The number of columns, rows,
etc., is controlled by the input arguments.
EXAMPLE:
# create a 4D Array of type 32-bit floating point with 5 columns 6
# rows 7 planes and 8 slices initialized to zero.
a.make 0 5 6 7 8 = x
a.info x
# create a 128x128 element Array of VECTOR2 type data and
# initialize to <1 2>
a.make "<1 2>" 128 128 = x
a.info x
a.matprod
SYNTAX:
a.matprod inArray1 inArray2 = outArray
FUNCTION:
Performs a matrix-matrix multiply. Both the input Arrays must be
2D and the number of columns of "inArray1" must match the number
of rows of "inArray2." The output will have a number of columns
equal to the number of columns in "inArray2" and a number of rows
equal to the number of rows in "inArray1."
EXAMPLE:
# make a 2x2 matrix with elements ( 1 2; 3 4)
a.tilt 2 2 1 1 2 = x
# make another 2x2 matrix with elements (-2 1; 1.5 -0.5),
# which is the inverse of x
a.to "(-2 1 1.5 -0.5)" f = ix
a.shape ix 2 2 = ix
# multiply the matrices and show the result ( 1 0; 0 1)
a.matprod x ix
a.max
SYNTAX:
a.max Array1 Array2 ... ArrayN = maxArray
FUNCTION:
Returns the maximum element in all of the input arrrays.
EXAMPLE:
# generate a 1D tilted plane
a.tilt 100 0. .1 = plane
# find the maximum
a.max plane
a.maxmask
SYNTAX:
a.maxmask Array1 Array2 ... ArrayN MaskArray = maxArray
FUNCTION:
Returns the maximum element in all of the input Arrays that correspond
to a non-zero element of the mask Array. For Arrays whose elements are
vectors, it returns the element with the smallest euclidean norm.
EXAMPLE:
# make a gaussian profile with a maximum of 17
a.gauss 100 17 53.5 19 = x
# create a set of ones centered in the 100 element Array
a.disk 100 1 50 10 = m
# search for the maximum value in x, limiting the search to where there
# are ones in m. The result should be 17.
a.maxmask x m
a.merge
SYNTAX:
a.merge inArray = outArray
or inArray1 inArray2 = outArray
or inArray1 inArray2 inArray3 = outArray
or inArray1 inArray2 inArray3 inArray4 = outArray
or inArray1 inArray2 inArray3 inArray4 inArray5 = outArray
or inArray1 inArray2 inArray3 inArray4 inArray5 inArray6 = outArray
FUNCTION:
Merges an Array from its component parts. For example, if there are
three input Arrays, a new Array with 3 components of type v3 will be
created. The first input Array has all the first component values,
the second Array has all of the second component values, etc.
Currently there is a maximum of 6 input arrays.
EXAMPLE:
# create two 10-element, 32 bit floating point, 1D Array
a.make 1 10 = x
a.make 2 10 = y
# merge them
a.merge x y = z
# type should be v2
a.type z
# create another 10-element, 1D Array
a.make 3 10 = t
# merge them
a.merge x y t = z
# type should be v3
a.type z
a.min
SYNTAX:
a.min Array1 Array2 ... ArrayN = MinArray
FUNCTION:
Returns the minimum element in all of the input Arrays.
EXAMPLE:
# generate a 1D tilted plane
a.tilt 100 0. .1 = plane
# find the minimum
a.min plane
a.minmask
SYNTAX:
a.minmask Array1 Array2 ... ArrayN MaskArray = MinArray
FUNCTION:
Returns the minimum element in all of the input Arrays that correspond
to a non-zero element of the mask Array. For Arrays whose elements are
vectors, it returns the element with the smallest euclidean norm.
EXAMPLE:
# make a 10x10 Array with all elements equal to 1
a.make 1 10 10 = x
# add noise
a.normalnoise x 1.0 = x
# create a big disk with radius 5 and a small disk with radius 3
# both disks are centered at (5,5)
a.disk 10 10 1 5 5 5 5 = big
a.disk 10 10 1 5 5 3 3 = small
# subtract them to be a mask
a.sub big small = mask
# find the minimum inside the mask
a.minmask x mask
a.mul
SYNTAX:
a.mul array1 array2 ... arrayN = productarray
FUNCTION:
Multiplies the elements of the input arrays together to produce the
output Array.
EXAMPLE:
# create a 1D Array with all elements equal to 2
a.make 2 10 = x
# create a 10x10 Array with all elements equal to 3
a.make 3 10 10 = y
# multiply them
a.mul x y = z
# since each element is 6, average is 6
a.ave z
a.neg
SYNTAX:
a.neg inArray = outArray
FUNCTION:
Calculates the negative of elements of the input Array to produce the
output Array. This only makes sense for the signed data types. The
negative of each component of the input is calculated for the vector
data types.
EXAMPLE:
# create a gaussian lump with 10 elements
a.gauss 10 1 0.5 7.071068 = x
# print the negated elements
a.neg x
a.normalnoise
SYNTAX:
a.normalnoise inArray sigma = outArray
FUNCTION:
Adds normally distributed noise with zero mean and sigma "sigma" to the
data in the input Array and puts the result in the output Array.
EXAMPLE:
# generate a 2D Array
a.tilt 10 10 0 0.25 0.5 = x
# generate poison stats.
a.normalnoise x 0.5 = y
a.plns
SYNTAX:
a.plns Array = Planes
FUNCTION:
Returns the number of planes of the input Array.
EXAMPLE:
# generate a 4-dimensional ramp with 10 columns, 20 rows, 30 planes,
# and 40 slices.
a.tilt 10 20 30 40 0 -1 -2 -3 -4 = x
# check that it has 30 planes
a.plns x
a.rank
SYNTAX:
a.rank Array = Rank
FUNCTION:
Returns the rank or number of dimensions of the input Array.
EXAMPLE:
# generate a 3-dimensional ramp in X with 10 columns, 20 rows, 30 planes.
a.tilt 10 20 30 0 -1 -2 -3 = x
# check that rank is 3
a.rank x
a.real
SYNTAX:
a.real inArray = outArray
FUNCTION:
Returns the real part of the input Array. The input data must be
COMPLEX. The returned Array will have the same number of columns, rows,
etc., as the input Array. See also a.imag. The real and imaginary parts
can be combined into a COMPLEX Array using the command
a.to realArray imagArray COM = outArray
EXAMPLE:
# create a flat 128x128 Array initialized to zero
a.flat 32 32 0.0 = flat
# create a 10x10 square Array and insert into the center of flat
a.flat 10 10 1 = block
a.ins block flat 14 14 = hat
# find the forward FFT
a.fft hat "f" = out
# find the real and imaginary parts
a.real out = R
a.imag out = I
a.rebin
SYNTAX:
a.rebin inArray = outArray
or inArray bincols = outArray
or inArray bincols binrows = outArray
or inArray bincols binrows binplns = outArray
or inArray bincols binrows binplns binslcs = outArray
FUNCTION:
The input Array is rebinned and the result is placed in the output
Array. Each element of the output Array is the average of a
rectangular region of the input Array. The size of the bins is
determined from "bincols," "binrows," etc. The number of bin... arguments
must match the rank of the input Array. The output Array will have
the same number of dimensions as the input Array, but will have
"incols/bincols columns," "inrows/binrows rows," etc.
EXAMPLE:
# create a tilted plane
a.tilt 10 10 0.0 0.1 0.2 = plane
# rebin it
a.rebin plane 2 2 = out
a.rep
SYNTAX:
a.rep inArray1 inArray2 = outArray
or inArray1 inArray2 c0 = outArray
or inArray1 inArray2 c0 r0 = outArray
or inArray1 inArray2 c0 r0 p0 = outArray
or inArray1 inArray2 c0 r0 p0 s0 = outArray
FUNCTION:
Replaces part of "inArray2" with all of "inArray1" and puts the result
in "outArray." The number of arguments must match the rank or number
of dimensions of the input Arrays. The rank and type of the output
Array will be the same as the input Arrays, and the number of columns,
rows, planes, etc.,will be the same as "inArray2." The replacement
region must lie inside "inArray2."
EXAMPLE:
# create two 4D arrays filled with ones
a.flat 10 10 10 10 1 = flat
a.flat 2 2 4 6 0.0 = block
# Insert "block" into "flat" at column 4 row 4 plane 3 slice 2
# The result is a roughly centered 4x4x3x2 hole of 0.0 in a
# 10x10x10x10 field of 1.0.
a.rep block flat 4 4 3 2 = hole
a.repcol
SYNTAX:
a.repcol inArray1 inArray2 column = outArray
FUNCTION:
Replaces one column of "inArray2" with all of "inArray1" and puts the
result in "outArray." The number of dimensions of the first input Array
must be one less than the number of dimensions of the second input
Array. It does not make sense to replace a column of a 0D Array.
EXAMPLE:
# create a 1D Array with 60 elements initialized to 0.
a.flat 60 0 = x
# make a 2D gaussian blob with 50 columns and 60 rows
a.gauss 50 60 1 30 30 10 10 = y
#replace the 60 element 1D Array into the 2D Array at column 30
a.repcol x y 30 = z
a.repele
SYNTAX:
a.repele eleArray inArray col row pln ... = outArray
FUNCTION:
Replaces a single element of "inArray" with the element in "eleArray1"
and puts the result in "outArray." The number of arguments must match the
rank or number of dimensions of "inArray." There must be exactly one
element in "eleArray" of the same data type as "inArray." The rank and
type of the output Array will be the same as "inArray." and the number
of columns, rows, planes, etc., will be the same as "inArray." The
replacement position specified by "col," "row," etc., must lie inside
"inArray."
EXAMPLE:
# make a 2D gaussian blob with 10 columns and 10 rows
a.gauss 10 10 1 30 30 10 10 = y
# check what"s in col 3 row 2
a.extele y 3 2
# replace zero into the column 3 row 2 element of the 2D Array
a.repele 0.0 y 3 2 = z
# check if the element was replaced
a.extele z 3 2
a.reppln
SYNTAX:
a.reppln inArray1 inArray2 plane = outArray
FUNCTION:
Replaces one plane of "inArray2" with all of "inArray1" and puts the
result in "outArray." The number of dimensions of the first input Array
must be one less than the number of dimensions of the second input
Array. It does not make sense to replace a plane of a 0D, 1D, or
2D Array.
EXAMPLE:
# create a 2D Array with 50 columns and 60 rows initialized to 0
a.flat 50 60 0 = x
# make a 3D gaussian blob with 50 columns 60 rows and 70 planes
a.gauss 50 60 70 1 30 30 30 10 10 10 = y
#extract plane 35 and find the average
a.extpln y 35 = tst1
a.ave tst1
# replace the 2D Array into the 3D Array at plane 35
a.reppln x y 35 = z
#check that average is zero
a.extpln z 35 = tst2
a.ave tst2
a.reprow
SYNTAX:
a.reprow inArray1 inArray2 row = outArray
FUNCTION:
Replaces one row of "inArray2" with all of "inArray1" and puts the
result in "outArray." The number of dimensions of the first input Array
must be one less than the number of dimensions of the second input
Array. It does not make sense to replace a row of a 0D or 1D Array.
EXAMPLE:
# create a 1D Array with 50 elements initialized to -1
a.flat 50 -1 = x
# make a 2D gaussian blob with 50 columns and 60 rows
a.gauss 50 60 1 30 30 10 10 = y
# replace the 50 element 1D Array into the 2D Array at row 30
# and store in z
a.reprow x y 30 = z
a.repslc
SYNTAX:
a.repslc inArray1 inArray2 slice = outArray
FUNCTION:
Replaces one slice of "inArray2" with all of "inArray1" and puts the
result in "outArray." The number of dimensions of the first input Array
must be one less than the number of dimensions of the second input
Array. It does not make sense to replace a slice of a 0D, 1D, 2D, or
3D Array.
EXAMPLE:
# create a 3D Array with 10 columns 20 rows and 30 planes
# initialized to -1
a.flat 10 20 30 -1 = x
# make a 4D gaussian blob with 10 columns 20 rows 30 planes
# and 16 slices
a.gauss 10 20 30 16 2 5 10 15 8 5 10 15 8 = y
#check the average of slice 5
a.extslc y 5 = slc5y
a.ave slc5y
# inserts the 3D Array into the 4D Array at slice 5 and
# put the result in Array
a.repslc x y 5 = z
#verify that the average of slice 5 is now -1
a.extslc z 5 = slc5z
a.ave slc5z
a.rms
SYNTAX:
a.rms Array1 Array2 ... ArrayN = AveArray
FUNCTION:
Returns the RMS of the input Arrays. If more than one Array is
specified, the RMS of all elements in all Arrays is returned.
EXAMPLE:
# create a two-dimensional Array
a.tilt 100 100 0.0 0.1 0.2 = plane
# get its sine
a.sin plane = fringes
# find and print the rms value, which should be close
# to 1/sqrt(2)
a.rms fringes
a.rmsmask
SYNTAX:
a.rmsmask Array1 Array2 ... ArrayN MaskArray = AveArray
FUNCTION:
Returns the RMS of the input Arrays weighted by the elements of the mask
Array. For non-scalar data Arrays, it returns the RMS of each
component weighted by the scalar mask. If more than one Array is specified,
the RMS of all elements in the input Arrays, weighted by the elements of
the
mask Array, is returned.
EXAMPLE:
# create a field of uniform gaussian noise with an RMS of 15
a.flat 100 100 0 = x
a.normalnoise x 15 = x
# create a mask which is a 50x50 block of ones inserted in
# a 100x100 Array
a.flat 100 100 0 = mask
a.flat 50 50 1 = block
a.rep block mask 20 20 = mask
# find the rms and print the result, which should be near 15
a.rmsmask x mask
a.rows
SYNTAX:
a.rows Array = Rows
FUNCTION:
Returns the number of rows of the input Array.
EXAMPLE:
# generates a 4-dimensional ramp in X with 10 columns, 20 rows, 30 planes,
and 40 slices
a.tilt 10 20 30 40 0 -1 -2 -3 -4 = x
# print the number of rows
a.rows x
a.save
SYNTAX:
a.save arrayname filename
FUNCTION:
Saves an Array called "arrayname" into an Array file called
"filename." The previous contents of "filename," if any, are lost. Please
be aware that the operating system might buffer the data being saved,
thus delaying the appearance of some data in the file.
EXAMPLE:
a.tilt 10 10 0 1 10 = tilt
# Saves data set DARK in the file "tilt.dat"
a.save tilt "tilt.dat"
a.saveasc
SYNTAX:
a.saveasc arrayname filename
FUNCTION:
Saves an Array called "arrayname" into an ASCII file called
"filename." The previous contents of "filename," if any, are lost.
The operating system might buffer the data being saved. This could
cause files to contain partial data at some times. Also, all data in
the Array is saved as a list of numbers, independently of the geometry
of the Array.
EXAMPLE:
a.flat 100 100 1.0 = DARK
a.normalnoise DARK 10 = DARK
# Saves data set DARK in the file "Background"
a.saveasc DARK "Background"
a.savebin
SYNTAX:
a.savebin arrayname filename
FUNCTION:
Saves an Array called "arrayname" into a binary file called
"filename." The previous contents of "filename," if any, are lost.
The operating system might buffer some of the data being saved,
thus causing a delay in the appearance of data in the file. All data
in the Array is saved as a single list of numbers with no reference
to the geometry of the original Array.
EXAMPLE:
a.flat 100 100 1.0 = DARK
a.normalnoise DARK 10 =DARK
# Saves data set DARK in the file "Background"
a.savebin DARK "Background"
a.set
SYNTAX:
a.set inArray const = outArray
FUNCTION:
Sets all of the elements in the input Array to the same constant value.
The type of the constant value must match the type of the input Array.
The type of the output Array is the same as that of the input Array.
EXAMPLE:
# create a 2D Array and initialize to 0
a.flat 10 10 0 = K
# replace all elements with number 13
a.set K 13 = K
# find the minimum, average and maximum - all of
# which should be 13
a.min K
a.ave K
a.max K
a.shape
SYNTAX:
a.shape inArray = outArray
or inArray cols = outArray
or inArray cols rows = outArray
or inArray cols rows planes = outArray
or inArray cols rows planes slices = outArray
FUNCTION:
Reshapes the input Array to the specified number of columns, rows,
planes, and slices, and puts the result into the output Array. The
number of elements in the input Array must agree with the product of
"cols," "rows," "planes," and "slices." The type of the output Array is the same as that of the input Array.
EXAMPLE:
# creates a 1-dimensional Array with 10000 columns, or 10000 elements
a.tilt 10000 0 5 = x
# converts it to a 4-dimensional Array with 10 columns 10 rows 10 planes
# and 10 slices
a.shape x 10 10 10 10 = y
a.shotnoise
SYNTAX:
a.shotnoise inArray = outArray
FUNCTION:
Each element in the input Array is considered to be the mean value of a
Poisson distribution. A random number of events with a Poisson
distribution is generated for each element in the input Array controlled
by the mean value of that element. The number of events for each element
is placed in the output Array.
EXAMPLE:
# generate a 2D Array
a.tilt 10 10 0 0.25 0.5 = x
# generate poison stats.
a.shotnoise x = y
a.sin
SYNTAX:
a.sin inArray = outArray
FUNCTION:
Calculates sin of the elements of the input Array to produce the
output Array. This only makes sense for scalar and complex data types.
The output Array will be of type "f" or "d" for scalar input, and it will
be of type "com" for complex input. The input is assumed to be in units
of radians.
EXAMPLE:
# create an Array
a.tilt 100 100 0.0 0.1 0.2 = plane
# calculate its sine
a.sin plane = fringes
a.sinc
SYNTAX:
a.sinc m = NewArray
or nc m cx sx
or nc nr m cx cy sx sy
or nc nr np m cx cy cz sx sy sz
or nc nr np ns m cx cy cz cw sx sy sz sw
FUNCTION:
Generates an Array that is initialized to a multidimensional sinc
squared. The number of dimensions is determined from the number of
arguments in the command line. "nc," "nr," "np," and "ns" represent
the number of columns, rows, planes, and slices, respectively. "m"
stands for the magnitude of the center of the sinc. "cx," "cy," "cz,"
and "cw" are the row, column, plane.
EXAMPLE:
# generate a 50x50 2D Array that is initialized so that the values
# are derived from the following formulas:
# x = PI * (col + 0.5 - 25.2) / 5.5
# y = PI * (row + 0.5 - 29.2) / 4.5
# f(col,row) = 7.0 * [sin(x)/x]^2 * [sin(y)/y]^2
a.sinc 50 50 7.0 25.2 29.2 5.5 4.5 = Blob
a.slcs
SYNTAX:
a.slcs Array = Slices
FUNCTION:
Returns the number of slices of the input Array.
EXAMPLE:
# generate a 4-dimensional ramp in X with 10 columns, 20 rows,
# 30 planes, and 40 slices.
a.tilt 10 20 30 40 0 -1 -2 -3 -4 = x
# print the number of slices, which should be 40
a.slcs x
a.smo
SYNTAX:
a.smo inArray = outArray
FUNCTION:
Smoothes the scalar input Array by convolution with a box filter and
returns the smoothed result in the output Array. The input and output
Arrays will be the same size. For 1D Arrays, the smooth is performed
with a 3-element box. For 2D Arrays, the smooth is performed with a
3x3-element box. Higher dimensional smoothes are not yet supported.
EXAMPLE:
# create a 2D Array and initialize to 0
a.flat 100 100 0 = x
# replace one element with a 1
a.repele 1 x 50 50 = x
# smooth
a.smo x = y
# print some interesting information
# sum should be unchanged
a.sum x
a.sum y
# maximum should be 1/9
a.max x
a.max y
a.split
SYNTAX:
a.split inArray = outArray
or inArray = outArray1 outArray2
or inArray = outArray1 outArray2 outArray3
or inArray = outArray1 outArray2 outArray3 outArray4
or inArray = outArray1 outArray2 outArray3 outArray4 outArray5
or inArray = outArray1 outArray2 outArray3 outArray4 outArray5 outArray6
FUNCTION:
Splits an Array into its component parts. For example, if an Array has
two components per element, such as types v2 or com, the version of the
command with two output Arrays will generate two new Arrays with the
same dimensionality as the input. However, the first Array will have the
first component of the input, and the second Array will have the second
component.
EXAMPLE:
# create a 2D Array of VECTOR4, initialized to (1, 2, 3, 4)
a.make "<1 2 3 4>" 10 10 = x
# split the Array into four arrays
a.split x = a b c d
a.sq
SYNTAX:
a.sq inArray = outArray
FUNCTION:
Calculates the square of elements of the input Array to produce the
output Array. This only makes sense for scalar and complex data types.
The output Array will be of type "f" or "d" for scalar input, and it will
be of type "com" for complex input.
EXAMPLE:
# generate a tilted plane
a.tilt 10 10 -0.5 0.1 0.2 = x
# find the square root
a.sq x = y
a.sqrt
SYNTAX:
a.sqrt inArray = outArray
FUNCTION:
Calculates the square root of elements of the input Array to produce the
output Array. This only makes sense for scalar and complex data types.
The output Array will be of type "f" or "d" for scalar input, and it will
be of type "com" for complex input. For scalar data it returns the
positive root of each value. For complex data it returns the root with
the positive real part.
EXAMPLE:
# generate x and y tilted planes
# adjust so that the line where the plane crosses zero goes
# through the center of the 101x101 data sets
a.tilt 101 101 -50 1 0 = xplane
a.tilt 101 101 -50 0 1 = yplane
# square and add together to form a data set with values z =
# x^2+y^2.
a.sq xplane = xplane
a.sq yplane = yplane
a.add xplane yplane = para
# generate a conical data set
a.sqrt para= cone
a.sub
SYNTAX:
a.sub array1 array2 = diffarray
FUNCTION:
Subtracts the elements of "array2" from the
elements of "array1" to produce
the output Array.
EXAMPLE:
#create two arrays
a.tilt 10 10 0 1 10 = A
a.tilt 10 10 0 2.0 20.0 = B
# substract
a.sub A B = C
a.sum
SYNTAX:
a.sum Array1 Array2 ... ArrayN = SumArray
FUNCTION:
Returns the sum of all elements in the input Arrays.
EXAMPLE:
# load data from files
a.flat 4 4 1 = A
a.flat 4 4 2 = B
# add. Should be 48
a.sum A B
a.summask
SYNTAX:
a.summask Array1 Array2 ... ArrayN MaskArray = SumArray
FUNCTION:
Returns the sum of all of the elements in the input Arrays weighted by
the elements of the mask Array. For non-scalar data Arrays, it returns
the sum of each component weighted by the scalar mask.
EXAMPLE:
# generate a gaussian function in X with a sigma of 100
a.gauss 1000 1 500 100 = x
# creates a mask in MASK which includes only the first half of the
# elements of X
a.flat 1000 0 = mask
a.flat 500 1 = block
a.rep block mask 0 = mask
# print out the sum of the values of X under the mask
# The result should be 100*sqrt(pi/2).
a.summask x mask
a.tan
SYNTAX:
a.tan inArray = outArray
FUNCTION:
Calculates tan of the elements of the input Array to produce the
output Array. This only makes sense for scalar and complex data types.
The output Array will be of type "f" or "d" for scalar input, and it will
be of type "com" for complex input. The input is assumed to be in units
of radians.
EXAMPLE:
# create an Array
a.tilt 8 0 [expr 3.1416/8] = hmoon
# calculate its tangent
a.tan hmoon
a.tilt
SYNTAX:
a.tilt [cols rows plns slcs] s [scols srows splns slcs] = NewArray
FUNCTION:
Generates a new Array with the specified number of columns, rows, planes, and
slices initialized to a linear function of the coordinates.
EXAMPLES:
# create a 100 column Array. The Array elements
# are initialized according to the expression:
# z(col) = s + col * scols
a.tilt 100 0.0 0.5 = xaxis
# create a 100x100 planar Array and assigns symbol "plane" to it. The Array
# element values are given by
# z(col,row) = s + col * scols + row * srows
a.tilt 100 100 0.0 0.1 0.2 = plane
a.to
SYNTAX:
a.to Array type = NewArray
or RealArray ImagArray COM = NewArray
or XArray YArray V2 = NewArray
or XArray YArray ZArray V3 = NewArray
or X0Array Y0Array DxArray DyArray = NewArray
or X1Array X2Array X3Array X4Array X5Array V5 = NewArray
or XArray YArray X0Array Y0Array DxArray DyArray V6 = NewArray
FUNCTION:
Converts the data in "Array" to the specified type and writes the
"ui," result to "NewArray." Single component data types "c," "uc," "s," "us,"
"i," "f," and "d" are freely convertible except for truncation errors. The
conversion of single component types preserves the dimensionality of the
input Array. Single-file, single-component conversion to multi-component
data types such as com, v2, v3, and v4 results in an output file with one
dimension and a number of elements that is equal to the number of
elements in the input divided by the number of components in the output.
Conversion of multi-component data types to single component results
in a one-dimensional Array of scalars with a length equal to the number of
elements in the input times the number of components.
The routine "preshape" can be used to change the dimensionality
of the output.
The last six forms of this command allow conversion to the multi-
component types from multiple data files representing the individual
components.
EXAMPLE:
# Create an Array
a.to "(0 1 2 3 4 5)" i = X
# convert to 32 bit floating point, and puts the result in Y.
a.to X "f" = Y
# create a two-dimensional Array with 4 columns and 100 rows
a.tilt 4 100 0 1 0 = TWOD
# convert it to a one dimensional Array of VECTOR4 with 100 element
a.to TWOD "V4" = VEC3
#Create an Array of type COM with a single element
a.to "<1 2i>" COM = complex
a.transform
SYNTAX:
a.transform inArray nc coefArray = outArray
or inArray nc nr coefArray = outArray
FUNCTION:
Linearly transforms the data in "inArray" and puts the result in
"outArray." The size of "outArray" will be nc if "inArray" is 1D,
or it will be "nc" by "nr" if "inArray" is 2D. The transformation is
controlled by "coefArray." For a 1D transformation, it must contain
three numbers A, B, C--used as follows:
xout = A * ( xin - B ) + C
For a 2D transformation, it must contain eight numbers
A11 A12 B1 C1
A21 A22 B2 C2
used as follows:
xout = A11 * ( xin - B1 ) + A12 * ( yin - B2 ) + C1
yout = A21 * ( xin - B1 ) + A22 * ( yin - B2 ) + C2
The input must be scalar, and the output will always be FLOAT.
EXAMPLE:
# create an Array with 8 elements initialized to zero
a.flat 8 0 = COEFS
# Replace coefficients A11, A22, B2 and C2
a.repele 1 COEFS 0 = COEFS
a.repele 2 COEFS 5 = COEFS
a.repele 0.5 COEFS 6 = COEFS
a.repele -0.5 COEFS 7 = COEFS
# create tilted plane
a.tilt 10 10 0 1 2 = x
a.transform x 10 10 COEFS = y
a.translate
SYNTAX:
a.translate inArray nx dx = outArray
or inArray nx ny dx dy = outArray
FUNCTION:
Translates the data in the input Array and puts the result in the output
Array. The size of the output Array will be "nc" columns if the input is
1D, or it will be "nc" columns by nr rows if the input is 2D. The
amount to translate is "dx" or "dx,dy." The input must be scalar, and
the output will always be FLOAT.
EXAMPLE:
# create a 2D Array with values that increase by one in the x direction
# and 10 in the y direction.
a.tilt 10 10 0 1 10 = x
# translates this Array 1 element to the left and 2 elements down.
a.translate x 10 10 -1 2 = y
# The top two rows and the right most column of the output y should
# be zero, .
a.dump y
a.type
SYNTAX:
a.type Array = Type
FUNCTION:
Returns the type of the input Array as a string. The type will be
one of the following string:
NONE
DT_CHAR signed 8-bit integer
DT_UCHAR unsigned 8-bit integer
DT_SHORT signed 16-bit integer
DT_USHORT unsigned 16-bit integer
DT_INT signed 32-bit integer
DT_UINT unsigned 32-bit integer
DT_FLOAT 32-bit floating point
DT_DOUBLE 64-bit floating point
DT_COMPLEX complex (2-element) 32-bit floating point
DT_VECTOR2 2D vector (2-element) 32-bit floating point
DT_VECTOR3 3D vector (3-element) 32-bit floating point
DT_VECTOR4 4D vector (4-element) 32-bit floating point
DT_VECTOR5 5D vector (5-element) 32-bit floating point
DT_VECTOR6 6D vector (6-element) 32-bit floating point
EXAMPLE:
# Create a new 100 column 1D Array of type VECTOR3.
a.make "<1 2 3>" 100 = x
# It then prints out the type as "v3 (3D vector)".
a.type x
a.uniformnoise
SYNTAX:
a.uniformnoise inArray width = outArray
FUNCTION:
Adds uniformly distributed noise with zero mean and total width
"width" to the data in the input Array and puts the result in the output
Array.
EXAMPLE:
#Generate a 1D Array
a.tilt 100 0 0.1 = x
#add noise
a.uniformnoise x 0.5 = y
#display
pd.new pd ; pd.set.y.Array x ; pd.add.y.Array y
a.v2toxy
SYNTAX:
a.v2toxy inArray = outArrayX outArrayY
FUNCTION:
Splits the "x" and "y" components of the VECTOR2 input Array into separate
output Arrays "outArrayX" and "outArrayY." The rank and shape of the
input Array is preserved in both of the output Arrays. The output
Arrays will be of type FLOAT. See also a.xytov2.
EXAMPLE:
# creates two 2D arrays in X and Y which are 30 by 30. The first is
# initialized to -5, the second to 17.
a.flat 30 30 -5 = x
a.flat 30 30 17 = y
# combine into two-dimensional Array of VECTOR2
a.xytov2 x y = z
# average value should be (-5,17)
a.ave z
# split vector
a.v2toxy z = a b
# a should be identical to x
a.ave a
# b should equal y
a.ave b
a.v2v2tov4
SYNTAX:
a.v2v2tov4 inArrayXY inArrayDXDY = outArray
FUNCTION:
Uses "inArrayXY" as the first two components and "inArrayDXDY" as the
second two components and patches them together to create a VECTOR4
output Array. The data types of the input Arrays must be VECTOR2. The
rank and shape of both input Arrays must be the same and are preserved
in the output Array. See also a.v4tov2v2.
EXAMPLE:
# create two 1D arrays with 60 elements
a.make "<1 2>" 60 = x
a.make "<3 4>" 60 = y
# combine the two arrays into one Array of VECTOR4
a.v2v2tov4 x y = z
# average should be (1, 2, 3, 4)
a.ave z
# split up Array
a.v4tov2v2 z = a b
# a and b should be equal to x and y, respectively
a.ave a
a.ave b
a.v2v4tov6
SYNTAX:
a.v2v4tov6 inArrayXY inArrayX0Y0DXDY = outArray
FUNCTION:
Uses "inArrayXY" as the first two components and "inArrayX0Y0DXDY" as the
last four components and patches them together to create a VECTOR6
output Array. The data type of the input Array "inArrayXY" must
be VECTOR2, and the data type of the input Array "inArrayX0Y0DXDY" must
be VECTOR4. The rank and shape of both input Arrays must be the same
and are preserved in the output Array. See also a.v6tov2v4.
EXAMPLE:
# creates a 3D Array of VECTOR2 in x which has 3 columns, 5 rows, and 2
# planes
a.make "<1 2>" 3 5 2 = x
# creates a 3D Array of VECTOR2 in y which has 3 columns, 5 rows, and 2
# planes
a.make "<3 4 5 6>" 3 5 2 = y
# combined them into a three dimensional Array of VECTOR4
a.v2v4tov6 x y = z
# split up into a and b;
# a should be identical to x, b to y
a.v6tov2v4 z = a b
a.ave a
a.ave b
a.v4tov2v2
SYNTAX:
a.v4tov2v2 inArray = outArrayX0Y0 outArrayDXDY
FUNCTION:
Splits the first and second pair of components of the VECTOR4 input
Array into separate output Arrays, "outArrayX0Y0" and "outArrayDXDY." The
rank and shape of the input Array is preserved in both of the output
Arrays. The output Arrays will be of type VECTOR2. See also a.v2v2tov4.
EXAMPLE:
# creates a 3D Array of VECTOR2 in x which has 3 columns, 5 rows, and 2
# planes
a.make "<1 2>" 3 5 2 = x
# creates a 3D Array of VECTOR2 in y which has 3 columns, 5 rows, and 2
# planes
a.make "<3 4>" 3 5 2 = y
# combined them into a three dimensional Array of VECTOR4
a.v2v2tov4 x y = z
# average value should be (1,2,3,4)
a.ave z
# split up into a and b;
# a should be identical to x, b to y
a.v4tov2v2 z = a b
a.ave a
a.ave b
a.v6tov2v4
SYNTAX:
a.v6tov2v4 inArray = outArrayXY outArrayX0Y0DXDY
FUNCTION:
Splits the first pair and second four components of the VECTOR6 input
Array into separate output Arrays, "outArrayXY" and "outArrayX0Y0DXDY."
The rank and shape of the input Array is preserved in both of the output
Arrays. The output Arrays will be of type VECTOR2 and VECTOR4. See also
a.v2v4tov6.
EXAMPLE:
# creates a 3D Array of VECTOR2 in X which has 3 columns, 5 rows, and 2
# planes
a.make "<1 2>" 3 5 2 = x
# creates a 3D Array of VECTOR4 in X which has 3 columns, 5 rows, and 2
# planes
a.make "<3 4 5 6>" 3 5 2 = y
# combined them into a three dimensional Array of VECTOR6
a.v2v4tov6 x y = z
# average value should be (1,2,3,4,5,6)
# split up into a and b;
# a should be identical to x, b to y
a.v6tov2v4 z = a b
a.ave a
a.ave b
a.xytov2
SYNTAX:
a.xytov2 inArrayX inArrayY = outArray
FUNCTION:
Uses "inArrayX" as the x component and "inArrayY" as the "y" component
and patches them together to create a VECTOR2 output Array. The data
types of the input Arrays can be any scalar type. The rank and shape
of both input Arrays must be the same and are preserved in the output
file. See also a.v2toxy.
EXAMPLE:
# create two 2D 30 by 30 arrays initialized to -5 and to 17, respectively.
a.make -5 30 30 = x
a.make 17 30 30 = y
# combine the two arrays into a 2D Array of VECTOR2
a.xytov2 x y = z
# The average value of Z should be (-5,17).
a.ave z
# split up z into A and B
a.v2toxy z = a b
# a should be identical to x, b to y
a.ave a
a.ave b
alg.calc.ene
SYNTAX:
alg.calc.ene psfArray inmicronsperpix outmicronsperpix \
centercol centerrow = eneArray
FUNCTION:
Calculates the encircled energy from data in the Point Spread Function
(PSF) input Array. Each pixel is "inmicronsperpix" on a side. The
output is a one-dimensional Array whose address is returned in
"eneArray." The desired output sampling is specified by
"outmicronsperpix." The center of the encircled energy calculation
is "centercol," "centerrow." The PSF input Array must be 2D scalar.
The other parameters must be single scalars.
EXAMPLE:
# load the image file
a.load "Images/0001" = image
# get calibration data
a.load "Calibration/FinalTestRects" = finaltestrects
a.load "Calibration/RefPos" = refpos
a.load "Calibration/FinalCenters" = finalcenters
a.load "Calibration/Params" = params
set micronsperpixel 0.3
set PSFsize 128
set SubapSize 1000
set PSFScale 10
set Lambda 1.0
# fit an ellipse to the data and outputs the x and y coordinates
alg.fit.spots image finaltestrects = testpos
# subtract the calibration reference positions
a.sub testpos refpos = motions
# find the average and subtract from motions so that it will have
# zero average
a.ave motions = temp
a.sub motions temp = motions
# store in vectors Array
a.v2v2tov4 finalcenters motions = vectors
# create a regular two dimensional output gradient Array and a
# weight mask Array
alg.conv.pg.arrays vectors params = gxgy mask
# use the gradient and mask to find the optical path difference
alg.recon.fast gxgy mask = opd
# scale the opd
a.mul opd $micronsperpixel = opd
# find the point spread function
alg.calc.psf opd mask $PSFsize $PSFsize $SubapSize $PSFScale $Lambda = psf
# find the encircled energy
alg.calc.ene psf 0.25 0.10 5 5 = ene
alg.calc.mtf
SYNTAX:
alg.calc.mtf otfArray = mtfArray
FUNCTION:
Calculates the Modulation Transfer Function (MTF) corresponding to the
input Optical Transfer Function (OTF). The MTF is the modulus of the
OTF. The OTF input Array must be complex.
EXAMPLE:
# follow example for alg.calc.ene
set MTFScale [expr 2.0 / ( $PSFsize * $PSFScale) ]
# calculate the optical transfer function
alg.calc.otf psf $PSFsize $PSFsize $PSFScale $MTFScale = otf
# now get the modulation transfer function
alg.calc.mtf otf = mtf
alg.calc.otf
SYNTAX:
alg.calc.otf psfArray ncols nrows micronsperpix permicronperpix = otfArray
FUNCTION:
Calculates the Optical Transfer Function (OTF) from the Point Spread
Function (PSF). The output is in spatial frequency space and is
complex. Each pixel on the output will be square and
"permicronperpix" in spatial frequency extent. The PSF input Array must
be 2D scalar (ncols x nrows), and the other parameters must be
single scalars.
EXAMPLE:
See example for alg.calc.mtf.
alg.calc.psf
SYNTAX:
alg.calc.psf opdArray pupilArray ncols nrows micronsperpix microradperpix lambda = psfArray
FUNCTION:
Calculates the Point Spread Function (PSF) from OPD and the pupil
intensity. The OPD amplitude is in the same units as the wavelength
(lambda), measured in microns. Each pixel in the input arrays is
square and "micronsperpix" on a side. The output is in angular
space. An attempt is made to center the output in the output
picture; that is, if the input OPD were zero, the peak intensity
would be near the center of the output Array. The OPD input
Array and the pupil Array must be 2D scalar and the same size
(ncols x nrows), and "ncols," "nrows," "micronsperpix,"
"microradperpix" and "lambda" must all be single scalars.
EXAMPLE:
See example for alg.calc.ene.
alg.conv.arrays.pg
SYNTAX:
alg.conv.arrays.pg gxgyArray maskArray paramArray = pgArray
FUNCTION:
Given a regular two-dimensional gradient Array "gxgyArray,"
a weight mask Array "maskArray," and a list of pupil subaperture grid
parameters that determine the positions the gradients will be
generated, this will calculate a list of positions and gradients in
"pgArray." The mask must be non-zero wherever the gradients in
"gxgyArray" exist. The input Arrays "gxgyArray" and "maskArray"
must be the same size. The input Array "paramArray" must be a six-
element scalar Array containing the subaperture grid indices in
the following order: "sxx," "syx," "sxy," "syy," "phx," "phy" (see description of alg.find.params).
EXAMPLE:
# load the image file
a.load "Images/0001" = image
# get calibration data
a.load "Calibration/FinalTestRects" = finaltestrects
a.load "Calibration/RefPos" = refpos
a.load "Calibration/FinalCenters" = finalcenters
a.load "Calibration/Params" = params
set micronsperpixel 0.3
set PSFsize 128
set SubapSize 1000
set PSFScale 10
set Lambda 1.0
# fit an ellipse to the data and outputs the x and y coordinates
alg.fit.spots image finaltestrects = testpos
# subtract the calibration reference positions
a.sub testpos refpos = motions
# find the average and subtract from motions so that it will have
# zero average
a.ave motions = temp
a.sub motions temp = motions
# store in vectors Array
a.v2v2tov4 finalcenters motions = vectors
# create a regular two dimensional output gradient Array and a
# weight mask Array
alg.conv.pg.arrays vectors params = gxgy mask
# convert it back to an Array
alg.conv.arrays.pg gxgy mask params = pgArray
alg.conv.ij.xy
SYNTAX:
alg.conv.ij.xy paramArray ijArray = xyArray
FUNCTION:
Converts from a list of grid coordinates i, j in "ijArray" to pixel
coordinates x, y in "xyArray." The grid coordinates must be a 0D or
1D VECTOR2, and the pixel coordinates will be 0D or 1D VECTOR2.
The format of "paramArray" is six scalar values in the following order:
d(x grid coordinate) / d(x pixel coordinate)
d(x grid coordinate) / d(y pixel coordinate)
d(y grid coordinate) / d(x pixel coordinate)
d(y grid coordinate) / d(y pixel coordinate)
grid x coordinate at imagefile pixel coordinate (0,0)
grid y coordinate at imagefile pixel coordinate (0,0)
EXAMPLE:
# load the image file
a.load "Images/0001" = image
# find the bright grid in image and saves the parameters of the regular grid
alg.find.params image 2.5 = gridparams
# generate a list of grid center positions
alg.make.grid gridparams 1024 1024 = centers
# convert to pixel coordinates
alg.conv.ij.xy gridparams centers = pixcoords
alg.conv.pg.arrays
SYNTAX:
alg.conv.pg.arrays pgArray paramArray = gxgyArray maskArray
FUNCTION:
Given a list of positions and gradients in "pgArray" and a list of
pupil subaperture grid parameters "paramArray" from which the positions in the
position gradient Array were taken, this will create a regular two-
dimensional output gradient Array "gxgyArray," and a weight mask Array,
"maskArray." The mask will be non-zero wherever the gradients in
"pgArray" exist.
EXAMPLE:
See examples for alg.conv.arrays.pg, and alg.calc.ene.
alg.conv.pg.circ.arrays
SYNTAX:
alg.conv.pg.circ.arrays pgArray paramArray centercol \
centerrow radius = gxgyArray maskArray
FUNCTION:
Given a list of positions and gradients in "pgArray," a list of
pupil subaperture grid parameters in "paramArray" from which positions
in the position-gradient file were taken, and the center "centercol"
"centerrow," and "radius" of a circle, this will create a regular 2D
gradient Array, "gxgyArray," and a weight mask Array, "maskArray." The
mask will be non-zero everywhere inside the circle. The gradients will
be taken from the "pgArray" where they exist, otherwise they will
be calculated from a Zernike decomposition of the known gradients.
Note: Users should verify that the center position and radius have
reasonable
values, i.e., in the Array, before using them with this function.
EXAMPLE:
# load the image file
a.load "Images/0001" = image
# get calibration data
a.load "Calibration/FinalTestRects" = finaltestrects
a.load "Calibration/RefPos" = refpos
a.load "Calibration/FinalCenters" = finalcenters
a.load "Calibration/Params" = params
set micronsperpixel 0.3
set PSFsize 128
set SubapSize 1000
set PSFScale 10
set Lambda 1.0
# fit an ellipse to the data and outputs the x and y coordinates
alg.fit.spots image finaltestrects = testpos
# subtract the calibration reference positions
a.sub testpos refpos = motions
# find the average and subtract from motions so that it will have
# zero average
a.ave motions = temp
a.sub motions temp = motions
# store in vectors Array
a.v2v2tov4 finalcenters motions = vectors
# create a regular two dimensional output gradient Array and a
# weight mask Array
alg.conv.pg.circ.arrays vectors params 200 200 100 = gxgy mask
alg.conv.xy.ij
SYNTAX:
alg.conv.xy.ij paramArray ijArray = xyArray
FUNCTION:
Converts from a list of grid coordinates i, j in "ijArray" to pixel
coordinates x, y in "xyArray." The grid coordinates must be a 0D or
1D VECTOR2, and the pixel coordinates will be 0D or 1D VECTOR2.
The format of "paramArray" is 6 scalar values in the following order:
d(x grid coordinate) / d(x pixel coordinate)
d(x grid coordinate) / d(y pixel coordinate)
d(y grid coordinate) / d(x pixel coordinate)
d(y grid coordinate) / d(y pixel coordinate)
grid x coordinate at imagefile pixel coordinate (0,0)
grid y coordinate at imagefile pixel coordinate (0,0)
EXAMPLE:
# load the image file
a.load "Images/0001" = image
# find the bright grid in image and saves the parameters of the regular grid
alg.find.params image 2.5 = gridparams
# generate a list of grid center positions
alg.make.grid gridparams 1024 1024 = centers
# convert to pixel coordinates
alg.conv.ij.xy gridparams centers = pixcoords
# convert back to grid coordinates
alg.conv.xy.ij gridparams pixcoords = newcent
alg.find.params
SYNTAX:
alg.find.params inArray spacing = paramArray
FUNCTION:
Finds a likely grid in "inArray" and outputs the parameters of a
regular grid in "paramArray." The format of "paramArray" is six
floating point numbers in the following order:
d(x grid coordinate) / d(x pixel coordinate) = sxx
d(x grid coordinate) / d(y pixel coordinate) = sxy
d(y grid coordinate) / d(x pixel coordinate) = syx
d(y grid coordinate) / d(y pixel coordinate) = phx
grid x coordinate at imagefile pixel coordinate (0,0) = phx
grid y coordinate at imagefile pixel coordinate (0,0) = phy
If the input was 1-D, only the first and fifth elements of the output
are non-zero.
EXAMPLE:
# load a pupil image file
a.load "ImageFile" = image
# finds the bright grid in image
alg.find.params image 2.5 = gridparams
# generate a list of grid center positions
alg.make.grid gridparams 1024 1024 = centers
alg.find.rects
SYNTAX:
alg.find.rects inArray = rectArray
FUNCTION:
Finds the approximate locations of all spots in "inArray,"
throws out spots that are too close to the others or too dim,
and returns an Array of rectangles in the VECTOR4 output "rectArray."
EXAMPLE:
# load a pupil image file
a.load "ImageFile" = image
# finds the bright grid in image and save rectangles that surround the spots
alg.find.rects image = rects
# generate a list of spot positions
alg.fit.spots image rects = positions
alg.fit.circle
SYNTAX:
alg.fit.circle inArray sign = circArray
FUNCTION:
Fits a circle to the image in "inArray" and writes out the center
and radius in image coordinates to "circArray." If "sign" is
greater than zero, it fits to a bright circle on a dark background.
If "sign" is less than zero, it fits to a dark circle on a bright
background.
EXAMPLE:
# load a pupil image file
a.load "ImageFile" = image
# fit a circle to the #data and outputs the x and y coordinates and
# the radius of the best fit circle
alg.fit.circle image 1.0 = circparams
alg.fit.cross
SYNTAX:
alg.fit.cross inArray sign = crossArray
FUNCTION:
Fits a cross to the image in "inArray" and writes out the center
in image coordinates to "crossArray." If "sign" is
greater than zero, it fits to a bright cross on a dark background.
If "sign" is less than zero, it fits to a dark cross on a bright
background.
EXAMPLE:
# load a pupil image file
a.load "ImageFile" = image
# fit a cross to the data and outputs the x and y coordinates
alg.fit.cross image 1.0 = crosspos
alg.fit.ellipse
SYNTAX:
alg.fit.ellipse inArray sign = ellipseArray
FUNCTION:
Fits an ellipse to the image in "inArray" and writes out the center,
major and minor axis in image coordinates, and the angle of the major
axis in degrees to "ellipseArray." If "sign" is greater than zero, it
fits to a bright ellipse on a dark background. If "sign" is less than
zero it fits to a dark ellipse on a bright background.
EXAMPLE:
# load a pupil image file
a.load "ImageFile" = image
# fit an ellipse to the data and outputs the x and y coordinates, major
# and minor axis, and the angle of the major axis
alg.fit.ellipse image 1.0 = pos
alg.fit.spot
SYNTAX:
alg.fit.spot inArray = posArray
FUNCTION:
Finds the maximum value in "inArray," fits a paraboloid
to the area around it, and writes the position it calculates to
"posArray." The output is a zero dimensional Array of 2D vectors
if the input Array was 2D, and is a zero-dimensional Array of
scalar if the input Array was 1D.
EXAMPLE:
# load a pupil image file
a.load "ImageFile" = image
# fit an ellipse to the data and outputs the x and y coordinates
alg.fit.spot image = pos
alg.fit.spots
SYNTAX:
alg.fit.spots inArray rectArray = posArray
FUNCTION:
Given the subaperture rectangles in "rectArray," this function
finds the maximum value in each rectangle in "inArray," fits paraboloids
to the areas around these points, and reports the positions it
calculates in "posArray." The format of "rectArray" must be
a one-dimensional Array of 4-Vectors (V4) with a number of elements
corresponding to the number of rectangles found. The format of the
output "posArray" will be a one-dimensional Array of 2-Vectors (V2)
with the number of elements corresponding to the number of rectangles.
EXAMPLE:
# load a pupil image file
a.load "ImageFile" = image
# find the bright spots and save the rectangles that surround them
alg.find.rects image = rects
# fit an ellipse to the data and outputs the x and y coordinates
alg.fit.spots image rects = pos
alg.make.grid
SYNTAX:
alg.make.grid paramArray ncols nrows = posArray
FUNCTION:
Generates an Array of subaperture centers in "posArray" from the
subaperture grid parameter Array "paramArray." The format of
"paramArray" is six floating point numbers in the following order
d(x grid coordinate) / d(x pixel coordinate)
d(x grid coordinate) / d(y pixel coordinate)
d(y grid coordinate) / d(x pixel coordinate)
d(y grid coordinate) / d(y pixel coordinate)
grid x coordinate at imagefile pixel coordinate (0,0)
grid y coordinate at imagefile pixel coordinate (0,0)
The format of the position Array is 1D Array of VECTOR2
with the number of columns corresponding to the number of
grid centers inside "ncols"x"nrows."
EXAMPLE:
# load the image file
a.load "ImageFile" = image
# find the bright grid in image and saves the parameters of the regular grid
alg.find.params image 2.5 = gridparams
# generate a list of grid center positions
alg.make.grid gridparams 1024 1024 = centers
alg.make.grid.circ
SYNTAX:
alg.make.grid.circ paramArray circArray = posArray
FUNCTION:
Given a set of subaperture parameters "gridParams" and
circle parameters "circParams," this function generates a list
of subaperture centers and returns it in "posArray." The subaperture
parameters lie within the circle defined in "circParams." The
format of "paramArray" is six floating point numbers in the
following order:
d(x grid coordinate) / d(x pixel coordinate)
d(x grid coordinate) / d(y pixel coordinate)
d(y grid coordinate) / d(x pixel coordinate)
d(y grid coordinate) / d(y pixel coordinate)
grid x coordinate at imagefile pixel coordinate (0,0)
grid y coordinate at imagefile pixel coordinate (0,0)
The format of the position Array is 1D Array of VECTOR2
with the number of columns corresponding to the number of
grid centers inside a circle as specified by "circArray." The format of
"circArray" is three scalar values specifying the X and Y coordinates of the
center and the radius of a circle.
EXAMPLE:
# load a pupil grid image file
a.load "GridImageFile" = GridImage
# load a pupil image file
a.load "CircImageFile" = CircImage
# find the circular pupil and save parameters
alg.fit.circle CircImage = CircParams
# find the bright grid in the grid image and saves the parameters of the
# regular grid
alg.find.params GridImage = GridParams
# generate a list of grid center positions
alg.make.grid.circ GridParams CircParams = Centers
alg.match.matches
SYNTAX:
alg.match.matches matchArray1 matchArray2 = newmatchArray1 newmatchArray2
FUNCTION:
Finds the common pupil subaperture centers in the first two match Arrays.
Copies only those centers and rectangles that were common to both
to the new match Arrays. All Arrays must be VECTOR6.
EXAMPLE:
# load two reference spot image files The spot images should be very
# similar except the first was taken at a distance of 8.9 from
# best pupil focus, and the second image was taken at a distance of
# 9.4 from best pupil focus.
a.load "RefImage1File" = RefImage1
a.load "RefImage2File" = RefImage2
# find the reference spot subaperture rectangles in RefImage1
alg.find.rects Image1 = RefRects
# do the same thing for the test spots in the two images TstImage1 and
# TstImage2.
a.load "TstImage1File" = TstImage1
a.load "TstImage2File" = TstImage2
alg.find.rects TstImage1 = TstRects
# use the spot rectangles in RefRects together with the two reference
# spot images and the grid centers in Centers to generate a matching
# data set in RefMatches and TstMatches
a.load "Centers" = centers ; a.load "refPos" = refPos
alg.match.rects.cent RefRects RefImage1 RefImage2 Centers refPos 8.9 9.4 = refMatches
alg.match.rects.cent TstRects TstImage1 TstImage2 Centers refPos 8.7 9.5 = testMatches
# match the reference spot subaperture rectangles with the test spot
# subaperture rectangles to generate two new match data sets. Both
# will have the same number of subaperture rectangles and will have
# matching reference and test subapertures in the same order.
alg.match.matches refMatches testMatches = NewRefMatches NewTstMatches
alg.match.rects.cents
SYNTAX:
alg.match.rects.cents rectArray image1Array image2Array posArray z1 z2 = matchArray
FUNCTION:
Uses the subaperture rectangles in "rectArray" (VECTOR4) on both
"image1Array" (2D scalar) and "image2Array" to calculate the precise
positions of spots in the two image Arrays. The spot positions are
projected to z=0 and compared with the positions in "posArray"
(VECTOR2). The output is a list of spot subaperture rectangles and
matching pupil subaperture center positions in "matchArray" (VECTOR6).
The image Arrays must be the same size, and "z1" and "z2" must be
single scalars.
EXAMPLE:
# load two spot image files from disk. The spot images should be very
# similar except the first was taken at a distance of 8.9 from best
# pupil focus, and the second image was taken at a distance of 9.4 from
# best pupil focus.
a.load "Image1File" = Image1
a.load "Image2File" = Image2
a.load "Centers" = centers
# find the spot rectangles in Image1
alg.find.rects Image1 = Rects
# generate the matching data set
alg.match.rects.cents Rects Image1 Image2 Centers 8.9 9.4 = matches
alg.recon.fast
SYNTAX:
alg.recon.fast gxgyArray maskArray = surfArray
FUNCTION:
Reconstructs a surface from its gradients in "gxgyArray" and puts the
result in "surfArray." The gradient must have two dimensions and be
VECTOR2. "maskArray" must have the same number of columns and
rows as the gradient Array and is zero in those positions that should have
no surface reconstructed, or to indicate that there are no gradients
measured at that point. The output will be two-dimensional FLOAT and
have the same number of columns and rows and the input.
EXAMPLE:
# load the image file
a.load "Images/0001" = image
# get calibration data
a.load "Calibration/FinalTestRects" = finaltestrects
a.load "Calibration/RefPos" = refpos
a.load "Calibration/FinalCenters" = finalcenters
a.load "Calibration/Params" = params
set micronsperpixel 0.3
# fit an ellipse to the data and outputs the x and y coordinates
alg.fit.spots image finaltestrects = testpos
# subtract the calibration reference positions
a.sub testpos refpos = motions
# find the average and subtract from motions so that it will have
# zero average
a.ave motions = temp
a.sub motions temp = motions
# store in vectors Array
a.v2v2tov4 finalcenters motions = vectors
# create a regular two dimensional output gradient Array and a
# weight mask Array
alg.conv.pg.arrays vectors params = gxgy mask
# use the gradient and mask to find the optical path difference
alg.recon.fast gxgy mask = opd
# scale the opd
a.mul opd $micronsperpixel = opd
alg.recon.slow
SYNTAX:
alg.recon.slow gxgyArray maskArray = surfArray
FUNCTION:
Reconstructs a surface from its gradients in "gxgyArray" and puts the
result in "surfArray." The gradient must have two dimensions and be
VECTOR2. "maskArray" must have the same number of columns and
rows as the gradient Array and is zero in those positions that should have
no surface reconstructed, or to indicate that there are no gradients
measured at that point. The output will be two-dimensional FLOAT and
have the same number of columns and rows and the input.
EXAMPLE:
# load the image file
a.load "Images/0001" = image
# get calibration data
a.load "Calibration/FinalTestRects" = finaltestrects
a.load "Calibration/RefPos" = refpos
a.load "Calibration/FinalCenters" = finalcenters
a.load "Calibration/Params" = params
set micronsperpixel 0.3
# fit an ellipse to the data and outputs the x and y coordinates
alg.fit.spots image finaltestrects = testpos
# subtract the calibration reference positions
a.sub testpos refpos = motions
# find the average and subtract from motions so that it will have
# zero average
a.ave motions = temp
a.sub motions temp = motions
# store in vectors Array
a.v2v2tov4 finalcenters motions = vectors
# create a regular two dimensional output gradient Array and a
# weight mask Array
alg.conv.pg.arrays vectors params = gxgy mask
# use the gradient and mask to find the optical path difference
alg.recon.slow gxgy mask = opd
# scale the opd
a.mul opd $micronsperpixel = opd
alg.rects.edge.width
SYNTAX:
alg.rects.edge.width in
or in = out
or = out
FUNCTION:
Sets and/or gets the width of a boundary region around the edges
of the image that will be excluded when searching for spots. Default value
is 6, meaning that spots within 6 pixels of the edge will be ignored.
The first two forms will set the edge width to the value of "in." The second
form will also set "out" to the new value. The third form will set "out"
to the current value of the edge width.
EXAMPLE:
alg.rects.edge.width 10
alg.rects.frac.bright
SYNTAX:
alg.rects.frac.bright in
or in = out
or = out
FUNCTION:
Sets and/or gets the minimum fractional brightness relative to the
maximum in the image below which spots will be ignored. Default
value is .30, meaning that spots whose peak brightness is below .30
of the maximum brightness in the image will be ignored. The first two
forms will set the fractional brightness to the value of "in." The second
form will also set "out" to the new value. The third form will set "out"
to the current value of the edge width.
EXAMPLE:
alg.rects.frac.bright 50
alg.rects.min.pixs
SYNTAX:
alg.rects.min.pixs in
or in = out
or = out
FUNCTION:
Gets/Sets the minimum number of pixels in a spot that must be above the
minimum fractional brightness for a spot to be considered. Default value is 3,
meaning that spots with less than 3 pixels above the minimum fractional
brightness will be ignored. The first two forms will set the minimum number
of pixels to the value of "in." The second form will also set "out" to the new
value. The third form will set "out" to the current value of the edge width.
EXAMPLE:
alg.rects.min.pixs 5
alg.rects.minmax.sep
SYNTAX:
alg.rects.minmax.sep min max
or min max = outMin outMax
or = outMin outMax
FUNCTION:
Gets/Sets the minimum and maximum allowable size of the separations
between the spots. In other words, this limits the search for a regular
grid. Default values are 5 and 11, meaning grid spacings below 5 and
greater than 11 pixels will be ignored. The first two forms will set the
edge width to the value of "in." The second form will also set "out" to the new
value. The third form will set "out" to the current value of the edge width.
EXAMPLE:
alg.rects.minmax.sep 5 10
alg.set.matchsize
SYNTAX:
alg.set.matchsize matchsize
FUNCTION:
Sets size of the maximum separation between a projected subaperture position
and a real subaperture position that will be accepted as a match. A value of
1 or 2 is considered very tight, and a value of 5 or 6 is considered
very loose, making matching a breeze.
EXAMPLE:
a.load "Image1File" = Image1
a.load "Image2File" = Image2
alg.find.rects Image1 = Rects
a.load "Centers" = centers
# set the maximum allowable separation to 5.0. The larger the maximum
# separation, the more matches will be found.
alg.set.matchsize 5.0
# performs a matching function on data
alg.match.rects.cents Rects Image1 Image2 Centers 8.9 9.4 = matches
id.clr.circ.array
SYNTAX:
id.clr.circ.Array ID
FUNCTION:
Removes a circle Array from image display window "ID."
EXAMPLE:
# create a 2D Array
a.tilt 100 100 0 1 2 = image
# create a circle Array
a.to "(40 60 30)" f = circ
# display the image
id.new ID
id.set.Array ID image
# overlay the circle
id.set.circ.Array ID circ
# remove the circle
id.clr.circ.Array ID
id.clr.pos.array
SYNTAX:
id.clr.pos.Array ID
FUNCTION:
Removes a pos Array from image display window "ID."
EXAMPLE:
a.tilt 100 100 0 1 2 = IMAGE
a.tilt 5 5 4 20 0 = X
a.tilt 5 5 12 0 20 = Y
a.to X Y "v2" = XY
a.shape XY 25 = XY
id.new ID
id.set.Array ID IMAGE
id.set.pos.Array ID XY
id.get.pos.Array ID N
id.clr.pos.Array ID
Create a 2D image and overlay a 5x5 Array of positions.
id.clr.rect.array
SYNTAX:
id.clr.rect.Array ID
FUNCTION:
Removes rect Array from image display window "ID."
EXAMPLE:
# create a 2D Array
a.tilt 100 100 0 1 2 = image
# create a rectangle Array
a.tilt 5 5 4 20 0 = X # X-Coordinates
a.tilt 5 5 12 0 20 = Y # Y-Coordinates
a.make 6 5 5 = W # Width
a.make 4 5 5 = H # Height
a.to X Y W H "v4" = R # Create the rectangles
a.shape R 25 = R # Make it 1-D
# display the image
id.new ID
id.set.Array ID image
id.set.rect.Array ID R # Overlay the position Array
id.get.rect.Array ID S # Place the rect Array in S
id.clr.rect.Array ID # Clear the rectangle overlay
id.clr.vect.array
SYNTAX:
id.clr.vect.Array ID
FUNCTION:
Removes a vect Array from image display window "ID."
EXAMPLE:
# Create an image display and overlay a 5x5 vector field.
a.tilt 100 100 0 1 2 = IMAGE
a.tilt 5 5 4 20 0 = X
a.tilt 5 5 12 0 20 = Y
a.make 0 5 5 = DX
a.uniformnoise DX 5 = DX
a.make 0 5 5 = DY
a.uniformnoise DY 5 = DY
a.to X Y DX DY "v4" = V
a.shape V 25 = V
id.new ID
id.set.Array ID IMAGE
id.set.vect.Array ID V
id.clr.vect.Array ID
id.get.pos.array
SYNTAX:
id.get.pos.Array ID outPosArray
FUNCTION:
Reads a specific pos Array from image display window "ID."
EXAMPLE:
a.tilt 100 100 0 1 2 = IMAGE
a.tilt 5 5 4 20 0 = X
a.tilt 5 5 12 0 20 = Y
a.to X Y "v2" = XY
a.shape XY 25 = XY
id.new ID
id.set.Array ID IMAGE
id.set.pos.Array ID XY
id.get.pos.Array ID N
id.clr.pos.Array ID
Create a 2D image and overlay a 5x5 Array of positions.
id.get.rect.array
SYNTAX:
id.get.rect.Array ID outRectArray
FUNCTION:
Reads a specific rect Array from image display window "ID."
EXAMPLE:
# create a 2D Array
a.tilt 100 100 0 1 2 = image
# create a rectangle Array
a.tilt 5 5 4 20 0 = X # X-Coordinates
a.tilt 5 5 12 0 20 = Y # Y-Coordinates
a.make 6 5 5 = W # Width
a.make 4 5 5 = H # Height
a.to X Y W H "v4" = R # Create the rectangles
a.shape R 25 = R # Make it 1-D
# display the image
id.new ID
id.set.Array ID image
id.set.rect.Array ID R # Overlay the position Array
id.get.rect.Array ID S # Place the rect Array in S
id.clr.rect.Array ID # Clear the rectangle overlay
id.get.vect.array
SYNTAX:
id.get.vect.Array ID outVectArray
FUNCTION:
Reads a vect Array from image display window "ID."
EXAMPLE:
a.tilt 100 100 0 1 2 = IMAGE
a.tilt 5 5 4 20 0 = X
a.tilt 5 5 12 0 20 = Y
a.make 0 5 5 = DX
a.uniformnoise DX 5 = DX
a.make 0 5 5 = DY
a.uniformnoise DY 5 = DY
a.to X Y DX DY "v4" = V
a.shape V 25 = V
id.new ID
id.set.Array ID IMAGE
id.set.vect.Array ID V
id.get.vect.Array ID W
id.clr.vect.Array ID
Create an image display and overlay a 5x5 vector field.
id.new
SYNTAX:
id.new newID
FUNCTION:
Creates and returns a new image display window called "newID."
EXAMPLE:
# create a 2D Array
a.tilt 100 100 0 1 2 = image
# create a circle Array
a.to "(40 60 30)" f = circ
# display the image
id.new ID
id.set.Array ID image
# overlay the circle
id.set.circ.Array ID circ
# remove the circle
id.clr.circ.Array ID
id.set.array
SYNTAX:
id.set.Array ID Array
FUNCTION:
Sends a specific Array to image display window "ID."
EXAMPLE:
# create a 2D Array
a.tilt 100 100 0 1 2 = image
# create a circle Array
a.to "(40 60 30)" f = circ
# display the image
id.new ID
id.set.Array ID image
# overlay the circle
id.set.circ.Array ID circ
# remove the circle
id.clr.circ.Array ID
id.set.auto
SYNTAX:
id.set.auto ID autoscaleflag
FUNCTION:
Sets or clears the autoscale flag for image display window "ID." A value
of 1 for "autoscaleflag" indicates autoscaling takes effect. A value of 0 for
"autoscaleflag" indicates manual scaling is used.
EXAMPLE:
a.tilt 100 100 0 1 2 = IMAGE
id.new ID
id.set.Array ID IMAGE
sleep 10
id.set.auto ID 0
id.set.minmax ID 50 150
sleep 10
id.set.auto ID 1
This creates a new IMAGE and a new window ID in which to display it. It
then displays IMAGE in ID and waits 10 seconds for the user to appreciate
the display. Next it turns autoscaling off and sets the minimum and
maximum to 50 and 150 respectively. It sleeps again so that the user can
see the effect. Finally, it sets autoscaling back on.
id.set.circ.array
SYNTAX:
id.set.circ.Array ID CircArray
FUNCTION:
Sends a specific circle Array to image display window "ID."
EXAMPLE:
# create a 2D Array
a.tilt 100 100 0 1 2 = image
# create a circle Array
a.make "<40 60 30>" 1 = circ
a.to circ "f" = circ
# display the image
id.new ID
id.set.Array ID image
# overlay the circle
id.set.circ.Array ID circ
# remove the circle
id.clr.circ.Array ID
id.set.minmax
SYNTAX:
id.set.minmax ID min max
FUNCTION:
Sets the minimum and maximum of the data range in the image display
window "ID." Values that are below the minimum or above the maximum are
displayed as if they were the minimum or maximum value.
EXAMPLE:
a.tilt 100 100 0 1 2 = IMAGE
id.new ID
id.set.Array ID IMAGE
sleep 10
id.set.auto ID 0
id.set.minmax ID 50 150
sleep 10
id.set.auto ID 1
This creates a new IMAGE and a new window ID in which to display it. It
then displays IMAGE in ID and waits 10 seconds for the user to appreciate
the display. Next it turns autoscaling off and sets the minimum and
maximum to 50 and 150 respectively. It sleeps again so that the user can
see the effect. Finally, it sets autoscaling back on.
id.set.pos.array
SYNTAX:
id.set.pos.Array ID PosArray
FUNCTION:
Sends a specific position Array to image display window "ID."
EXAMPLE:
a.tilt 100 100 0 1 2 = IMAGE
a.tilt 5 5 4 20 0 = X
a.tilt 5 5 12 0 20 = Y
a.to X Y "v2" = XY
a.shape XY 25 = XY
id.new ID
id.set.Array ID IMAGE
id.set.pos.Array ID XY
id.get.pos.Array ID N
id.clr.pos.Array ID
Create a 2D image and overlay a 5x5 Array of positions.
id.set.rect.array
SYNTAX:
id.set.rect.Array ID RectArray
FUNCTION:
Sends a specific rectangle Array to image display window "ID."
EXAMPLE:
# create a 2D Array
a.tilt 100 100 0 1 2 = image
# create a rectangle Array
a.tilt 5 5 4 20 0 = X # X-Coordinates
a.tilt 5 5 12 0 20 = Y # Y-Coordinates
a.make 6 5 5 = W # Width
a.make 4 5 5 = H # Height
a.to X Y W H "v4" = R # Create the rectangles
a.shape R 25 = R # Make it 1D
# display the image
id.new ID
id.set.Array ID image
id.set.rect.Array ID R # Overlay the position Array
id.get.rect.Array ID S # Place the rect Array in S
id.clr.rect.Array ID # Clear the rectangle overlay
id.set.title
SYNTAX:
id.set.title ID title
FUNCTION:
Sets the title of the image display "ID."
EXAMPLE:
id.new ID
id.set.title ID "Camera Image"
id.set.wh ID 400 400
id.set.xy ID 10 10
Create an image display with window title "Camera Image." Make the window
400x400 pixels and position at position (10,10) on the screen.
id.set.vect.array
SYNTAX:
id.set.vect.Array ID VectArray
FUNCTION:
Sends a specific vect Array to image display window "ID."
EXAMPLE:
a.tilt 100 100 0 1 2 = IMAGE
a.tilt 5 5 4 20 0 = X
a.tilt 5 5 12 0 20 = Y
a.make 0 5 5 = DX
a.uniformnoise DX 5 = DX
a.make 0 5 5 = DY
a.uniformnoise DY 5 = DY
a.to X Y DX DY "v4" = V
a.shape V 25 = V
id.new ID
id.set.Array ID IMAGE
id.set.vect.Array ID V
id.get.vect.Array ID W
id.clr.vect.Array ID
Create an image display and overlay a 5x5 vector field.
id.set.wh
SYNTAX:
id.set.wh ID width height
FUNCTION:
Sets the width and height of the image display "ID."
EXAMPLE:
id.new ID
id.set.title ID "Camera Image"
id.set.wh ID 400 400
id.set.xy ID 10 10
Create an image display with window title "Camera Image." Make the window
400x400 pixels and position at position (10,10) on the screen.
id.set.xy
SYNTAX:
id.set.xy ID x y
FUNCTION:
Sets the X and Y coordinates of the upper left corner of the image
display "ID."
EXAMPLE:
id.new ID
id.set.title ID "Camera Image"
id.set.wh ID 400 400
id.set.xy ID 10 10
Create an image display with window title "Camera Image." Make the window
400x400 pixels and position at position (10,10) on the screen.
id.sync
SYNTAX:
id.sync ID
FUNCTION:
The client waits until the server has completed all operations.
EXAMPLE:
id.new ID
for {set i 5} { $i < 50 } { incr i 5 } {
a.sinc 50 50 7.0 25.2 29.2 $i $i = IM
id.set.Array ID IM
id.sync ID
}
pd.add.xy.array
SYNTAX:
pd.add.xy.Array PD xarray yarray
FUNCTION:
Adds two specific Arrays, "xarray" and "yarray," to plot display
window "PD."
EXAMPLE:
a.tilt 100 0 .06283 = angle
a.cos angle = x
a.sin angle = y
pd.new pd
pd.set.xy.Array pd x y
pd.set.color pd "blue"
pd.set.line pd 3
a.mul x 2 = x
a.mul y 2 = y
pd.add.xy.Array pd x y
pd.set.color pd "orange"
This creates a ramp of 100 points between 0 and 2 pi. It then uses this angle
to generate the X and Y coordinates of points on a circle. After generating
a plot window, the circle is plotted. Next, the coordinates are multiplied
by 2, and the bigger circle is plotted in the same window as the smaller circle.
pd.add.y.array
SYNTAX:
pd.add.y.Array PD yarray
FUNCTION:
Adds a specific Array "yarray" to plot display window "PD."
EXAMPLE:
a.tilt 100 0 .06283 = angle
a.cos angle = x
a.sin angle = y
pd.new pd
pd.set.xy.Array pd x y
pd.set.color pd "blue"
pd.set.line pd 3
a.mul y 0.5 = y
pd.add.y.Array pd y
pd.set.color pd "orange"
This creates a ramp of 100 points between 0 and 2 pi. It then uses this angle
to generate the X and Y coordinates of points on a circle. After generating
a plot window, the circle is plotted. Next, the Y coordinate is multiplied
by 0.5 and plotted in the same window.
pd.new
SYNTAX:
pd.new newPD
FUNCTION:
Creates and returns a new plot display window called "newPD."
EXAMPLE:
a.tilt 100 0 .06283 = angle
a.cos angle = x
a.sin angle = y
pd.new pd
pd.set.xy.Array pd x y
pd.set.color pd "blue"
pd.set.line pd 3
a.mul x 2 = x
a.mul y 2 = y
pd.add.xy.Array pd x y
pd.set.color pd "orange"
This creates a ramp of 100 points between 0 and 2 pi. It then uses this angle
to generate the X and Y coordinates of points on a circle. After generating
a plot window, the circle is plotted. Next, the coordinates are multiplied
by 2, and the bigger circle is plotted in the same window as the smaller circle.
pd.set.color
SYNTAX:
pd.set.color PD colorstring
FUNCTION:
Sets the color of the data plotted in the plot display window "PD."
Color is designated as a string.
EXAMPLE:
a.tilt 100 0 .06283 = angle
a.cos angle = x
a.sin angle = y
pd.new pd
pd.set.xy.Array pd x y
pd.set.color pd "blue"
pd.set.line pd 3
a.mul x 2 = x
a.mul y 2 = y
pd.add.xy.Array pd x y
pd.set.color pd "orange"
This creates a ramp of 100 points between 0 and 2 pi. It then uses this angle
to generate the X and Y coordinates of points on a circle. After generating
a plot window, the circle is plotted. Next, the coordinates are multiplied
by 2, and the bigger circle is plotted in the same window as the smaller circle.
pd.set.line
SYNTAX:
pd.set.line PD linewidth
FUNCTION:
Sets the line width of the data plotted in the plot display window "PD."
Line width is an integer in the range 0 to 10.
EXAMPLE:
a.tilt 100 0 .06283 = angle
a.cos angle = x
a.sin angle = y
pd.new pd
pd.set.xy.Array pd x y
pd.set.color pd "blue"
pd.set.line pd 3
a.mul x 2 = x
a.mul y 2 = y
pd.add.xy.Array pd x y
pd.set.color pd "orange"
This creates a ramp of 100 points between 0 and 2 pi. It then uses this angle
to generate the X and Y coordinates of points on a circle. After generating
a plot window, the circle is plotted. Next, the coordinates are multiplied
by 2, and the bigger circle is plotted in the same window as the smaller circle.
pd.set.title
SYNTAX:
pd.set.title PD title
FUNCTION:
Sets the title string for the plot display window "PD."
EXAMPLE:
pd.new PD
pd.set.title PD "This is an empty window"
This creates a new plot display window and sets the title to the string
"This is an empty window."
pd.set.type
SYNTAX:
pd.set.type PD type
FUNCTION:
Type is an integer whose value indicates the plot type. The following
types are recognized:
1 line plot
2 dot plot
3 step plot (for y plots, not xy plots)
All other values are ignored.
EXAMPLE:
a.gauss 100 1 50 10 = GAUSS
pd.new PD
pd.set.y.Array PD GAUSS
pd.set.color PD "red"
pd.set.line PD 5
pd.set.type PD 1
a.mul GAUSS 2 = GAUSS
pd.add.y.Array PD GAUSS
pd.set.color PD "green"
pd.set.type PD 2
a.mul GAUSS 1.5 = GAUSS
pd.add.y.Array PD GAUSS
pd.set.color PD "blue"
pd.set.type PD 3
Creates a 1D gaussian profile in GAUSS, then generates a new
plot window and plots the profile in the window. The first plot
will be points connected by lines. Next it multiplies the values in the
Array by 2 and plots the new data in the same window as the shorter
gaussian. However, the new data will appear as green dots. Finally, the data is
multiplied by 1.5 and is plotted as a series of steps in blue.
pd.set.wh
SYNTAX:
pd.set.wh PD width height
FUNCTION:
Sets the width and height of the plot display window "PD."
EXAMPLE:
pd.new PD
pd.set.wh PD 500 200
This creates a new plot display window and sets the width to 500
and the height to 200.
pd.set.xy
SYNTAX:
pd.set.xy PD x y
FUNCTION:
Sets the X and Y coordinates of the upper left corner
of the plot display "PD."
EXAMPLE:
pd.new PD
pd.set.xy PD 20 30
This creates a new plot display window and moves
it near the upper left corner of the screen.
pd.set.xy.array
SYNTAX:
pd.set.xy.Array PD xarray yarray
FUNCTION:
Sends two specific Arrays, "xarray" and "yarray," to plot display
window "PD."
EXAMPLE:
a.tilt 100 0 .06283 = angle
a.cos angle = x
a.sin angle = y
pd.new pd
pd.set.xy.Array pd x y
pd.set.color pd "blue"
pd.set.line pd 3
a.mul x 2 = x
a.mul y 2 = y
pd.add.xy.Array pd x y
pd.set.color pd "orange"
This creates a ramp of 100 points between 0 and 2 pi. It then uses this angle
to generate the X and Y coordinates of points on a circle. After generating
a plot window, the circle is plotted. Next, the coordinates are multiplied
by 2, and the bigger circle is plotted in the same window as the smaller circle.
pd.set.y.array
SYNTAX:
pd.set.y.Array PD yarray
FUNCTION:
Sends a specific Array "yarray" to plot display window "PD."
EXAMPLE:
a.tilt 100 0 .06283 = angle
a.cos angle = x
a.sin angle = y
pd.new pd
pd.set.xy.Array pd x y
pd.set.color pd "blue"
pd.set.line pd 3
a.mul y 0.5 = y
pd.add.y.Array pd y
pd.set.color pd "orange"
This creates a ramp of 100 points between 0 and 2 pi. It then uses this angle
to generate the X and Y coordinates of points on a circle. After generating
a plot window, the circle is plotted. Next, the Y coordinate is multiplied
by 0.5 and plotted in the same window.
pd.sync
SYNTAX:
pd.sync PD
FUNCTION:
The client waits until the server has completed all operations.
EXAMPLE:
a.tilt 100 0 .06283 = angle
a.cos angle = x
a.sin angle = y
pd.new pd
pd.set.xy.Array pd x y
pd.set.color pd "blue"
pd.set.line pd 3
a.mul y 0.5 = y
pd.add.y.Array pd y
pd.set.color pd "orange"
pd.sync pd
This creates a ramp of 100 points between 0 and 2 pi. It then uses this angle
to generate the X and Y coordinates of points on a circle. After generating
a plot window, the circle is plotted. Next, the Y coordinate is multiplied
by 0.5 and plotted in the same window.
vd.new
SYNTAX:
vd.new newVD
FUNCTION:
Creates and returns a new image display window called "newVD."
EXAMPLE:
a.make "<-1 2>" 20 30 = g
vd.new VD
vd.set.Array VD g
First this generates a new 20-by-30 Array of VECTOR2 and sets all elements
to (-1,2). It then creates a new vector display window and displays the
gradient Array.
vd.set.array
SYNTAX:
vd.set.Array VD Array
FUNCTION:
Sends a specific Array to vector display window "VD."
EXAMPLE:
vd.new VD
a.make "<-1 2>" 20 30 = g
vd.set.Array VD g
a.flat 2 300 50 = pos
a.normalnoise pos 50 = pos
a.mul pos .05 = grd
a.cos grd = grd
a.catcol pos grd = posgrd
vd.set.Array VD posgrd
a.to posgrd V4 = posgrd
vd.set.Array VD posgrd
First this creates a new vector display window in VD. It then generates a
20-by-30 Array of V2 all set to (-1,2) and displays it. Next it generates
a 4-column 2D Array with a random distribution (of positions) in the first two
columns and a regular swirling pattern (of vectors) in the second two columns
and displays it. Finally, it converts the 4-column 2D scalar Array to a 1-
column 1D VECTOR4 Array and displays it. The last two displays should
be identical.
vd.set.auto
SYNTAX:
vd.set.auto VD autoflag
FUNCTION:
Sets or clears the autoscale flag for vector display window "VD."
A value of 1 for "autoflag" indicates autoscaling takes effect.
A value of 0 for "autoflag" indicates manual scaling is in effect.
EXAMPLE:
a.make "<-1 2>" 20 30 = g
vd.new VD ;
vd.set.Array VD g
vd.set.auto VD 0
vd.set.pixpervec VD 50
First this generates a new 20-by-30 Array of VECTOR2 and sets all elements
to (-1,2). It then creates a new vector display window and displays the
gradient Array. Next it turns autoscaling off and sets the scale factor
so that a vector of length 1 will be 50 pixels long.
vd.set.pixpervec
SYNTAX:
vd.set.pixpervec VD pixpervec
FUNCTION:
Turns autoscaling off and sets the pixels-per-vector constant.
EXAMPLE:
a.make "<-1 2>" 20 30 = g
vd.new VD ;
vd.set.Array VD g
vd.set.auto VD 0
vd.set.pixpervec VD 50
First this generates a new 20-by-30 Array of VECTOR2 and sets all elements
to (-1,2). It then creates a new vector display window and displays the
gradient Array. Next it turns autoscaling off and sets the scale factor
so that a vector of length 1 will be 50 pixels long.
vd.set.title
SYNTAX:
vd.set.title VD title
FUNCTION:
Sets the title string for the vector display window "VD."
EXAMPLE:
vd.new VD
vd.set.title VD "This is an empty window."
This creates a new vector display window and sets the title to the string
"This is an empty window."
vd.set.wh
SYNTAX:
vd.set.wh VD width height
FUNCTION:
Sets the width and height of the vector display window "VD."
EXAMPLE:
vd.new VD
vd.set.wh VD 500 200
This creates a new vector display window and sets the width to 500
and the height to 200.
vd.set.xy
SYNTAX:
vd.set.xy VD x y
FUNCTION:
Sets the X and Y coordinates of the upper left corner of the vector
display "VD."
EXAMPLE:
vd.new VD
vd.set.xy VD 20 30
This creates a new vector display window and moves it
near the upper left corner of the screen.
vd.sync
SYNTAX:
vd.sync VD
FUNCTION:
The client waits until the server has completed all operations.
EXAMPLE:
a.make "<-1 2>" 20 30 = g
vd.new VD ;
vd.set.Array VD g
vd.set.auto VD 0
vd.set.pixpervec VD 50
vd.sync VD
First this generates a new 20-by-30 Array of VECTOR2 and sets all elements
to (-1,2). It then creates a new vector display window and displays the
gradient Array. Next it turns autoscaling off and sets the scale factor
so that a vector of length 1 will be 50 pixels long.
wd.new
SYNTAX:
wd.new newWD
FUNCTION:
Creates and returns a new image display window called "newWD."
EXAMPLE:
wd.new WD
a.sinc 30 30 100 10 20 4 4 = x
wd.set.Array WD x
This creates a new wire display window in WD and displays a sinc squared
function in it. The function appears as an Array of dots in the window.
wd.set.angles
SYNTAX:
wd.set.angles WD theta phi
FUNCTION:
Sets the rotation angles in the wire display window "WD." The "theta"
angle specifies rotation about a vertical axis. The "phi" angle
specifies rotation about the horizontal axis. Both angles are in units
of radians between -PI/2 and +PI/2.
EXAMPLE:
wd.new WD
a.sinc 30 30 100 10 20 4 4 = x
wd.set.Array WD x
wd.set.angles WD 0.75 -0.75
This creates a new wire display window in WD and displays a sinc squared
function in it. The function appears as an Array of dots in the window.
The view is then changed.
wd.set.array
SYNTAX:
wd.set.Array WD Array
FUNCTION:
Sends the "Array" to the wire display window "WD." The Array should
be a 2D scalar.
EXAMPLE:
wd.new WD
a.sinc 30 30 100 10 20 4 4 = x
wd.set.Array WD x
wd.set.angles WD 0.75 -0.75
This creates a new wire display window in WD and displays a sinc squared
function in it. The function appears as an Array of dots in the window.
The view is then changed.
wd.set.color
SYNTAX:
wd.set.color WD color
FUNCTION:
Sets the color of the plot to the "color" string. The color is any
valid X Window system color string, like green, red, pink, etc.
EXAMPLE:
wd.new WD
a.sinc 30 30 100 10 20 4 4 = x
wd.set.Array WD x
wd.set.color WD "light blue"
This creates a new wire display window in WD and displays a sinc squared
function in it. The function appears as an Array of dots in the window.
wd.set.hide
SYNTAX:
wd.set.hide WD hidden
FUNCTION:
Sets the hidden line type of the plot in the wire dipole window "WD."
The hidden line type is an integer with one of the following values:
1 no hidden line
2 hidden line
All other values are ignored.
EXAMPLE:
wd.new WD
a.sinc 30 30 100 10 20 4 4 = x
wd.set.Array WD x
wd.set.type WD 3
wd.set.hide WD 2
This creates a new wire display window in WD and displays a sinc squared
function in it. It first displays it as a grid plot without hidden line
removal, then it turns hidden line removal on.
wd.set.minmax
SYNTAX:
wd.set.minmax WD min max
FUNCTION:
Sets the minimum and maximum of the vertical range in the wire display
window "WD." Values that are below the minimum or above the maximum
will be clipped.
EXAMPLE:
wd.new WD
a.sinc 30 30 100 10 20 4 4 = x
wd.set.Array WD x
wd.set.type WD 3
wd.set.hide WD 2
wd.set.minmax WD 0 50
This creates a new wire display window in WD and displays a sinc squared
function in it. It first displays it as a grid plot without hidden line
removal, then it turns hidden line removal on and sets the minimum to 0
and the maximum to 50.
wd.set.pers
SYNTAX:
wd.set.pers WD perspective
FUNCTION:
Sets the perspective of the plot in the wire dipole window "WD." The
perspective is an integer with one of the following values:
1 isometric (flat projection)
2 perspective
All other values are ignored.
EXAMPLE:
wd.new WD
a.sinc 30 30 100 10 20 4 4 = x
wd.set.Array WD x
wd.set.type WD 3
wd.set.hide WD 2
wd.set.minmax WD 0 50
wd.set.pers WD 2
This creates a new wire display window in WD and displays a sinc squared
function in it. It first displays it as a grid plot without hidden line
removal, then it turns hidden line removal on and sets the minimum to 0
and the maximum to 50. Finally, the perspective is modified.
wd.set.title
SYNTAX:
wd.set.title WD title
FUNCTION:
Sets the title string for the wire display window "WD."
EXAMPLE:
wd.new WD
wd.set.title WD "This is an empty window"
This creates a new wire display window and sets the title to the string
"This is an empty window."
wd.set.type
SYNTAX:
wd.set.type WD type
FUNCTION:
Sets the type of the plot in the wire dipole window "WD." The type is
an integer with the following meaning:
1 dots
2 rows
3 grid
4 solid
All other values are ignored.
EXAMPLE:
wd.new WD
a.sinc 30 30 100 10 20 4 4 = x
wd.set.Array WD x
wd.set.type WD 3
wd.set.hide WD 2
This creates a new wire display window in WD and displays a sinc squared
function in it. It first displays it as a grid plot without hidden line
removal, then it turns hidden line removal on.
wd.set.wh
SYNTAX:
wd.set.wh WD width height
FUNCTION:
Sets the width and height of the wire display window "WD."
EXAMPLE:
Sets the width and height of the wire display window "inwd" to "widthnum" and
"heightnum" respectively. The result is the same as if the user had resized
the window using the mouse handles.
Example:
wd.new WD
wd.set.wh WD 500 200
This creates a new wire display window and sets the width to 500
and the height to 200.
wd.set.xy
SYNTAX:
wd.set.xy WD x y
FUNCTION:
Sets the X and Y coordinates of the upper left corner of the wire
display window "WD."
EXAMPLE:
wd.new WD
wd.set.xy WD 20 30
This creates a new wire display window and moves it near
the upper left corner of the screen.
wd.sync
SYNTAX:
wd.sync WD
FUNCTION:
The client waits until the server has completed all operations.
EXAMPLE:
wd.new WD
a.sinc 30 30 100 10 20 4 4 = x
wd.set.Array WD x
wd.set.type WD 3
wd.set.hide WD 2
for {set i 50} {$i < 120} { incr i} {
wd.set.minmax WD 0 $i
wd.sync WD
}
This creates a new wire display window in WD and displays a sinc squared
function in it. It first displays it as a grid plot without hidden line
removal, then it turns hidden line removal on and sets the minimum to 0.
The maximum is varied between 50 and 120.
zern.conv.string
SYNTAX:
zern.conv.string coefArray
FUNCTION:
Returns a nicely formatted string representing the coefficient Array.
EXAMPLE:
zern.make.surf 13 50 50 25 25 20 = z
zern.decomp.surf.coefs z 35 25 25 20 = zerns
zern.conv.string zerns
First create a bunch of global variables. Then generate the 13th Zernike
polynomial in "z" and immediately decompose it into a list of the first 35
Zernikes. The output of the decomposition is placed in the Array "zerns."
The Zernike coefficients in "zerns" are formatted and printed.
zern.decomp.grad.coefs
SYNTAX:
zern.decomp.grad.coefs posgradArray N centercol centerrow radius = coefsArray
FUNCTION:
Decomposes gradients in "posgradArray" into the first "N" Zernike
polynomial coefficients and writes the coefficients to "coefsArray."
The format of the "posgradArray" must be 1D VECTOR4, (<x y dx dy>),
where the position coordinates X Y are in column and row units.
The format of "coefsArray" is 1D VECTOR2, (<index coef>).
The center of the circle over which the Zernikes are defined is
("centercol," "centerrow"), and the radius of the circle is "radius."
EXAMPLE:
a.make 100 50 = x
a.make 100 50 = y
a.normalnoise x 40 = x
a.normalnoise y 40 = y
a.to x y V2 = Pos
zern.make.grad Pos 13 100 100 100 = z
zern.decomp.grad.coefs z 35 100 100 100 = newZerns
zern.conv.string newZerns
First, two random coordinate Arrays are generated and combined to give a
VECTOR2 position Array Pos. Next, a position-gradient Array is generated
using the gradients of Zernike 13. Finally, the position-gradient Array
is decomposed into Zernike coefficients and printed.
zern.decomp.gxgy.coefs
SYNTAX:
zern.decomp.gxgy.coefs inArray N centercol centerrow radius = coefsArray
FUNCTION:
Decomposes the X and Y gradients in "inArray" into the first "N"
Zernike polynomial coefficients and writes out the indices and the
coefficients in "coefsArray." The format of "coefsArray" is 1D
VECTOR2 (<index coef>). The center of the circle over which the
Zernikes are defined is ("centercol," "centerrow"), and the radius of
the circle is "radius."
EXAMPLE:
zern.make.gxgy 13 50 50 25 25 20 = z
zern.decomp.gxgy.coefs z 35 25 25 20 = NewZerns
zern.conv.string NewZerns
An x y gradient Array is generated using the gradients of Zernike 13. Finally,
the x y gradient Array is decomposed into Zernike coefficients and printed.
zern.decomp.surf.coefs
SYNTAX:
zern.decomp.surf.coefs inArray N centercol centerrow radius = coefsArray
FUNCTION:
Decomposes the surface in "inArray" into the first "N"
Zernike polynomial coefficients and writes out the indices and the
coefficients to "coefsArray." The format of "coefsArray" is 1D
VECTOR2, (<index coef>). The center of the circle over which the
Zernikes are defined is ("centercol," "centerrow"), and the radius of
the circle is "radius."
EXAMPLE:
zern.make.surf 13 50 50 25 25 20 = z
zern.decomp.surf.coefs z 35 25 25 20 = zerns
zern.conv.string zerns
First create a bunch of global variables. Then generate the 13th Zernike
polynomial in "z" and immediately decompose it into a list of the first 35
Zernikes. The output of the decomposition is placed in the Array "zerns."
The Zernike coefficients in "zerns" are formatted and printed.
zern.get.coef
SYNTAX:
zern.get.coef coefArray N = valueArray
FUNCTION:
Returns the value of the Zernike coefficient with index "N" from the
Zernike coefficient Array "coefArray." The format of "coefArray" must
be VECTOR2, (<index value>).
EXAMPLE:
zern.make.surf 13 50 50 25 25 20 = z
zern.decomp.surf.coefs z 35 25 25 20 = NewZerns
zern.get.coef NewZerns 13 = Val
a.dump Val
A surface Array is generated using the functional form of Zernike 13.
The surface Array is decomposed into Zernike coefficients NewZerns.
Finally, the 13 element is extracted and printed.
zern.get.type
SYNTAX:
zern.get.type
FUNCTION:
Returns a string and the obscuration ratio that is descriptive of the current
set of Zernike polynomials. The current set of Zernike polynomials can be
changed using zern.set.type.
zern.make.grad
SYNTAX:
zern.make.grad posArray N centercol centerrow radius = posgradArray
FUNCTION:
Makes a position and gradient file from a list of positions and
the "N"th Zernike polynomial. The format of the "posgradArray" will
be 1D VECTOR4 (<x y dx dy>). The coordinates are in pixel units.
The format of "posArray" must be 0D or 1D VECTOR2.
The center of the circle on which the polynomial is defined will
be ("centercol," "centerrow"), and the radius of the circle in which the
Zernike is defined will be "radius" pixels.
EXAMPLE:
a.make 100 25 = x
a.make 100 25 = y
a.normalnoise x 20 = x
a.normalnoise y 20 = y
a.to x y "V2" = Pos
zern.make.grad Pos 15 100 100 40 = z
First, two random coordinate arrays are generated and combined to give a
VECTOR2 position Array Pos. It fills "Z" with a list of positions and the
corresponding gradients of Zernike 15 in it. The circular area over which the
Zernike gradients are defined will be centered in the data set and will have a
radius of 40 pixels.
zern.make.grad.coefs
SYNTAX:
zern.make.grad.coefs posArray coefsArray centercol centerrow radius = outArray
FUNCTION:
Makes a list of vector gradients in "outArray" using the
coefficients in "coefsArray" to linearly combine the gradients of
Zernike polynomials. The format of "coefsArray" must be VECTOR2
(<index coef>). The format of the position Array "posArray" must be
VECTOR2 (<x y>). The "outArray" will have the format 1D VECTOR4
(<x y dx dy>). The center of the circle on which the polynomials are
defined will be ("centercol," "centerrow"), and the radius of the circle
in which the Zernike is defined will be "radius" pixels.
EXAMPLE:
a.make 100 25 = x
a.make 100 25 = y
a.normalnoise x 20 = x
a.normalnoise y 20 = y
a.to x y "V2" = Pos
a.tilt 30 0 1 = I
a.make 0 30 = C
a.normalnoise C 1 = C
a.to I C "V2" = Coefs
zern.make.grad.coefs Pos Coefs 100 100 20 = z
First, two random coordinate arrays are generated and combined to give a
VECTOR2 position Array Pos. Next, a random set of 30 coefficients is generated
in Coefs. Finally, a position-gradient Array is generated from the random
positions in Pos and the random coefficients in Coefs.
zern.make.gxgy
SYNTAX:
zern.make.gxgy N ncols nrows centercol centerrow radius = outArray
FUNCTION:
Makes a two-dimensional VECTOR2 Array of the gradient of the
"N"th Zernike polynomial. The "outArray" will be "cols"x"rows" in
size, the center of the circle on which the polynomial is defined will
be ("centercol," "centerrow"), and the radius of the circle in which the
Zernike is defined will be "radius" pixels.
EXAMPLE:
zern.make.gxgy 15 100 100 50 50 40 = z
This fills "z" with a two-dimensional 100x100 Array of x gradients and y
gradients. The circular area over which the Zernike gradients are defined will
be centered in the Array and will have a radius of 40 pixels.
zern.make.gxgy.coefs
SYNTAX:
zern.make.gxgy.coefs coefsArray ncols nrows centercol centerrow radius = outArray
FUNCTION:
Makes a two-dimensional VECTOR2 Array using the coefficients
in "coefsArray" to linearly combine the gradients of Zernike
polynomials. The format of "coefsArray" must be 0D or 1D VECTOR2
(<index coef>). The "outArray" will be "cols"x"rows" VECTOR2 in size,
the center of the circle on which the polynomials are defined will be
("centercol," "centerrow"), and the radius of the circle in which the
Zernike is defined will be "radius" pixels.
EXAMPLE:
a.tilt 30 0 1 = I
a.make 0 30 = C
a.normalnoise C 1 = C
a.to I C "V2" = Coefs
zern.make.gxgy.coefs Coefs 100 100 50 50 40 = z
First, a random set of Zernike coefficients is created in "Coefs." Then these
coefficients are used to make a 2D Array of VECTOR2 with the gradients
of the sum of the polynomials specified in "Coefs."
zern.make.surf
SYNTAX:
zern.make.surf N ncols nrows centercol centerrow radius = outArray
FUNCTION:
Makes a two-dimensional floating point scalar Array of the "N"th
Zernike polynomial. The "outArray" will be "cols"x"rows" in size, the
center of the circle on which the polynomial is defined will be
("centercol," "centerrow"), and the radius of the circle in which the
Zernike is defined will be "radius" pixels.
EXAMPLE:
zern.make.surf 13 50 50 25 25 20 = z
zern.decomp.surf.coefs z 35 25 25 20 = zerns
zern.conv.string zerns
First create a bunch of global variables. Then generate the 13th Zernike
polynomial in "z" and immediately decompose it into a list of the first 35
Zernikes. The output of the decomposition is placed in the Array "zerns."
The Zernike coefficients in "zerns" are formatted and printed.
zern.make.surf.coefs
SYNTAX:
zern.make.surf.coefs coefsArray ncols nrows centercol centerrow radius = outArray
FUNCTION:
Makes a two-dimensional floating point scalar Array using the
coefficients in "coefsArray" to linearly combine Zernike polynomials.
The format of "coefsArray" must be 0D or 1D VECTOR2,
<index coef>.The "outArray" will be "cols"x"rows" in size, the
center of the circle on which the polynomial is defined will be
("centercol," "centerrow"), and the radius of the circle in which the
Zernike is defined will be "radius" pixels.
EXAMPLE:
a.tilt 30 0 1 = I
a.make 0 30 = C
a.normalnoise C 1 = C
a.to I C "V2" = Coefs
zern.make.surf.coefs Coefs 100 100 50 50 40 = z
First, a random set of Zernike coefficients is created in "Coefs." Then these
coefficients are used to make a 2D Array of FLOAT with the values
of the sum of the polynomials specified in "Coefs."
zern.print.current
SYNTAX:
zern.print.current
FUNCTION:
Prints out the current type of Zernike, the obscuration ratio. It also prints
out the index and the equation for of each of the Zernike coefficients
currently defined.
EXAMPLE:
zern.print.current
Zygo Zernikes, Obscuration Ratio = 0.0000
0 1.0 (Piston)
1 rcos(t) (X Tilt)
2 rsin(t) (Y Tilt)
3 2r^2-1 (Focus)
4 r^2cos(2t) (0 Astigmatism)
5 r^2sin(2t) (45 Astigmatism)
6 (3r^2-2)rcos(t) (X Coma)
7 (3r^2-2)rsin(t) (Y Coma)
8 6r^4-6r^2+1 (Spherical)
9 r^3cos(3t)
10 r^3sin(3t)
11 (4r^2-3)r^2cos(2t)
12 (4r^2-3)r^2sin(2t)
13 (10r^4-12r^2+3)rcos(t)
14 (10r^4-12r^2+3)rsin(t)
15 20r^6-30r^4+12r^2-1
16 r^4cos(4t)
17 r^4sin(4t)
18 (5r^2-4)r^3cos(3t)
19 (5r^2-4)r^3sin(3t)
20 (15r^4-20r^2+6)r^2cos(2t)
21 (15r^4-20r^2+6)r^2sin(2t)
22 (35r^6-60r^4+30r^2-4)rcos(t)
23 (35r^6-60r^4+30r^2-4)rsin(t)
24 70r^8-140r^6+90r^4-20r^2+1
25 r^5cos(5t)
26 r^5sin(5t)
27 (6r^2-5)r^4cos(4t)
28 (6r^2-5)r^4sin(4t)
29 (21r^4-30r^2+10)r^3cos(3t)
30 (21r^4-30r^2+10)r^3sin(3t)
31 (56r^6-105r^4+60r^2-10)r^2cos(2t)
32 (56r^6-105r^4+60r^2-10)r^2sin(2t)
33 (126r^8-280r^6+210r^4-60r^2+5)rcos(t)
34 (126r^8-280r^6+210r^4-60r^2+5)rsin(t)
35 252r^10-630r^8+560r^6-210r^4+30r^2-1
36 r^6cos(6t)
37 r^6sin(6t)
38 (7r^2-6)r^5cos(5t)
39 (7r^2-6)r^5sin(5t)
40 924r^12-2772r^10+3150r^8-1680r^6+420r^4-42r^2+1
41 r^7cos(7t)
42 r^7sin(7t)
zern.set.coef
SYNTAX:
zern.set.coef coefArray N value = newcoefArray
FUNCTION:
Changes the "value" of the Zernike coefficient with index "N" in the
Zernike coefficient Array "coefArray." The format of "coefArray" must
be VECTOR2, (<index value>).
EXAMPLE:
a.make "<0 0>" 0 = Z
zern.set.coef Z 1 1.0 = Z
a.dump Z
zern.set.coef Z 2 -1.0 = Z
a.dump Z
zern.set.coef Z 2 2.0 = Z
a.dump Z
This creates an empty (no element) Zernike coefficient Array Z and then
fills it. It first creates a coefficient with index 1. It then creates
a coefficient with index 2 and value -1.0. Finally it changes the value
of coefficient 2 to 2.0.
zern.set.type
SYNTAX:
zern.set.type typestring obscuration
FUNCTION:
Sets the type and obscuration ratio of the Zernike polynomials that will
be used henceforth.
EXAMPLE:
zern.set.type "OTA" 0.3
Sets the Zernike set to OTA Obscured and sets the obscuration ratio to 0.3.