File: msiterator.h

package info (click to toggle)
aoflagger 3.0.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 4,476 kB
  • sloc: cpp: 51,868; python: 152; sh: 25; makefile: 17
file content (77 lines) | stat: -rw-r--r-- 2,309 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#ifndef MS_ITERATOR_H
#define MS_ITERATOR_H

#include "antennainfo.h"

#include <casacore/ms/MeasurementSets/MSColumns.h>

#include <casacore/ms/MeasurementSets/MeasurementSet.h>
#include <casacore/tables/Tables/ArrayColumn.h>
#include <casacore/tables/Tables/ScalarColumn.h>

class [[deprecated]] MSIterator {
public:
	MSIterator(const casacore::MeasurementSet& ms, bool hasCorrectedData=true);

	MSIterator &operator++() { _row++; return *this; }

	casacore::Complex Data(unsigned frequencyIndex, unsigned polarisation)
	{
		return (_dataCol)(_row)(casacore::IPosition(2, frequencyIndex, polarisation));
	}

	bool Flag(unsigned frequencyIndex, unsigned polarisation)
	{
		return (_flagCol)(_row)(casacore::IPosition(2, frequencyIndex, polarisation));
	}
	
	casacore::Array<bool>::const_iterator FlagIterator()
	{
		return (_flagCol)(_row).begin();
	}

	casacore::Complex CorrectedData(unsigned frequencyIndex, unsigned polarisation)
	{
		return (*_correctedDataCol)(_row)(casacore::IPosition(2, frequencyIndex, polarisation));
	}

	casacore::Array<casacore::Complex>::const_iterator CorrectedDataIterator()
	{
		return (*_correctedDataCol)(_row).begin();
	}

	int Field() { return (_fieldCol)(_row); }
	double Time() { return (_timeCol)(_row); }
	unsigned Antenna1() { return (_antenna1Col)(_row); }
	unsigned Antenna2() { return (_antenna2Col)(_row); }
	unsigned ScanNumber() { return (_scanNumberCol)(_row); }
	class UVW UVW() {
		class UVW uvw;
		casacore::Array<double> arr = (_uvwCol)(_row);
		casacore::Array<double>::const_iterator i = arr.begin();
		uvw.u = *i; ++i;
		uvw.v = *i; ++i;
		uvw.w = *i;
		return uvw;
	}
	unsigned Window() { return (_windowCol)(_row); }
	
private:
	MSIterator(const MSIterator&) = delete;
	MSIterator& operator=(const MSIterator&) = delete;
	unsigned long _row;
	
	casacore::MeasurementSet _ms;
	casacore::ScalarColumn<int> _antenna1Col;
	casacore::ScalarColumn<int> _antenna2Col;
	casacore::ArrayColumn<casacore::Complex> _dataCol;
	casacore::ArrayColumn<bool> _flagCol;
	std::unique_ptr<casacore::ArrayColumn<casacore::Complex>> _correctedDataCol;
	casacore::ScalarColumn<double> _timeCol;
	casacore::ScalarColumn<int> _fieldCol;
	casacore::ScalarColumn<int> _scanNumberCol;
	casacore::ArrayColumn<double> _uvwCol;
	casacore::ScalarColumn<int> _windowCol;
};

#endif