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

bug 1660: Improved meta info

parent b14d5226
No related branches found
No related tags found
No related merge requests found
...@@ -2276,6 +2276,7 @@ RTCP/Storage/src/MSWriterFile.cc -text ...@@ -2276,6 +2276,7 @@ RTCP/Storage/src/MSWriterFile.cc -text
RTCP/Storage/src/MSWriterNull.cc -text RTCP/Storage/src/MSWriterNull.cc -text
RTCP/Storage/src/MeasurementSetFormat.cc -text RTCP/Storage/src/MeasurementSetFormat.cc -text
RTCP/Storage/src/OutputThread.cc -text RTCP/Storage/src/OutputThread.cc -text
RTCP/Storage/test/tMeasurementSetFormat.parset -text
SAS/OTB/MoM-OTDB-adapter/.cvsignore -text SAS/OTB/MoM-OTDB-adapter/.cvsignore -text
SAS/OTB/MoM-OTDB-adapter/.euml2 -text SAS/OTB/MoM-OTDB-adapter/.euml2 -text
SAS/OTB/MoM-OTDB-adapter/.umlproject -text SAS/OTB/MoM-OTDB-adapter/.umlproject -text
......
...@@ -67,11 +67,11 @@ class MeasurementSetFormat : public Format ...@@ -67,11 +67,11 @@ class MeasurementSetFormat : public Format
void fillFeed(); void fillFeed();
void fillAntenna(const casa::Block<casa::MPosition>& antMPos); void fillAntenna(const casa::Block<casa::MPosition>& antMPos);
void fillField(unsigned subband); void fillField(unsigned subarray);
void fillPola(); void fillPola();
void fillDataDesc(); void fillDataDesc();
void fillSpecWindow(unsigned subband); void fillSpecWindow(unsigned subband);
void fillObs(); void fillObs(unsigned subarray);
void fillHistory(); void fillHistory();
}; };
......
...@@ -158,21 +158,25 @@ void MeasurementSetFormat::createMSTables(const string &MSname, unsigned subband ...@@ -158,21 +158,25 @@ void MeasurementSetFormat::createMSTables(const string &MSname, unsigned subband
LOG_FATAL_STR("AipsError: " << e.what()); LOG_FATAL_STR("AipsError: " << e.what());
} }
// Get subarray id (formerly known as beam).
const vector<unsigned> subbandToSAPmapping = itsPS->subbandToSAPmapping();
int subarray = subbandToSAPmapping[subband];
fillAntenna(antMPos); fillAntenna(antMPos);
fillFeed(); fillFeed();
fillField(subband); fillField(subarray);
fillPola(); fillPola();
fillDataDesc(); fillDataDesc();
fillSpecWindow(subband); fillSpecWindow(subband);
fillObs(); fillObs(subarray);
fillHistory(); fillHistory();
// Create the tables containing the beam info. // Fill the tables containing the beam info.
BeamTables::create (*itsMS, BeamTables::fill (*itsMS,
itsPS->antennaSet(), itsPS->antennaSet(),
"/home/diepen/data/AntennaSets.conf", "/home/diepen/data/AntennaSets.conf",
"/home/diepen/data/AntennaFields", "/home/diepen/data/AntennaFields",
"/home/diepen/data/iHBADeltas"); "/home/diepen/data/iHBADeltas");
} catch (AipsError& x) { } catch (AipsError& x) {
THROW(StorageException,"AIPS/CASA error: " << x.getMesg()); THROW(StorageException,"AIPS/CASA error: " << x.getMesg());
...@@ -191,8 +195,6 @@ void MeasurementSetFormat::fillAntenna (const Block<MPosition>& antMPos) ...@@ -191,8 +195,6 @@ void MeasurementSetFormat::fillAntenna (const Block<MPosition>& antMPos)
casa::Vector<Double> antOffset(3); casa::Vector<Double> antOffset(3);
antOffset = 0; antOffset = 0;
casa::Vector<Double> phaseRef(3); casa::Vector<Double> phaseRef(3);
vector<double> psPhaseRef = itsPS->getRefPhaseCentre();
std::copy (psPhaseRef.begin(), psPhaseRef.end(), phaseRef.begin());
// Fill the ANTENNA subtable. // Fill the ANTENNA subtable.
MSLofarAntenna msant = itsMS->antenna(); MSLofarAntenna msant = itsMS->antenna();
...@@ -208,6 +210,11 @@ void MeasurementSetFormat::fillAntenna (const Block<MPosition>& antMPos) ...@@ -208,6 +210,11 @@ void MeasurementSetFormat::fillAntenna (const Block<MPosition>& antMPos)
msantCol.positionMeas().put (i, antMPos[i]); msantCol.positionMeas().put (i, antMPos[i]);
msantCol.offset().put (i, antOffset); msantCol.offset().put (i, antOffset);
msantCol.dishDiameter().put (i, 0); msantCol.dishDiameter().put (i, 0);
vector<double> psPhaseRef =
itsPS->getDoubleVector("PIC.Core."+stationNames[i]+".phaseCenter");
ASSERTSTR (psPhaseRef.size() == 3,
"phaseCenter in parset of station " << stationNames[i]);
std::copy (psPhaseRef.begin(), psPhaseRef.end(), phaseRef.begin());
msantCol.phaseReference().put (i, phaseRef); msantCol.phaseReference().put (i, phaseRef);
msantCol.flagRow().put (i, False); msantCol.flagRow().put (i, False);
} }
...@@ -255,11 +262,9 @@ void MeasurementSetFormat::fillFeed() ...@@ -255,11 +262,9 @@ void MeasurementSetFormat::fillFeed()
} }
void MeasurementSetFormat::fillField(unsigned subband) { void MeasurementSetFormat::fillField(unsigned subarray) {
const vector<unsigned> subbandToSAPmapping = itsPS->subbandToSAPmapping(); MVDirection radec (Quantity(itsPS->getBeamDirection(subarray)[0], "rad"),
Quantity(itsPS->getBeamDirection(subarray)[1], "rad"));
MVDirection radec (Quantity(itsPS->getBeamDirection(subbandToSAPmapping[subband])[0], "rad"),
Quantity(itsPS->getBeamDirection(subbandToSAPmapping[subband])[1], "rad"));
MDirection indir(radec, MDirection::J2000); MDirection indir(radec, MDirection::J2000);
casa::Vector<MDirection> outdir(1); casa::Vector<MDirection> outdir(1);
outdir(0) = indir; outdir(0) = indir;
...@@ -269,7 +274,7 @@ void MeasurementSetFormat::fillField(unsigned subband) { ...@@ -269,7 +274,7 @@ void MeasurementSetFormat::fillField(unsigned subband) {
MSFieldColumns msfieldCol(msfield); MSFieldColumns msfieldCol(msfield);
uInt rownr = msfield.nrow(); uInt rownr = msfield.nrow();
msfield.addRow(); msfield.addRow();
msfieldCol.name().put (rownr, "BEAM_" + String::toString(rownr)); msfieldCol.name().put (rownr, "BEAM_" + String::toString(subarray));
msfieldCol.code().put (rownr, ""); msfieldCol.code().put (rownr, "");
msfieldCol.time().put (rownr, itsStartTime); msfieldCol.time().put (rownr, itsStartTime);
msfieldCol.numPoly().put (rownr, 0); msfieldCol.numPoly().put (rownr, 0);
...@@ -323,7 +328,7 @@ void MeasurementSetFormat::fillDataDesc() { ...@@ -323,7 +328,7 @@ void MeasurementSetFormat::fillDataDesc() {
msdd.flush(); msdd.flush();
} }
void MeasurementSetFormat::fillObs() { void MeasurementSetFormat::fillObs(unsigned subarray) {
// Get start and end time. // Get start and end time.
casa::Vector<Double> timeRange(2); casa::Vector<Double> timeRange(2);
timeRange[0] = itsStartTime; timeRange[0] = itsStartTime;
...@@ -346,6 +351,18 @@ void MeasurementSetFormat::fillObs() { ...@@ -346,6 +351,18 @@ void MeasurementSetFormat::fillObs() {
casa::Vector<String> corrSchedule(1); casa::Vector<String> corrSchedule(1);
corrSchedule = "corrSchedule"; corrSchedule = "corrSchedule";
vector<string> targets(itsPS->getStringVector
("Observation.Beam[" + String::toString(subarray) + "].target"));
casa::Vector<String> ctargets(targets.size());
for (uint i=0; i<targets.size(); ++i) {
ctargets[i] = targets[i];
}
vector<string> cois(itsPS->getStringVector("Observation.Campaign.CO_I"));
casa::Vector<String> ccois(targets.size());
for (uint i=0; i<cois.size(); ++i) {
ccois[i] = cois[i];
}
double releaseDate = timeRange(1) + 365.25*24*60*60; double releaseDate = timeRange(1) + 365.25*24*60*60;
MSLofarObservation msobs = itsMS->observation(); MSLofarObservation msobs = itsMS->observation();
...@@ -358,31 +375,30 @@ void MeasurementSetFormat::fillObs() { ...@@ -358,31 +375,30 @@ void MeasurementSetFormat::fillObs() {
msobsCol.observer().put (0, itsPS->observerName()); msobsCol.observer().put (0, itsPS->observerName());
msobsCol.scheduleType().put (0, "LOFAR"); msobsCol.scheduleType().put (0, "LOFAR");
msobsCol.schedule().put (0, corrSchedule); msobsCol.schedule().put (0, corrSchedule);
msobsCol.project().put (0, itsPS->projectName()); msobsCol.project().put (0, itsPS->getString("Observation.Campaign.name"));
msobsCol.releaseDate().put (0, releaseDate); msobsCol.releaseDate().put (0, releaseDate);
msobsCol.flagRow().put(0, False); msobsCol.flagRow().put(0, False);
msobsCol.projectTitle().put(0, itsPS->getString("Observation.Campaign.title")); msobsCol.projectTitle().put(0, itsPS->getString("Observation.Campaign.title"));
msobsCol.projectPI().put(0, itsPS->getString("Observation.Campaign.PI")); msobsCol.projectPI().put(0, itsPS->getString("Observation.Campaign.PI"));
msobsCol.projectCoI().put(0, casa::Vector<String>(1, msobsCol.projectCoI().put(0, ccois);
String(itsPS->getString("Observation.Campaign.contact")))); msobsCol.projectContact().put(0, itsPS->getString("Observation.Campaign.contact"));
msobsCol.projectContact().put(0, itsPS->contactName());
msobsCol.observationId().put(0, String::toString(itsPS->observationID())); msobsCol.observationId().put(0, String::toString(itsPS->observationID()));
msobsCol.observationStart().put(0, timeRange[0]); msobsCol.observationStart().put(0, timeRange[0]);
msobsCol.observationEnd().put(0, timeRange[1]); msobsCol.observationEnd().put(0, timeRange[1]);
msobsCol.observationFrequencyMax().put(0, maxFreq); msobsCol.observationFrequencyMaxQuant().put(0, Quantity(maxFreq, "Hz"));
msobsCol.observationFrequencyMin().put(0, minFreq); msobsCol.observationFrequencyMinQuant().put(0, Quantity(minFreq, "Hz"));
msobsCol.observationFrequencyCenter().put(0, 0.5*(minFreq+maxFreq)); msobsCol.observationFrequencyCenterQuant().put(0, Quantity(0.5*(minFreq+maxFreq), "Hz"));
msobsCol.subArrayPointing().put(0, 0); msobsCol.subArrayPointing().put(0, subarray);
msobsCol.nofBits().put (0, itsPS->nrBitsPerSample());
msobsCol.antennaSet().put(0, itsPS->antennaSet()); msobsCol.antennaSet().put(0, itsPS->antennaSet());
msobsCol.filterSelection().put(0, itsPS->bandFilter()); msobsCol.filterSelection().put(0, itsPS->bandFilter());
msobsCol.clockFrequencyQuant().put(0, Quantity(itsPS->clockSpeed(), "Hz")); msobsCol.clockFrequencyQuant().put(0, Quantity(itsPS->clockSpeed(), "Hz"));
msobsCol.target().put(0, casa::Vector<String>(1, msobsCol.target().put(0, ctargets);
String(itsPS->getString("Observation.Beam[0].target"))));
msobsCol.systemVersion().put(0, Version::getInfo<StorageVersion>("Storage", msobsCol.systemVersion().put(0, Version::getInfo<StorageVersion>("Storage",
"brief")); "brief"));
msobsCol.pipelineName().put(0, "SIP"); msobsCol.pipelineName().put(0, String());
msobsCol.pipelineVersion().put(0, "1.0"); msobsCol.pipelineVersion().put(0, String());
msobsCol.filename().put(0, itsMS->tableName()); msobsCol.filename().put(0, Path(itsMS->tableName()).baseName());
msobsCol.filetype().put(0, "uv"); msobsCol.filetype().put(0, "uv");
msobsCol.filedate().put(0, timeRange[0]); msobsCol.filedate().put(0, timeRange[0]);
......
...@@ -8,12 +8,31 @@ ...@@ -8,12 +8,31 @@
#include <lofar_config.h> #include <lofar_config.h>
#include <Storage/MeasurementSetFormat.h> #include <Storage/MeasurementSetFormat.h>
#include <Common/LofarLogger.h>
#include <casa/IO/RegularFileIO.h>
using namespace LOFAR; using namespace LOFAR;
using namespace LOFAR::RTCP;
using namespace casa;
// Define handler that tries to print a backtrace.
Exception::TerminateHandler t(Exception::terminate);
int main() int main()
{ {
Parset parset("tMeasurementSetFormat.parset"); try {
MeasurementSetFormat msf(parset); Parset parset("tMeasurementSetFormat.parset");
msf.addSubband ("tMeasurementSetFormat_tmp.ms", 0, false); MeasurementSetFormat msf(&parset);
msf.addSubband ("tMeasurementSetFormat_tmp.ms", 0, false);
// Also create the data file, otherwise it is not a true table.
///FILE* file= fopen ("tMeasurementSetFormat_tmp.ms/f0data", "w");
///fclose (file);
RegularFileIO file(String("tMeasurementSetFormat_tmp.ms/table.f0data"),
ByteIO::New);
} catch (LOFAR::Exception& err) {
std::cerr << "LOFAR Exception detected: " << err << std::endl;
return 1;
}
return 0;
} }
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment