File: rfihistory.cpp

package info (click to toggle)
aoflagger 2.13.0-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 4,232 kB
  • sloc: cpp: 61,805; python: 60; sh: 23; makefile: 8
file content (47 lines) | stat: -rw-r--r-- 1,522 bytes parent folder | download | duplicates (3)
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
#include <iostream>

#include <libgen.h>

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

#include "structures/date.h"

int main(int argc, char **argv)
{
	if(argc != 2)
	{
		std::cout << "Usage: " << argv[0] << " <ms1>\n"
		"This program will list the RFI actions that have been performed on the measurement \n"
		"set, by reading the HISTORY table in the set.\n";
	}
	else
	{
		std::ostream &stream(std::cout);

		casacore::MeasurementSet ms(argv[1]);
		casacore::Table histtab(ms.history());
		casacore::ROScalarColumn<double>       time        (histtab, "TIME");
		casacore::ROScalarColumn<casacore::String> application (histtab, "APPLICATION");
		casacore::ROArrayColumn<casacore::String>  cli         (histtab, "CLI_COMMAND");
		casacore::ROArrayColumn<casacore::String>  parms       (histtab, "APP_PARAMS");
		for(unsigned i=0;i<histtab.nrow();++i)
		{
			if(application(i) == "AOFlagger")
			{
				stream << "====================\n"
					"Command: " << cli(i)[0] << "\n"
					"Date: " << Date::AipsMJDToDateString(time(i)) << "\n"
					"Time: " << Date::AipsMJDToTimeString(time(i)) << "\n"
					"Strategy: \n     ----------     \n";
				const casacore::Vector<casacore::String> appParamsVec = parms(i);
				for(casacore::Vector<casacore::String>::const_iterator j=appParamsVec.begin();j!=appParamsVec.end();++j)
				{
					stream << *j << '\n';
				}
				stream << "     ----------     \n";
			}
		}
	}
}