30 #ifndef MSVIS_STATISTICS_VI2_DATA_PROVIDER_H_
31 #define MSVIS_STATISTICS_VI2_DATA_PROVIDER_H_
46 #include <unordered_map>
47 #include <unordered_set>
83 template <
class DataIterator,
class MaskIterator,
class WeightsIterator>
102 const std::set<casacore::MSMainEnums::PredefinedColumns>
108 , component(component)
109 , use_data_weights(use_data_weights)
110 , omit_flagged_data(omit_flagged_data) {
119 for (
auto &&i : mergedColumns_)
160 "Data provider increment beyond end of dataset");
184 std::unique_ptr<DataIterator>(
new DataIterator(
dataArray()));
201 new MaskIterator(
vi2->getVisBuffer()));
220 new WeightsIterator(
vi2->getVisBuffer()));
265 std::unique_ptr<std::unordered_map<int,std::string> >
268 iteratee.
nextDataset(statistics, columnValues.get());
274 std::unique_ptr<vi::VisibilityIterator2>
vi2;
311 if (
vi2->moreChunks())
328 if (
vi2->moreChunks())
332 return vi2->moreChunks();
351 std::unique_ptr<std::unordered_map<int,std::string> >
354 return std::unique_ptr<std::unordered_map<int,std::string> >(
355 new std::unordered_map<int,std::string> {
356 {casacore::MSMainEnums::PredefinedColumns::ARRAY_ID,
358 {casacore::MSMainEnums::PredefinedColumns::FIELD_ID,
360 {casacore::MSMainEnums::PredefinedColumns::DATA_DESC_ID,
363 {casacore::MSMainEnums::PredefinedColumns::TIME,
366 {casacore::MSMainEnums::PredefinedColumns::SCAN_NUMBER,
368 {casacore::MSMainEnums::PredefinedColumns::STATE_ID,
373 std::map<casacore::MSMainEnums::PredefinedColumns,std::string>
columnNames = {
374 {casacore::MSMainEnums::PredefinedColumns::ARRAY_ID,
"ARRAY_ID"},
375 {casacore::MSMainEnums::PredefinedColumns::FIELD_ID,
"FIELD_ID"},
376 {casacore::MSMainEnums::PredefinedColumns::DATA_DESC_ID,
"DATA_DESC_ID"},
377 {casacore::MSMainEnums::PredefinedColumns::TIME,
"TIME"}};
384 template<
class DataIterator>
393 template<
class DataIterator>
400 template<
class DataIterator>
407 template<
class DataIterator>
414 #endif // MSVIS_STATISTICS_VI2_DATA_PROVIDER_H_
const casacore::Bool omit_flagged_data
DataIterator DataIteratorType
std::unique_ptr< const DataIterator > data_iterator
casacore::Bool hasWeights() const
Does the current data set have associated weights?
MaskIterator MaskIteratorType
VisibilityIterator2 iterates through one or more readonly MeasurementSets.
vi::VisBufferComponent2 component
Weights iterator over weights cube.
DataIterator getData()
Get the current sub-chunk.
unsigned long long uInt64
virtual const casacore::Vector< casacore::Int > & arrayId() const =0
void operator++()
Increment the data provider to the sub-chunk within the dataset.
DataIterator::AccumType AccumType
Define typedefs for some template parameters.
virtual void nextDataset(casacore::StatisticsAlgorithm< AccumType, DataIterator, MaskIterator, WeightsIterator > &stats, const std::unordered_map< int, std::string > *columnValues)=0
This method will be called by Vi2DataProvider::foreachDataset() for each dataset composed of one or m...
Abstract base class which defines interface for providing "datasets" to the statistics framework in c...
Mask iterator over row flags.
DataRanges getRanges()
Get the associated range(s) of the current sub-chunk.
virtual const casacore::Vector< casacore::Double > & timeInterval() const =0
virtual const casacore::Vector< casacore::Int > & stateId() const =0
virtual const casacore::Matrix<casacore::Float> & sigmaMat () const = 0; // [nC,nR] ...
virtual const casacore::Vector< casacore::Int > & dataDescriptionIds() const =0
virtual casacore::Int dataDescriptionId () const = 0; virtual void setDataDescriptionId (casacore::In...
void finalize()
Take any actions necessary to finalize the provider.
std::unique_ptr< const WeightsIterator > weights_iterator
const casacore::Bool use_data_weights
void reset()
Reset the provider to point to the first sub-chunk of the dataset.
casacore::uInt64 getCount()
get the count of elements in the current data set.
casacore::Bool atEnd() const
Is this the last sub-chunk within the dataset?
Weights iterator over row weights.
virtual void setDataProvider(StatsDataProvider< CASA_STATP > *dataProvider)
instead of setting and adding data "by hand", set the data provider that will provide all the data se...
This class is used to encapsulate the action(s) taken on a sequence of casacore::StatisticsAlgorithm ...
std::unique_ptr< std::unordered_map< int, std::string > > mkColumnValues()
std::unique_ptr< const MaskIterator > mask_iterator
virtual const casacore::Array< typename DataIterator::DataType > & dataArray()=0
WeightsIterator WeightsIteratorType
virtual const casacore::Vector< casacore::Int > & scan() const =0
bool existsColumn(VisBufferComponent2 id) const
Returns true if the specified column exists.
Vi2DataProvider & operator=(Vi2DataProvider &&other)
bool Bool
Define the standard types used by Casacore.
virtual const casacore::Vector< casacore::Int > & fieldId() const =0
Weights iterator over sigma cube.
std::unordered_set< string > mergedColumns
Vi2DataProvider(Vi2DataProvider &&other)
casacore::StatsDataProvider template class backed by VisibilityIterator2 instances.
template <class T, class U> class vector;
std::string to_string(int i)
unsigned datasetChunkOrigin
casacore::Bool isInclude() const
If the associated data set has ranges, are these include (return true) or exclude (return false) rang...
Mask iterator over flag cube.
casacore::uInt getMaskStride()
Get the stride for the current mask (only called if hasMask() returns true).
VisBuffer2s encapsulate one chunk of visibility data for processing.
Base class for all Casacore library errors.
void foreachDataset(casacore::StatisticsAlgorithm< AccumType, DataIteratorType, MaskIteratorType, WeightsIteratorType > &statistics, Vi2StatisticsIteratee< DataIterator, WeightsIterator, MaskIterator > &iteratee)
void updateFollowingChunkDatasetIndex()
std::unique_ptr< vi::VisibilityIterator2 > vi2
Weights iterator over row sigmas.
int followingChunkDatasetIndex
WeightsIterator getWeights()
Get the associated weights of the current sub-chunk.
casacore::uInt getStride()
Get the stride for the current data set.
Vi2DataProvider(vi::VisibilityIterator2 *vi2, const std::set< casacore::MSMainEnums::PredefinedColumns > &mergedColumns_, vi::VisBufferComponent2 component, casacore::Bool omit_flagged_data, casacore::Bool use_data_weights)
std::map< casacore::MSMainEnums::PredefinedColumns, std::string > columnNames
Base class of statistics algorithm class hierarchy.
MaskIterator getMask()
Get the associated mask of the current sub-chunk.
Vi2DataProvider< DataIterator, Vi2StatsFlagsRowIterator, Vi2StatsWeightsRowIterator > Vi2WeightsRowDataProvider
casacore::Data provider template for row-based casacore::MS columns (i.e, not visibilities) using the...
casacore::Bool hasRanges() const
Does the current data set have associated range(s)?
casacore::Bool hasMask() const
Does the current data set have an associated mask?
virtual const casacore::Vector< casacore::Double > & time() const =0