Next Previous Up Contents
Next: Fluxes
Up: General Functions
Previous: Maths
Functions which operate on arrayvalued cells.
The array parameters of these functions can only be used on values
which are already arrays (usually, numeric arrays).
In most cases that means on values in table columns which are declared
as arrayvalued. FITS and VOTable tables can have columns which contain
array values, but other formats such as CSV cannot.
If you want to calculate aggregating functions like sum, min, max etc
on multiple values which are not part of an array,
it's easier to use the functions from the Lists
class.
Note that none of these functions will calculate statistical functions
over a whole column of a table.
The functions fall into a number of categories:
 Aggregating operations, which map an array value to a scalar, including
size
,
count
,
countTrue
,
maximum
,
minimum
,
sum
,
mean
,
median
,
quantile
,
stdev
,
variance
,
join
.
 Operations on one or more arrays which produce array results, including
add
,
subtract
,
multiply
,
divide
,
reciprocal
,
condition
.
 The function
array
,
which lets you assemble an array value from a list of scalar numbers.
This can be used with the aggregating functions here,
but it's generally easier to use the corresponding functions from
the Lists
class.

sum( array )
 Returns the sum of all the nonblank elements in the array.
If
array
is not a numeric array, null
is returned.

mean( array )
 Returns the mean of all the nonblank elements in the array.
If
array
is not a numeric array, null
is returned.

variance( array )
 Returns the population variance of all the nonblank elements
in the array. If
array
is not a numeric array,
null
is returned.

stdev( array )
 Returns the population standard deviation of all the nonblank elements
in the array. If
array
is not a numeric array,
null
is returned.

minimum( array )
 Returns the smallest of the nonblank elements in the array.
If
array
is not a numeric array, null
is returned.

maximum( array )
 Returns the largest of the nonblank elements in the array.
If
array
is not a numeric array, null
is returned.

median( array )
 Returns the median of the nonblank elements in the array.
If
array
is not a numeric array, null
is returned.

quantile( array, quant )
 Returns a quantile value of the nonblank elements in the array.
Which quantile is determined by the
quant
value;
values of 0, 0.5 and 1 give the minimum, median and maximum
respectively. A value of 0.99 would give the 99th percentile.

size( array )
 Returns the number of elements in the array.
If
array
is not an array, zero is returned.

count( array )
 Returns the number of nonblank elements in the array.
If
array
is not an array, zero is returned.

countTrue( array )
 Returns the number of true elements in an array of boolean values.

join( array, joiner )
 Returns a string composed of concatenating all the elements of an
array, separated by a joiner string.
If
array
is not an array, null is returned.

add( array1, array2 )
 Returns the result of adding two numeric arrays element by element.
Both arrays must be numeric, and the arrays must have the same length.
If either of those conditions is not true,
null
is returned.
The types of the arrays do not need to be the same,
so for example it is permitted to add an integer array
to a floating point array.

add( array, constant )
 Returns the result of adding a constant value to every element of
a numeric array.
If the supplied
array
argument is not a numeric array,
null
is returned.

subtract( array1, array2 )
 Returns the result of subtracting one numeric array from the other
element by element.
Both arrays must be numeric, and the arrays must have the same length.
If either of those conditions is not true,
null
is returned.
The types of the arrays do not need to be the same,
so for example it is permitted to subtract an integer array
from a floating point array.

multiply( array1, array2 )
 Returns the result of multiplying two numeric arrays element by element.
Both arrays must be numeric, and the arrays must have the same length.
If either of those conditions is not true,
null
is returned.
The types of the arrays do not need to be the same,
so for example it is permitted to multiply an integer array
by a floating point array.

multiply( array, constant )
 Returns the result of multiplying every element of a numeric array
by a constant value.
If the supplied
array
argument is not a numeric array,
null
is returned.

divide( array1, array2 )
 Returns the result of dividing two numeric arrays element by element.
Both arrays must be numeric, and the arrays must have the same length.
If either of those conditions is not true,
null
is returned.
The types of the arrays do not need to be the same,
so for example it is permitted to divide an integer array
by a floating point array.

reciprocal( array )
 Returns the result of taking the reciprocal of every element of
a numeric array.
If the supplied
array
argument is not a numeric array,
null
is returned.

condition( flagArray, trueValue, falseValue )
 Maps a boolean array to a numeric array by using supplied numeric
values to represent true and false values from the input array.
This has the same effect as applying the expression
outArray[i] = flagArray[i] ? trueValue : falseValue
.

array( values, ... )
 Returns a floating point numeric array built from the given arguments.

intArray( values, ... )
 Returns an integer numeric array built from the given arguments.

stringArray( values, ... )
 Returns a String array built from the given arguments.
Next Previous Up Contents
Next: Fluxes
Up: General Functions
Previous: Maths
TOPCAT  Tool for OPerations on Catalogues And Tables
Starlink User Note253
TOPCAT web page:
http://www.starlink.ac.uk/topcat/
Author email:
m.b.taylor@bristol.ac.uk
Mailing list:
topcatuser@jiscmail.ac.uk