Next Previous Up Contents
Next: Fluxes
Up: General Functions
Previous: Maths
Functions which operate on array-valued 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 array-valued. FITS and VOTable tables can have columns which contain
array values, but other formats such as CSV cannot.
The functions fall into a number of categories:
- Aggregating operations, which map an array value to a scalar, including
size
,
count
,
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
.
- A set of functions named
array
with various
numbers of arguments, which let you assemble an array value from a list
of scalar numbers. This can be used for instance to get the mean of
a set of three magnitudes by using an expression like
"mean(array(jmag, hmag, kmag))
".
-
sum( array )
- Returns the sum of all the non-blank elements in the array.
If
array
is not a numeric array, null
is returned.
-
mean( array )
- Returns the mean of all the non-blank elements in the array.
If
array
is not a numeric array, null
is returned.
-
variance( array )
- Returns the population variance of all the non-blank elements
in the array. If
array
is not a numeric array,
null
is returned.
-
stdev( array )
- Returns the population standard deviation of all the non-blank elements
in the array. If
array
is not a numeric array,
null
is returned.
-
minimum( array )
- Returns the smallest of the non-blank elements in the array.
If
array
is not a numeric array, null
is returned.
-
maximum( array )
- Returns the largest of the non-blank elements in the array.
If
array
is not a numeric array, null
is returned.
-
median( array )
- Returns the median of the non-blank elements in the array.
If
array
is not a numeric array, null
is returned.
-
quantile( array, quant )
- Returns a quantile value of the non-blank 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 non-blank elements in the array.
If
array
is not an array, zero is returned.
-
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( x1 )
- Returns a numeric array built from a given element.
-
array( x1, x2 )
- Returns a numeric array built from given elements.
-
array( x1, x2, x3 )
- Returns a numeric array built from given elements.
-
array( x1, x2, x3, x4 )
- Returns a numeric array built from given elements.
-
array( x1, x2, x3, x4, x5 )
- Returns a numeric array built from given elements.
-
array( x1, x2, x3, x4, x5, x6 )
- Returns a numeric array built from given elements.
-
array( x1, x2, x3, x4, x5, x6, x7 )
- Returns a numeric array built from given elements.
-
array( x1, x2, x3, x4, x5, x6, x7, x8 )
- Returns a numeric array built from given elements.
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:
topcat-user@bristol.ac.uk