int main(int argc, char *argv[]) { #ifdef HAS_LOFARSTMAN register_lofarstman(); #endif // HAS_LOFARSTMAN if(argc < 2) { printSyntax(std::cerr, argv); return -1; } else { const std::string action = argv[1]; if(action == "help") { if(argc != 3) { printSyntax(std::cout, argv); } else { std::string helpAction = argv[2]; if(helpAction == "help") { printSyntax(std::cout, argv); } else if(helpAction == "collect") { std::cout << "Syntax: " << argv[0] << " collect [-a] <ms> [quack timesteps] [list of antennae]\n\n" "The collect action will go over a whole measurement set and \n" "collect the default statistics. It will write the results in the \n" "quality subtables of the main measurement set.\n\n" "Currently, the default statistics are:\n" "\tRFIRatio, Count, Mean, SumP2, DCount, DMean, DSumP2.\n" "The subtables that will be updated are:\n" "\tQUALITY_KIND_NAME, QUALITY_TIME_STATISTIC,\n" "\tQUALITY_FREQUENCY_STATISTIC and QUALITY_BASELINE_STATISTIC.\n\n" "-c will use the CORRECTED_DATA column.\n"; } else if(helpAction == "summarize") { std::cout << "Syntax: " << argv[0] << " summarize <ms>\n\n" "Gives a summary of the statistics in the measurement set.\n"; } else if(helpAction == "query_b") { std::cout << "Syntax: " << argv[0] << " query_b <kind> <ms>\n\n" "Prints the given statistic for each baseline.\n"; } else if(helpAction == "query_t") { std::cout << "Syntax: " << argv[0] << " query_t <kind> <ms>\n\n" "Print the given statistic for each time step.\n"; } else if(helpAction == "query_g") { std::cout << "Syntax " << argv[0] << " query_g <kind> <ms>\n\n" "Print the given statistic for this measurement set.\n"; } else if(helpAction == "combine") { std::cout << "Syntax: " << argv[0] << " combine <target_ms> [<in_ms> [<in_ms> ..]]\n\n" "This will read all given input measurement sets, combine the statistics and \n" "write the results to a target measurement set. The target measurement set should\n" "not exist beforehand.\n"; } else if(helpAction == "histogram") { std::cout << "Syntax: " << argv[0] << " histogram <query> <ms>]\n\n" "Query can be:\n" "\trfislope - performs linear regression on the part of the histogram that should contain the RFI.\n" "\t Reports one value per polarisation.\n"; } else if(helpAction == "remove") { std::cout << "Syntax: " << argv[0] << " remove [ms]\n\n" "This will completely remove all quality tables from the measurement set.\n"; } else { std::cerr << "Unknown action specified in help.\n"; return -1; } } } else if(action == "collect" || action == "mwacollect") { bool mwacollect = (action == "mwacollect"); if(argc < 3) { std::cerr << "collect actions needs one or two parameters (the measurement set)\n"; return -1; } else { bool histograms = (std::string(argv[2]) == "-h"); int argi = histograms ? 3 : 2; std::string filename = argv[argi]; size_t flaggedTimesteps = 0; ++argi; std::set<size_t> flaggedAntennae; if(argi != argc) { flaggedTimesteps = atoi(argv[argi]); ++argi; while(argi != argc) { flaggedAntennae.insert(atoi(argv[argi])); ++argi; } } actionCollect(filename, histograms ? CollectHistograms : CollectDefault, mwacollect, flaggedTimesteps, flaggedAntennae); } } else if(action == "combine") { if(argc < 3 ) { std::cerr << "combine actions needs at least one parameter.\n"; return -1; } else { std::string outFilename = argv[2]; std::vector<std::string> inFilenames; for(int i=3;i<argc;++i) inFilenames.push_back(argv[i]); actionCombine(outFilename, inFilenames); } } else if(action == "histogram") { if(argc != 4) { std::cerr << "histogram actions needs two parameters (the query and the measurement set)\n"; return -1; } else { actionHistogram(argv[3], argv[2], false); } } else if(action == "summarize") { if(argc != 3) { std::cerr << "summarize actions needs one parameter (the measurement set)\n"; return -1; } else { actionSummarize(argv[2]); } } else if(action == "summarizerfi") { if(argc != 3) { std::cerr << "summarizerfi actions needs one parameter (the measurement set)\n"; return -1; } else { actionSummarizeRFI(argv[2]); } } else if(action == "query_g") { if(argc != 4) { std::cerr << "Syntax for query global stat: 'aoquality query_g <KIND> <MS>'\n"; return -1; } else { actionQueryGlobalStat(argv[2], argv[3]); } } else if(action == "query_b") { if(argc != 4) { std::cerr << "Syntax for query baselines: 'aoquality query_b <KIND> <MS>'\n"; return -1; } else { actionQueryBaselines(argv[2], argv[3]); } } else if(action == "query_t") { if(argc != 4) { std::cerr << "Syntax for query times: 'aoquality query_t <KIND> <MS>'\n"; return -1; } else { actionQueryTime(argv[2], argv[3]); return 0; } } else if(action == "remove") { if(argc != 3) { std::cerr << "Syntax for removing quality tables: 'aoquality remove <MS>'\n"; return -1; } else { actionRemove(argv[2]); return 0; } } else { std::cerr << "Unknown action '" << action << "'.\n\n"; printSyntax(std::cerr, argv); return -1; } return 0; } }
/** * Implementation of File API exposed to JavaScript. * @return true if message was handled, false if not. */ void PhoneGapFile::handleMessage(JSONMessage& message) { if (message.getParam("action") == "requestFileSystem") { actionRequestFileSystem(message); } else if (message.getParam("action") == "resolveLocalFileSystemURI") { actionResolveLocalFileSystemURI(message); } else if (message.getParam("action") == "getFile") { actionGetFile(message); } else if (message.getParam("action") == "getDirectory") { actionGetDirectory(message); } else if (message.getParam("action") == "getFileMetadata") { actionGetFileMetadata(message); } else if (message.getParam("action") == "getMetadata") { actionGetMetadata(message); } else if (message.getParam("action") == "write") { actionWrite(message); } else if (message.getParam("action") == "readAsText") { actionReadAsText(message); } else if (message.getParam("action") == "readAsDataURL") { actionReadAsDataURL(message); } else if (message.getParam("action") == "truncate") { actionTruncate(message); } else if (message.getParam("action") == "copyTo") { actionCopyTo(message); } else if (message.getParam("action") == "moveTo") { actionMoveTo(message); } else if (message.getParam("action") == "remove") { actionRemove(message); } else if (message.getParam("action") == "removeRecursively") { actionRemoveRecursively(message); } else if (message.getParam("action") == "readEntries") { actionReadEntries(message); } }