From b23cd3c401579b526d76c2973b773fa45ccd348c Mon Sep 17 00:00:00 2001 From: Chris Broekema <broekema@astron.nl> Date: Tue, 27 Apr 2010 08:12:27 +0000 Subject: [PATCH] Bug #1011: Add the used parset and some identifying information to the MS. --- .../include/Storage/MeasurementSetFormat.h | 1 + RTCP/Storage/src/MeasurementSetFormat.cc | 35 ++++++++++++++++++- 2 files changed, 35 insertions(+), 1 deletion(-) diff --git a/RTCP/Storage/include/Storage/MeasurementSetFormat.h b/RTCP/Storage/include/Storage/MeasurementSetFormat.h index 2d334a82e81..82562eca92b 100644 --- a/RTCP/Storage/include/Storage/MeasurementSetFormat.h +++ b/RTCP/Storage/include/Storage/MeasurementSetFormat.h @@ -71,6 +71,7 @@ class MeasurementSetFormat : public Format void fillDataDesc(); void fillSpecWindow(unsigned subband); void fillObs(); + void fillHistory(); }; } //RTCP diff --git a/RTCP/Storage/src/MeasurementSetFormat.cc b/RTCP/Storage/src/MeasurementSetFormat.cc index 0d64931daff..deab95e5170 100644 --- a/RTCP/Storage/src/MeasurementSetFormat.cc +++ b/RTCP/Storage/src/MeasurementSetFormat.cc @@ -11,6 +11,7 @@ #include <lofar_config.h> #include <Storage/MeasurementSetFormat.h> +#include <Storage/Package__Version.h> #include <AMCBase/Epoch.h> @@ -52,7 +53,6 @@ #include <boost/thread/mutex.hpp> - using namespace casa; namespace LOFAR { @@ -150,6 +150,7 @@ void MeasurementSetFormat::createMSTables(unsigned subband) fillDataDesc(); fillSpecWindow(subband); fillObs(); + fillHistory(); } catch (AipsError x) { THROW(StorageException,"AIPS/CASA error: " << x.getMesg()); @@ -357,6 +358,38 @@ void MeasurementSetFormat::fillSpecWindow(unsigned subband) { msspw.flush(); } +void MeasurementSetFormat::fillHistory() { + Table histtab(itsMS->keywordSet().asTable("HISTORY")); + histtab.reopenRW(); + ScalarColumn<double> time (histtab, "TIME"); + ScalarColumn<int> obsId (histtab, "OBSERVATION_ID"); + ScalarColumn<String> message (histtab, "MESSAGE"); + ScalarColumn<String> application (histtab, "APPLICATION"); + ScalarColumn<String> priority (histtab, "PRIORITY"); + ScalarColumn<String> origin (histtab, "ORIGIN"); + ArrayColumn<String> parms (histtab, "APP_PARAMS"); + ArrayColumn<String> cli (histtab, "CLI_COMMAND"); + + // Put all parset entries in a Vector<String>. + casa::Vector<String> appvec; + casa::Vector<String> clivec; + appvec.resize (itsPS->size()); + casa::Array<String>::contiter viter = appvec.cbegin(); + for (ParameterSet::const_iterator iter = itsPS->begin(); iter != itsPS->end(); ++iter, ++viter) { + *viter = iter->first + '=' + iter->second.get(); + } + uint rownr = histtab.nrow(); + histtab.addRow(); + time.put (rownr, Time().modifiedJulianDay()*24.*3600.); + obsId.put (rownr, 0); + message.put (rownr, "parameters"); + application.put (rownr, "OLAP"); + priority.put (rownr, "NORMAL"); + origin.put (rownr, Version::getInfo<StorageVersion>("Storage", "full")); + parms.put (rownr, appvec); + cli.put (rownr, clivec); +} + void MeasurementSetFormat::createMSMetaFile(unsigned subband) { Block<Int> ant1(itsPS->nrBaselines()); -- GitLab