Source
49
49
#include <plotms/PlotMS/PlotMS.h>
50
50
#include <plotms/Plots/PlotMSPlotParameterGroups.h>
51
51
#include <tables/Tables/Table.h>
52
52
#include <measures/Measures/Stokes.h>
53
53
#include <ms/MeasurementSets/MeasurementSet.h>
54
54
#include <measures/Measures/MDirection.h>
55
55
#include <measures/Measures/MPosition.h>
56
56
#include <measures/Measures/MFrequency.h>
57
57
#include <ms/MeasurementSets/MSColumns.h>
58
58
#include <ms/MeasurementSets/MSAntennaColumns.h>
59
+
#include <ms/MSOper/MSMetaData.h>
59
60
60
61
#include <casa/Logging/LogMessage.h>
61
62
#include <casa/Logging/LogSink.h>
62
63
#include <casa/Logging/LogFilter.h>
63
64
64
65
#include <ctime>
65
66
66
67
using namespace casacore;
67
68
namespace casa {
68
69
86
87
ThreadCommunication* thread) {
87
88
88
89
// process selected columns
89
90
dataColumn_ = getDataColumn(loadAxes, loadData);
90
91
91
92
// Get strings stored in MS
92
93
Table::TableOption tabopt(Table::Old);
93
94
MeasurementSet* inputMS = new MeasurementSet(filename_, TableLock(TableLock::AutoLocking), tabopt);
94
95
getNamesFromMS(*inputMS);
95
96
97
+
// If plotting antennas directions, verify that feature is supported for the input MS
98
+
auto loadAntDir = std::find_if(loadAxes.begin(),loadAxes.end(),PMS::axisIsRaDec) != loadAxes.end();
99
+
if (loadAntDir) {
100
+
auto ok = pointingsPlotSupported(inputMS);
101
+
if (not ok){
102
+
String errMsg("Plotting antennas directions is irrelevant or not supported for this MS.");
103
+
logWarn(PMS::LOG_ORIGIN_LOAD_CACHE, errMsg);
104
+
delete inputMS;
105
+
loadError(errMsg);
106
+
}
107
+
}
108
+
96
109
// Apply selections to MS to create selection MS and channel/correlation selections
97
110
Vector<Vector<Slice> > chansel;
98
111
Vector<Vector<Slice> > corrsel;
99
112
MeasurementSet* selMS = new MeasurementSet();
100
113
try {
101
114
// get chansel, corrsel
102
115
selection_.apply(*inputMS, *selMS, chansel, corrsel);
103
116
} catch(AipsError& log) {
104
117
// improper selection can cause exception
105
118
delete inputMS;
2245
2258
VisBufferUtil vbu = VisBufferUtil();
2246
2259
vbu.toVelocity(outVel,
2247
2260
*vb,
2248
2261
freqFrame_,
2249
2262
MVFrequency(transformations_.restFreqHz()),
2250
2263
transformations_.veldef());
2251
2264
outVel /= 1.0e3; // in km/s
2252
2265
return outVel;
2253
2266
}
2254
2267
2268
+
bool MSCache::pointingsPlotSupported(const MeasurementSet* const &ms){
2269
+
// MS must have a non empty pointing table
2270
+
const auto & pointingTable = ms->pointing();
2271
+
if (pointingTable.nrow() == 0 ) {
2272
+
logWarn(PMS::LOG_ORIGIN_LOAD_CACHE, "Plotting antennas directions is irrelevant when the pointing table is empty.");
2273
+
return false;
2274
+
}
2275
+
2276
+
// Telescope must have been validated for this feature (CAS-8087)
2277
+
Float noMetaDataCache = -1.0;
2278
+
MSMetaData msmd(ms,noMetaDataCache);
2279
+
vector<String> observatoryNames {msmd.getObservatoryNames()};
2280
+
bool isValidated = false;
2281
+
for (const auto & observatoryName : observatoryNames) {
2282
+
if ( observatoryName == "ALMA" ||
2283
+
observatoryName == "ASTE" ||
2284
+
observatoryName == "NRO"
2285
+
)
2286
+
{
2287
+
isValidated = true;
2288
+
continue;
2289
+
}
2290
+
else {
2291
+
isValidated = false;
2292
+
String warnMsg;
2293
+
if (observatoryName == "EVLA" ) {
2294
+
warnMsg = "Plotting " + observatoryName + "'s antennas directions requires telescope-specific processing,\n";
2295
+
warnMsg += "which is currently not implemented";
2296
+
}
2297
+
else {
2298
+
warnMsg = "Plotting antennas directions has not been validated for observatory: ";
2299
+
warnMsg += observatoryName;
2300
+
}
2301
+
logWarn(PMS::LOG_ORIGIN_LOAD_CACHE, warnMsg);
2302
+
break;
2303
+
}
2304
+
}
2305
+
return isValidated;
2306
+
}
2307
+
2255
2308
void MSCache::loadPageHeaderCache(const casacore::MeasurementSet& selectedMS){
2256
2309
logLoad("Loading page header cache");
2257
2310
using Item = PageHeaderItemsDef::Item;
2258
2311
2259
2312
// ---- Filename
2260
2313
pageHeaderCache_.store(HeaderItemData(Item::Filename,Path(filename_).baseName()));
2261
2314
2262
2315
if ( selectedMS.nrow() == 0 ) return;
2263
2316
2264
2317
const uInt firstSelectedRow = 0;