-
Notifications
You must be signed in to change notification settings - Fork 3
/
mwams.h
114 lines (88 loc) · 2.57 KB
/
mwams.h
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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
#ifndef MWA_MS
#define MWA_MS
#include <string>
struct MWAMSEnums
{
enum MWATables
{
MWA_TILE_POINTING_TABLE, MWA_SUBBAND_TABLE
};
enum MWAColumns
{
/* Antenna */
MWA_INPUT, MWA_TILE_NR, MWA_RECEIVER, MWA_SLOT, MWA_CABLE_LENGTH,
/* Field */
MWA_HAS_CALIBRATOR,
/* Observation */
MWA_GPS_TIME, MWA_FILENAME, MWA_OBSERVATION_MODE,
MWA_FLAG_WINDOW_SIZE, MWA_DATE_REQUESTED,
/* Spectral window */
MWA_CENTRE_SUBBAND_NR,
/* MWA_TILE_POINTING */
INTERVAL, DELAYS, DIRECTION,
/* MWA_SUBBAND */
NUMBER, GAIN, FLAG_ROW
};
enum MWAKeywords
{
MWA_FIBER_VEL_FACTOR, MWA_METADATA_VERSION,
MWA_MWAPY_VERSION,
MWA_COTTER_VERSION, MWA_COTTER_VERSION_DATE
};
};
class MWAMS
{
public:
struct MWAAntennaInfo {
int inputX, inputY, tileNr, receiver, slotX, slotY;
double cableLengthX, cableLengthY;
};
struct MWAObservationInfo {
double gpsTime;
std::string filename, observationMode;
double rawFileCreationDate;
int flagWindowSize;
double dateRequested;
};
MWAMS(const std::string &filename);
~MWAMS();
void InitializeMWAFields()
{
addMWAAntennaFields();
addMWAFieldFields();
addMWAObservationFields();
addMWASpectralWindowFields();
addMWATilePointingFields();
addMWASubbandFields();
}
void UpdateMWAAntennaInfo(size_t antennaIndex, const MWAAntennaInfo &info);
void UpdateMWAFieldInfo(bool hasCalibrator);
void UpdateMWAObservationInfo(const MWAObservationInfo &info);
void UpdateSpectralWindowInfo(int mwaCentreSubbandNr);
void WriteMWATilePointingInfo(double start, double end, const int *delays, double directionRA, double directionDec);
void WriteMWASubbandInfo(int number, double gain, bool isFlagged);
void WriteMWAKeywords(const std::string& metaDataVersion, const std::string& mwaPyVersion, const std::string& cotterVersion, const std::string& cotterVersionDate);
private:
void addMWAAntennaFields();
void addMWAFieldFields();
void addMWAObservationFields();
void addMWASpectralWindowFields();
void addMWATilePointingFields();
void addMWASubbandFields();
const std::string &columnName(enum MWAMSEnums::MWAColumns column)
{
return _columnNames[(int) column];
}
const std::string &tableName(enum MWAMSEnums::MWATables table)
{
return _tableNames[(int) table];
}
const std::string &keywordName(enum MWAMSEnums::MWAKeywords keyword)
{
return _keywordNames[(int) keyword];
}
static const std::string _columnNames[], _tableNames[], _keywordNames[];
const std::string _filename;
struct MWAMSData *_data;
};
#endif