diff --git a/RTCP/Storage/include/Storage/MeasurementSetFormat.h b/RTCP/Storage/include/Storage/MeasurementSetFormat.h index 2d334a82e8136cdcfd6b04a72066f493e1bc283b..82562eca92b5c131251387c52510c7f26da3d06e 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 0d64931daff6f1018199e9f408f852e83a5d4398..deab95e5170a0e82b4a0340be4b80929d91a8c4d 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());