|
template<class T > |
Array< T > | partialSums (const Array< T > &array, const IPosition &collapseAxes) |
| Determine the sum, product, etc. More...
|
|
template<class T > |
Array< T > | partialSumSqrs (const Array< T > &array, const IPosition &collapseAxes) |
|
template<class T > |
Array< T > | partialProducts (const Array< T > &array, const IPosition &collapseAxes) |
|
template<class T > |
Array< T > | partialMins (const Array< T > &array, const IPosition &collapseAxes) |
|
template<class T > |
Array< T > | partialMaxs (const Array< T > &array, const IPosition &collapseAxes) |
|
template<class T > |
Array< T > | partialMeans (const Array< T > &array, const IPosition &collapseAxes) |
|
template<class T > |
Array< T > | partialVariances (const Array< T > &array, const IPosition &collapseAxes, uInt ddof=1) |
|
template<class T > |
Array< T > | partialVariances (const Array< T > &array, const IPosition &collapseAxes, const Array< T > &means) |
|
template<class T > |
Array< T > | partialVariances (const Array< T > &array, const IPosition &collapseAxes, const Array< T > &means, uInt ddof) |
|
template<class T > |
Array< std::complex< T > > | partialVariances (const Array< std::complex< T >> &array, const IPosition &collapseAxes, const Array< std::complex< T >> &means, uInt ddof) |
|
template<class T > |
Array< T > | partialStddevs (const Array< T > &array, const IPosition &collapseAxes, uInt ddof=1) |
|
template<class T > |
Array< T > | partialStddevs (const Array< T > &array, const IPosition &collapseAxes, const Array< T > &means, uInt ddof=1) |
|
template<class T > |
Array< T > | partialAvdevs (const Array< T > &array, const IPosition &collapseAxes) |
|
template<class T > |
Array< T > | partialAvdevs (const Array< T > &array, const IPosition &collapseAxes, const Array< T > &means) |
|
template<class T > |
Array< T > | partialRmss (const Array< T > &array, const IPosition &collapseAxes) |
|
template<class T > |
Array< T > | partialMedians (const Array< T > &array, const IPosition &collapseAxes, Bool takeEvenMean=False, Bool inPlace=False) |
|
template<class T > |
Array< T > | partialMadfms (const Array< T > &array, const IPosition &collapseAxes, Bool takeEvenMean=False, Bool inPlace=False) |
|
template<class T > |
Array< T > | partialFractiles (const Array< T > &array, const IPosition &collapseAxes, Float fraction, Bool inPlace=False) |
|
template<class T > |
Array< T > | partialInterFractileRanges (const Array< T > &array, const IPosition &collapseAxes, Float fraction, Bool inPlace=False) |
|
template<class T > |
Array< T > | partialInterHexileRanges (const Array< T > &array, const IPosition &collapseAxes, Bool inPlace=False) |
|
template<class T > |
Array< T > | partialInterQuartileRanges (const Array< T > &array, const IPosition &collapseAxes, Bool inPlace=False) |
|
template<typename T > |
Array< T > | partialArrayMath (const Array< T > &a, const IPosition &collapseAxes, const ArrayFunctorBase< T > &funcObj) |
| Do partial reduction of an Array object. More...
|
|
template<typename T , typename RES > |
void | partialArrayMath (Array< RES > &res, const Array< T > &a, const IPosition &collapseAxes, const ArrayFunctorBase< T, RES > &funcObj) |
|
template<typename T > |
Array< T > | boxedArrayMath (const Array< T > &a, const IPosition &boxSize, const ArrayFunctorBase< T > &funcObj) |
| Apply the given ArrayMath reduction function objects to each box in the array. More...
|
|
template<typename T , typename RES > |
void | boxedArrayMath (Array< RES > &, const Array< T > &array, const IPosition &boxSize, const ArrayFunctorBase< T, RES > &funcObj) |
|
template<typename T > |
Array< T > | slidingArrayMath (const Array< T > &a, const IPosition &halfBoxSize, const ArrayFunctorBase< T > &funcObj, Bool fillEdge=True) |
| Apply for each element in the array the given ArrayMath reduction function object to the box around that element. More...
|
|
template<typename T , typename RES > |
void | slidingArrayMath (Array< RES > &res, const Array< T > &array, const IPosition &halfBoxSize, const ArrayFunctorBase< T, RES > &funcObj, Bool fillEdge=True) |
|
Mathematical and logical operations for Array parts.
Review Status
- Reviewed By:
- UNKNOWN
- Date Reviewed:
- before2004/08/25
- Test programs:
- tArray
Prerequisite
Etymology
This file contains global functions which perform part by part mathematical or logical operations on arrays.
Synopsis
These functions perform chunk by chunk mathematical operations on arrays. In particular boxed and sliding operations are possible. E.g. to calculate the median in sliding windows making it possible to subtract the background in an image.
The operations to be performed are defined by means of functors that reduce an array subset to a scalar. Those functors are wrappers for ArrayMath and ArrayLogical functions like sum, median, and ntrue.
The partialXX
functions are a special case of the BoxedArrayMath
function. They reduce one or more entire axes which can be done in a faster way than the more general boxedArrayMath
function.
Example
This example calculates the mean of each plane in the data array.
Example
IPosition shp = data.shape();
Array<Double> means =
boxedArrayMath (data, IPosition(2,shp[0],shp[1]),
SumFunc<Double>());
does the same as the first example. Note that in this example the box is formed by the entire axes, but it could also be a subset of it to average, say, boxes of 5*5 elements.
Definition at line 93 of file ArrayPartMath.h.
template<class T >
Array<T> casacore::ArrayPartMath_global_functions_Array_partial_operations::partialSums |
( |
const Array< T > & |
array, |
|
|
const IPosition & |
collapseAxes |
|
) |
| |
Determine the sum, product, etc.
for the given axes only. The result is an array with a shape formed by the remaining axes. For example, for an array with shape [3,4,5], collapsing axis 0 results in an array with shape [4,5] containing, say, the sum for each X line. Summing for axes 0 and 2 results in an array with shape [4] containing, say, the sum for each XZ plane.
Note: ArrayLogical;h contains the functions ntrue, nfalse, partialNTrue and partialNFalse to count the number of true or false elements in an array;
Apply for each element in the array the given ArrayMath reduction function object to the box around that element.
The full box is 2*halfBoxSize + 1. It can be used for arrays and boxes of any dimensionality; missing halfBoxSize values are set to 0.
Example
Determine for each element in the array the median of a box with size [51,51] around that element:
This is a potentially expensive operation. On a high-end PC it took appr. 27 seconds to get the medians for an array of [1000,1000] using a halfBoxSize of [50,50].
The fillEdge argument determines how the edge is filled where no full boxes can be made. True means it is set to zero; False means that the edge is removed, thus the output array is smaller than the input array.
Note: This brute-force method of determining the medians outperforms all kinds of smart implementations; For a vector it is about as fast as class MedianSlider, for a 2D array it is much, much faster;
Definition at line 395 of file ArrayPartMath.h.
References casacore::slidingArrayMath().