Skip to content
Snippets Groups Projects
Commit 0f5f68ae authored by Ger van Diepen's avatar Ger van Diepen
Browse files

Task #2756

Do not take the starttime of an empty MS into account.
Use INIT_LOGGER in main programs.
parent 18009be4
No related branches found
No related tags found
No related merge requests found
...@@ -327,9 +327,10 @@ void VdsMaker::combine (const string& gdsName, ...@@ -327,9 +327,10 @@ void VdsMaker::combine (const string& gdsName,
double endTime = 0; double endTime = 0;
vector<VdsPartDesc*> vpds; vector<VdsPartDesc*> vpds;
vpds.reserve (vdsNames.size()); vpds.reserve (vdsNames.size());
for (uint i=0; i<vdsNames.size(); ++i) { for (uint j=0; j<vdsNames.size(); ++j) {
VdsPartDesc* vpd = new VdsPartDesc(ParameterSet(vdsNames[i])); VdsPartDesc* vpd = new VdsPartDesc(ParameterSet(vdsNames[j]));
casa::Path path(vdsNames[i]); // Skip a VDS with an empty time (it has no data).
casa::Path path(vdsNames[j]);
// File name gets the original MS name. // File name gets the original MS name.
// Name gets the name of the VDS file. // Name gets the name of the VDS file.
vpd->setFileName (vpd->getName()); vpd->setFileName (vpd->getName());
...@@ -352,9 +353,16 @@ void VdsMaker::combine (const string& gdsName, ...@@ -352,9 +353,16 @@ void VdsMaker::combine (const string& gdsName,
globalvpd.addBand (nchan, sfreq, efreq); globalvpd.addBand (nchan, sfreq, efreq);
} }
// Get minimum/maximum time. // Get minimum/maximum time.
startTime = std::min (startTime, vpd->getStartTime()); if (vpd->getStartTime() == 0) {
endTime = std::max (endTime, vpd->getEndTime()); LOG_INFO ("Dataset " << vdsNames[j] << " is completely empty");
} else {
startTime = std::min (startTime, vpd->getStartTime());
endTime = std::max (endTime, vpd->getEndTime());
}
} }
// Exit if no valid VDS files.
ASSERTSTR (!vpds.empty(), "No VDS files are given");
ASSERTSTR (startTime != 0, "All datasets seems to be empty");
// Set the times in the global desc (using the first part). // Set the times in the global desc (using the first part).
// Set the clusterdesc name. // Set the clusterdesc name.
......
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <Common/LofarLogger.h> #include <Common/LofarLogger.h>
#include <stdexcept> #include <stdexcept>
#include <iostream> #include <iostream>
#include <libgen.h>
using namespace std; using namespace std;
using namespace LOFAR; using namespace LOFAR;
...@@ -36,6 +37,7 @@ Exception::TerminateHandler t(Exception::terminate); ...@@ -36,6 +37,7 @@ Exception::TerminateHandler t(Exception::terminate);
int main (int argc, const char* argv[]) int main (int argc, const char* argv[])
{ {
try { try {
INIT_LOGGER(basename(argv[0]));
if (argc < 3) { if (argc < 3) {
cout << "Run as: combinevds outName in1 in2 ..." << endl; cout << "Run as: combinevds outName in1 in2 ..." << endl;
return 0; return 0;
......
...@@ -22,8 +22,10 @@ ...@@ -22,8 +22,10 @@
#include <lofar_config.h> #include <lofar_config.h>
#include <MS/VdsMaker.h> #include <MS/VdsMaker.h>
#include<stdexcept> #include <Common/LofarLogger.h>
#include <stdexcept>
#include <iostream> #include <iostream>
#include <libgen.h>
using namespace LOFAR; using namespace LOFAR;
using namespace std; using namespace std;
...@@ -34,6 +36,7 @@ Exception::TerminateHandler t(Exception::terminate); ...@@ -34,6 +36,7 @@ Exception::TerminateHandler t(Exception::terminate);
int main(int argc, const char* argv[]) int main(int argc, const char* argv[])
{ {
try { try {
INIT_LOGGER(basename(argv[0]));
if (argc < 3 || argv[1][0] == '\0' || argv[2][0] == '\0') { if (argc < 3 || argv[1][0] == '\0' || argv[2][0] == '\0') {
cout << "Run as: makevds clusterdesc ms [msvds] [hostname] [writetimes]" cout << "Run as: makevds clusterdesc ms [msvds] [hostname] [writetimes]"
<< endl; << endl;
......
...@@ -22,8 +22,10 @@ ...@@ -22,8 +22,10 @@
//# Includes //# Includes
#include <MS/VdsMaker.h> #include <MS/VdsMaker.h>
#include <ms/MeasurementSets/MSColumns.h>
#include <tables/Tables/TableDesc.h> #include <tables/Tables/TableDesc.h>
#include <tables/Tables/SetupNewTab.h> #include <tables/Tables/SetupNewTab.h>
#include <casa/Quanta/MVTime.h>
#include <iostream> #include <iostream>
using namespace LOFAR; using namespace LOFAR;
...@@ -33,14 +35,34 @@ using namespace std; ...@@ -33,14 +35,34 @@ using namespace std;
int main() int main()
{ {
try { try {
string msname("tVdsMaker_tmp.ms"); {
// Create an empty MS. // Create an empty MS.
TableDesc simpleDesc = MS::requiredTableDesc(); string msname("tVdsMaker_tmp.ms1");
SetupNewTable newTab(msname, simpleDesc, Table::New); TableDesc simpleDesc = MS::requiredTableDesc();
MeasurementSet ms(newTab); SetupNewTable newTab(msname, simpleDesc, Table::New);
ms.createDefaultSubtables(Table::New); MeasurementSet ms(newTab);
ms.flush (True); ms.createDefaultSubtables(Table::New);
VdsMaker::create (msname, msname+".vds", string()); ms.flush (True);
VdsMaker::create (msname, msname+".vds", string());
}
{
// Create a filled MS.
string msname("tVdsMaker_tmp.ms2");
TableDesc simpleDesc = MS::requiredTableDesc();
SetupNewTable newTab(msname, simpleDesc, Table::New);
MeasurementSet ms(newTab);
ms.createDefaultSubtables(Table::New);
ms.addRow (1);
MSColumns mscol(ms);
mscol.antenna1().put (0, 0);
mscol.antenna2().put (0, 0);
MVTime time(2011, 11, 7, 0);
mscol.time().put (0, time.second());
mscol.interval().put (0, 1.);
mscol.exposure().put (0, 1.);
ms.flush (True);
VdsMaker::create (msname, msname+".vds", string());
}
} catch (exception& x) { } catch (exception& x) {
cout << "Unexpected expection: " << x.what() << endl; cout << "Unexpected expection: " << x.what() << endl;
return 1; return 1;
......
...@@ -4,11 +4,13 @@ cwd=`pwd` ...@@ -4,11 +4,13 @@ cwd=`pwd`
echo "tVdsMaker ..." echo "tVdsMaker ..."
./tVdsMaker || exit 1 ./tVdsMaker || exit 1
# Remove system specific work directory from output. # Remove system specific work directory from output.
sed -e "s%$cwd/%%" tVdsMaker_tmp.ms.vds sed -e "s%$cwd/%%" tVdsMaker_tmp.ms1.vds
echo ""
sed -e "s%$cwd/%%" tVdsMaker_tmp.ms2.vds
echo "" echo ""
echo "combinevds ..." echo "combinevds ..."
../src/combinevds tVdsMaker_tmp.ms.gds tVdsMaker_tmp.ms.vds || exit 1 ../src/combinevds tVdsMaker_tmp.ms.gds tVdsMaker_tmp.ms1.vds tVdsMaker_tmp.ms2.vds || exit 1
# Remove system specific work directory from output. # Remove system specific work directory from output.
sed -e "s%$cwd/%%" tVdsMaker_tmp.ms.gds sed -e "s%$cwd/%%" tVdsMaker_tmp.ms.gds
exit 0 exit 0
tVdsMaker ... tVdsMaker ...
Name = tVdsMaker_tmp.ms Name = tVdsMaker_tmp.ms1
FileName = tVdsMaker_tmp.ms FileName = tVdsMaker_tmp.ms1
FileSys = unknown FileSys = unknown
StartTime = 1858/11/17/00:00:00.000 StartTime = 1858/11/17/00:00:00.000
EndTime = 1858/11/17/00:00:01.000 EndTime = 1858/11/17/00:00:01.000
...@@ -15,18 +15,44 @@ Extra.FieldDirectionRa=[] ...@@ -15,18 +15,44 @@ Extra.FieldDirectionRa=[]
Extra.FieldDirectionType=J2000 Extra.FieldDirectionType=J2000
Extra.StationNames=[] Extra.StationNames=[]
Name = tVdsMaker_tmp.ms2
FileName = tVdsMaker_tmp.ms2
FileSys = unknown
StartTime = 2011/11/06/23:59:59.500
EndTime = 2011/11/07/00:00:00.500
StepTime = 1
StartTimesDiff=[0]
EndTimesDiff=[0]
Extra.CorrNames=[]
Extra.DataCubeShape=[]
Extra.DataFileIsRegular=0
Extra.DataFileName=
Extra.DataTileShape=[]
Extra.FieldDirectionDec=[]
Extra.FieldDirectionRa=[]
Extra.FieldDirectionType=J2000
Extra.StationNames=[]
combinevds ... combinevds ...
Name = tVdsMaker_tmp.ms.gds Name = tVdsMaker_tmp.ms.gds
StartTime = 1858/11/17/00:00:00.000 StartTime = 2011/11/06/23:59:59.500
EndTime = 1858/11/17/00:00:01.000 EndTime = 2011/11/07/00:00:00.500
StepTime = 1 StepTime = 1
Extra.FieldDirectionDec=[] Extra.FieldDirectionDec=[]
Extra.FieldDirectionRa=[] Extra.FieldDirectionRa=[]
Extra.FieldDirectionType=J2000 Extra.FieldDirectionType=J2000
NParts = 1 NParts = 2
Part0.Name = tVdsMaker_tmp.ms.vds Part0.Name = tVdsMaker_tmp.ms1.vds
Part0.FileName = tVdsMaker_tmp.ms Part0.FileName = tVdsMaker_tmp.ms1
Part0.FileSys = unknown Part0.FileSys = unknown
Part0.StartTime = 1858/11/17/00:00:00.000 Part0.StartTime = 1858/11/17/00:00:00.000
Part0.EndTime = 1858/11/17/00:00:01.000 Part0.EndTime = 1858/11/17/00:00:01.000
Part0.StepTime = 1 Part0.StepTime = 1
Part1.Name = tVdsMaker_tmp.ms2.vds
Part1.FileName = tVdsMaker_tmp.ms2
Part1.FileSys = unknown
Part1.StartTime = 2011/11/06/23:59:59.500
Part1.EndTime = 2011/11/07/00:00:00.500
Part1.StepTime = 1
Part1.StartTimesDiff=[0]
Part1.EndTimesDiff=[0]
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment