casacore
|
Base class for an array with an optional mask. More...
#include <MArrayBase.h>
Public Member Functions | |
Bool | isNull () const |
Is the array null? More... | |
void | removeMask () |
Remove the mask. More... | |
Bool | hasMask () const |
Is there a mask? More... | |
void | setMask (const Array< Bool > &mask) |
Set the mask. More... | |
const Array< Bool > & | mask () const |
Get the mask. More... | |
Array< Bool > & | wmask () |
Int64 | nvalid () const |
Return the number of valid array values, thus unflagged elements. More... | |
Bool | empty () const |
Is the array empty? More... | |
uInt | ndim () const |
Get the dimensionality. More... | |
const IPosition & | shape () const |
Get the shape. More... | |
size_t | size () const |
Get the size. More... | |
size_t | nelements () const |
Array< Bool > | combineMask (const MArrayBase &other) const |
Combine this and the other mask. More... | |
Protected Member Functions | |
MArrayBase (Bool isNull) | |
The default constructor creates an empty mask. More... | |
MArrayBase (const ArrayBase &arr, const Array< Bool > &mask, Bool isNull) | |
Construct from a given array shape and mask. More... | |
MArrayBase (const ArrayBase &arr, const MArrayBase &marray) | |
Construct from a given array shape and mask from another MArray. More... | |
void | setBase (const ArrayBase &arr, const Array< Bool > &mask) |
Reference the mask and set the shape. More... | |
void | referenceBase (const MArrayBase &other) |
Reference another MArray. More... | |
void | resizeBase (const ArrayBase &arr, Bool useMask) |
Set the array shape and resize the mask. More... | |
Private Member Functions | |
void | init () |
Initialize and check. More... | |
void | fillNValid () const |
Fill the number of valid values. More... | |
Private Attributes | |
Array< Bool > | itsMask |
IPosition | itsShape |
size_t | itsSize |
Int64 | itsNValid |
Bool | itsNull |
Base class for an array with an optional mask.
Internal
This class is the base class of the templated class MArray. It contains the functions that are not template dependent.
MArray is developed to make it easier to handle arrays with an optional mask. The array is always present, but the mask is optional. MArrayMath contains functions to operate on such arrays.
Similar to numpy.masked_array and the MeasurementSet FLAG definition, a mask value True means that the corresponding value is masked off, thus is not taken into account in reduction functions like sum
. on a masked array. In operations like addition, masked off values are processed because testing the mask value is more expensive than an addition (even if the value is a NaN). For an operation with multiple operands, the mask of the result is the OR of the operand masks.
MArray can be null meaning that the array is a null value. It can be used to indicate that a table cell does not contain an array. A null MArray has an empty array and mask. Operations where an operand is a null MArray, result in a null MArray.
Definition at line 84 of file MArrayBase.h.
|
inlineexplicitprotected |
The default constructor creates an empty mask.
Definition at line 88 of file MArrayBase.h.
|
protected |
Construct from a given array shape and mask.
|
protected |
Construct from a given array shape and mask from another MArray.
Array<Bool> casacore::MArrayBase::combineMask | ( | const MArrayBase & | other | ) | const |
Combine this and the other mask.
One or both MArray-s can be unmasked.
Referenced by casacore::MArrayMath_global_functions_MArray_mathematical_operations::atan2(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::floormod(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::fmod(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::max(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::min(), casacore::MArrayLogical_global_functions_MArray_logical_operations::near(), casacore::MArrayLogical_global_functions_MArray_logical_operations::nearAbs(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator!=(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator%(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator&(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator&&(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator*(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator+(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator-(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator/(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator==(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator>(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator>=(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator^(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator|(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator||(), and casacore::MArrayMath_global_functions_MArray_mathematical_operations::pow().
|
inline |
Is the array empty?
Definition at line 139 of file MArrayBase.h.
References itsSize.
Referenced by casacore::MArrayMath_global_functions_MArray_mathematical_operations::fractile(), and casacore::MArrayMath_global_functions_MArray_mathematical_operations::median().
|
private |
Fill the number of valid values.
Referenced by nvalid().
|
inline |
Is there a mask?
Definition at line 119 of file MArrayBase.h.
References casacore::ArrayBase::empty(), and itsMask.
Referenced by casacore::MArrayLogical_global_functions_MArray_logical_operations::allEQ(), casacore::MArrayLogical_global_functions_MArray_logical_operations::anyEQ(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::avdev(), casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedAlls(), casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedAnys(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedArrayMath(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedAvdevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedFractiles(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMaxs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMeans(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMedians(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMins(), casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedNFalse(), casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedNTrue(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedProducts(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedRmss(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedStddevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedSums(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedSumSqrs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedVariances(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::fractile(), casacore::TableExprGroupAggr::getArray(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::max(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::mean(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::median(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::min(), casacore::MArrayLogical_global_functions_MArray_logical_operations::nfalse(), casacore::MArrayLogical_global_functions_MArray_logical_operations::ntrue(), casacore::MArray< casacore::String >::operator()(), casacore::MArrayLogical_global_functions_MArray_logical_operations::partialAlls(), casacore::MArrayLogical_global_functions_MArray_logical_operations::partialAnys(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialArrayMath(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialAvdevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialFractiles(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMaxs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMeans(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMedians(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMins(), casacore::MArrayLogical_global_functions_MArray_logical_operations::partialNFalse(), casacore::MArrayLogical_global_functions_MArray_logical_operations::partialNTrue(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialProducts(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialRmss(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialStddevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialSums(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialSumSqrs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialVariances(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::product(), casacore::MArrayUtil_global_functions_reorderMArray::reorderArray(), casacore::MArrayUtil_global_functions_reverseMArray::reverseArray(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::rms(), casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingAlls(), casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingAnys(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingArrayMath(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingAvdevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingFractiles(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMaxs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMeans(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMedians(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMins(), casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingNFalse(), casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingNTrue(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingProducts(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingRmss(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingStddevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingSums(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingSumSqrs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingVariances(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::sum(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::sumsqr(), casacore::TableExprNodeSet::toArray(), and casacore::MArrayMath_global_functions_MArray_mathematical_operations::variance().
|
private |
Initialize and check.
|
inline |
Is the array null?
Definition at line 111 of file MArrayBase.h.
References itsNull.
Referenced by casacore::MArrayLogical_global_functions_MArray_logical_operations::allEQ(), casacore::MArrayLogical_global_functions_MArray_logical_operations::anyEQ(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::atan2(), casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedAlls(), casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedAnys(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedAvdevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedFractiles(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMaxs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMeans(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMedians(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedMins(), casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedNFalse(), casacore::MArrayLogical_global_functions_MArray_logical_operations::boxedNTrue(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedProducts(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedRmss(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedStddevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedSums(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedSumSqrs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedVariances(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::floormod(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::fmod(), casacore::TableExprGroupAggr::getArray(), casacore::MArray< casacore::String >::MArray(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::max(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::min(), casacore::MArrayLogical_global_functions_MArray_logical_operations::near(), casacore::MArrayLogical_global_functions_MArray_logical_operations::nearAbs(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator!=(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator%(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator&(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator&&(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator*(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator+(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator-(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator/(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator==(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator>(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator>=(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator^(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::operator|(), casacore::MArrayLogical_global_functions_MArray_logical_operations::operator||(), casacore::MArrayLogical_global_functions_MArray_logical_operations::partialAlls(), casacore::MArrayLogical_global_functions_MArray_logical_operations::partialAnys(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialAvdevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialFractiles(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMaxs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMeans(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMedians(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialMins(), casacore::MArrayLogical_global_functions_MArray_logical_operations::partialNFalse(), casacore::MArrayLogical_global_functions_MArray_logical_operations::partialNTrue(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialProducts(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialRmss(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialStddevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialSums(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialSumSqrs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialVariances(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::pow(), casacore::MArrayUtil_global_functions_reorderMArray::reorderArray(), casacore::MArrayUtil_global_functions_reverseMArray::reverseArray(), casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingAlls(), casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingAnys(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingAvdevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingFractiles(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMaxs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMeans(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMedians(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingMins(), casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingNFalse(), casacore::MArrayLogical_global_functions_MArray_logical_operations::slidingNTrue(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingProducts(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingRmss(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingStddevs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingSums(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingSumSqrs(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingVariances(), and casacore::TableExprNodeSet::toArray().
Get the mask.
The returned array is empty if there is no mask.
Definition at line 126 of file MArrayBase.h.
References itsMask.
Referenced by casacore::MArrayLogical_global_functions_MArray_logical_operations::allEQ(), casacore::MArrayLogical_global_functions_MArray_logical_operations::anyEQ(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::avdev(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedArrayMath(), casacore::TableExprGroupAggr::getArray(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::max(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::min(), casacore::MArrayLogical_global_functions_MArray_logical_operations::nfalse(), casacore::MArrayLogical_global_functions_MArray_logical_operations::ntrue(), casacore::MArray< casacore::String >::operator()(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialArrayMath(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::product(), casacore::MArrayUtil_global_functions_reorderMArray::reorderArray(), casacore::MArrayUtil_global_functions_reverseMArray::reverseArray(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::rms(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingArrayMath(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::sum(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::sumsqr(), casacore::TableExprNodeSet::toArray(), and casacore::MArrayMath_global_functions_MArray_mathematical_operations::variance().
|
inline |
Get the dimensionality.
Definition at line 143 of file MArrayBase.h.
References itsShape, and casacore::IPosition::size().
Referenced by casacore::TableExprGroupAggr::getArray().
|
inline |
Definition at line 154 of file MArrayBase.h.
References itsSize.
Referenced by casacore::MArrayMath_global_functions_MArray_mathematical_operations::median(), and casacore::MArrayMath_global_functions_MArray_mathematical_operations::medianInPlace().
|
inline |
Return the number of valid array values, thus unflagged elements.
Definition at line 132 of file MArrayBase.h.
References fillNValid(), and itsNValid.
Referenced by casacore::MArrayMath_global_functions_MArray_mathematical_operations::avdev(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::mean(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::rms(), and casacore::MArrayMath_global_functions_MArray_mathematical_operations::variance().
|
protected |
Reference another MArray.
Referenced by casacore::MArray< casacore::String >::reference().
|
inline |
Remove the mask.
Definition at line 115 of file MArrayBase.h.
References itsMask, itsNValid, itsSize, and casacore::Array< T, Alloc >::resize().
Set the array shape and resize the mask.
Referenced by casacore::MArray< casacore::String >::fill(), casacore::MArray< casacore::String >::MArray(), and casacore::MArray< casacore::String >::resize().
Reference the mask and set the shape.
Referenced by casacore::MArray< casacore::String >::fill(), and casacore::MArray< casacore::String >::MArray().
Set the mask.
It checks if it matches the array shape.
Referenced by casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedArrayMath(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::partialArrayMath(), and casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingArrayMath().
|
inline |
Get the shape.
Definition at line 147 of file MArrayBase.h.
References itsShape.
Referenced by casacore::MArrayMath_global_functions_MArray_mathematical_operations::boxedArrayMath(), casacore::TableExprGroupAggr::getArray(), casacore::MArrayMath_global_functions_MArray_mathematical_operations::slidingArrayMath(), and casacore::TableExprNodeSet::toArray().
|
inline |
Get the size.
Definition at line 152 of file MArrayBase.h.
References itsSize.
Referenced by casacore::MArrayMath_global_functions_MArray_mathematical_operations::fractile(), and casacore::MArrayMath_global_functions_MArray_mathematical_operations::median().
Definition at line 128 of file MArrayBase.h.
References itsMask.
Definition at line 170 of file MArrayBase.h.
Referenced by hasMask(), mask(), removeMask(), and wmask().
|
private |
Definition at line 174 of file MArrayBase.h.
Referenced by isNull().
|
mutableprivate |
Definition at line 173 of file MArrayBase.h.
Referenced by nvalid(), and removeMask().
|
private |
Definition at line 171 of file MArrayBase.h.
|
private |
Definition at line 172 of file MArrayBase.h.
Referenced by empty(), nelements(), removeMask(), and size().