diff --git a/.gitattributes b/.gitattributes index 7812b3d0e9e4f0456e0ba7a0c9ea21214a6f8cdd..80df140b1aee2b155f9b40156c9ebf4d88e122fc 100644 --- a/.gitattributes +++ b/.gitattributes @@ -26,6 +26,54 @@ 3rdparty/sourceforge/dtemplatelib/tests/tests.res -text svneol=unset#unset 3rdparty/sourceforge/dtemplatelib/tests/tests_build_sh.opt -text svneol=unset#unset 3rdparty/sourceforge/log4cplus/log4cplus-1.0.2.tar.gz -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.dat -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0 -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0i -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.lock -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.dat -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.f0 -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.f0i -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.lock -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep1/table.dat -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep1/table.f0 -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep1/table.f0i -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep1/table.lock -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.dat -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0 -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0i -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.lock -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.dat -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.f0 -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.f0i -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.lock -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep2/table.dat -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep2/table.f0 -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep2/table.f0i -text svneol=unset#unset +CEP/BB/BBS/test/tParmMerge.in_mep2/table.lock -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.dat -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0 -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0i -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.lock -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.dat -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.f0 -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.f0i -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.lock -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.dat -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.f0 -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.f0i -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.lock -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.dat -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0 -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0i -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.lock -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.dat -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.f0 -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.f0i -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.lock -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.dat -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.f0 -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.f0i -text svneol=unset#unset +CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.lock -text svneol=unset#unset CEP/BB/BB_GUI/make_jar.sh -text svneol=native#application/octet-stream CEP/BB/ParmFacade/test/tParmFacade.in_mep/DEFAULTVALUES/table.dat -text svneol=unset#unset CEP/BB/ParmFacade/test/tParmFacade.in_mep/DEFAULTVALUES/table.f0 -text svneol=unset#unset diff --git a/CEP/BB/BBS/src/MNS/MeqFunklet.cc b/CEP/BB/BBS/src/MNS/MeqFunklet.cc index de408f8d3aa2f51576ffacccdf7bbb57323efeae..66898602b54ad39ad8054c56583f2ac1d720dec0 100644 --- a/CEP/BB/BBS/src/MNS/MeqFunklet.cc +++ b/CEP/BB/BBS/src/MNS/MeqFunklet.cc @@ -89,7 +89,8 @@ MeqFunklet* MeqFunklet::make (const ParmDB::ParmValue& pvalue, return new MeqTabular(pvalue); } ASSERTSTR (false, - "Unknown funklet found for parameter " << name); + "Unknown funklet type " << pvalue.rep().itsType + << " found for parameter " << name); } int MeqFunklet::makeSolvable (int scidIndex) diff --git a/CEP/BB/BBS/src/MNS/MeqLMN.cc b/CEP/BB/BBS/src/MNS/MeqLMN.cc index 57450b4bdfcb90d3bdf60624780e5feeb8680227..ec541891b68bdc4d721a28bad2451e0e3bf8d05c 100644 --- a/CEP/BB/BBS/src/MNS/MeqLMN.cc +++ b/CEP/BB/BBS/src/MNS/MeqLMN.cc @@ -23,7 +23,7 @@ #include <lofar_config.h> #include <BBS/MNS/MeqLMN.h> -#include <BBS/MNS/MeqPointSource.h> +#include <BBS/MNS/MeqSource.h> #include <BBS/MNS/MeqPhaseRef.h> #include <BBS/MNS/MeqRequest.h> #include <BBS/MNS/MeqMatrixTmp.h> @@ -32,7 +32,7 @@ namespace LOFAR { -MeqLMN::MeqLMN (MeqPointSource* source) +MeqLMN::MeqLMN (MeqSource* source) : itsSource (source) { addChild (itsSource->getRa()); diff --git a/CEP/BB/BBS/src/MNS/MeqLMN.h b/CEP/BB/BBS/src/MNS/MeqLMN.h index 46701b0f7802c59352a7611f9f9b13632a14e21d..4f47863a4e5994ca5228c12b51e83b12589f08ba 100644 --- a/CEP/BB/BBS/src/MNS/MeqLMN.h +++ b/CEP/BB/BBS/src/MNS/MeqLMN.h @@ -37,7 +37,7 @@ namespace LOFAR { // @{ //# Forward Declarations -class MeqPointSource; +class MeqSource; class MeqPhaseRef; @@ -45,9 +45,9 @@ class MeqLMN: public MeqExprRep { public: // Construct for the given point source. - explicit MeqLMN (MeqPointSource*); + explicit MeqLMN (MeqSource*); - const MeqPointSource& getSource() const + const MeqSource& getSource() const { return *itsSource; } // Set the phase reference position. @@ -60,7 +60,7 @@ public: MeqResultVec getAnResultVec (const MeqRequest& request); private: - MeqPointSource* itsSource; + MeqSource* itsSource; const MeqPhaseRef* itsPhaseRef; }; diff --git a/CEP/BB/BBS/src/MNS/MeqParmFunklet.cc b/CEP/BB/BBS/src/MNS/MeqParmFunklet.cc index e1910128a5ea061158548842d4c42e4bc5d62a00..ddb76f7e32f5e862a0faeb6e9426d024b2291225 100644 --- a/CEP/BB/BBS/src/MNS/MeqParmFunklet.cc +++ b/CEP/BB/BBS/src/MNS/MeqParmFunklet.cc @@ -22,8 +22,11 @@ #include <lofar_config.h> #include <BBS/MNS/MeqParmFunklet.h> +#include <BBS/MNS/MeqParmExpr.h> #include <BBS/MNS/MeqPolc.h> #include <BBS/ParmData.h> +#include <ParmDB/ParmValue.h> +#include <ParmDB/ParmDB.h> #include <Common/LofarLogger.h> #include <casa/BasicMath/Math.h> @@ -49,7 +52,11 @@ MeqParmFunklet::MeqParmFunklet (const string& name, MeqParmGroup* group, itsNrPert (0), itsPertInx (-1), itsTable (table) -{} +{ + // See if the parm is a parm-expression. + // If so, create parm-funklets for them. + +} MeqParmFunklet::~MeqParmFunklet() { @@ -58,6 +65,26 @@ MeqParmFunklet::~MeqParmFunklet() } } +MeqExprRep* MeqParmFunklet::create (const string& name, + MeqParmGroup* group, + ParmDB::ParmDB* table) +{ + // If the parm is an expression, use that. + map<string,ParmDB::ParmValueSet> pset; + table->getDefValues (pset, name); + if (! pset.empty()) { + ParmDB::ParmValueSet& pvset = pset.begin()->second; + if (! pvset.getValues().empty()) { + ParmDB::ParmValueRep& pv = pvset.getValues()[0].rep(); + if (pv.itsType == "parmexpr") { + return new MeqParmExpr (pv.itsExpr, group, table); + } + } + } + // It is a normal funklet. + return new MeqParmFunklet (name, group, table); +} + void MeqParmFunklet::add (const MeqFunklet& funklet) { itsFunklets.push_back (funklet.clone()); diff --git a/CEP/BB/BBS/src/MNS/MeqParmFunklet.h b/CEP/BB/BBS/src/MNS/MeqParmFunklet.h index 2158e2d0776f42dfb83b7292acbbf366bdc51181..2fa319206aaa862b3bddb040b83db2c65fdd7eae 100644 --- a/CEP/BB/BBS/src/MNS/MeqParmFunklet.h +++ b/CEP/BB/BBS/src/MNS/MeqParmFunklet.h @@ -20,7 +20,7 @@ //# //# $Id$ -#if !defined(MNS_MEQPARMFUNKLET_H) +#ifndef MNS_MEQPARMFUNKLET_H #define MNS_MEQPARMFUNKLET_H // \file @@ -58,6 +58,13 @@ public: virtual ~MeqParmFunklet(); + // Make the correct object depending on the parm type. + // For a parm expression a MeqParmExpr object is created, otherwise + // a MeqParmFunklet. + static MeqExprRep* create (const string& name, + MeqParmGroup* group, + ParmDB::ParmDB* table); + // Get the requested result of the parameter. virtual MeqResult getResult (const MeqRequest&); diff --git a/CEP/BB/BBS/src/MNS/MeqPointSource.cc b/CEP/BB/BBS/src/MNS/MeqPointSource.cc index e2642d1d06d192304e4c71e054fd7b034c49993c..aa4cbb71011b7a07783091db5e9ebd838772786d 100644 --- a/CEP/BB/BBS/src/MNS/MeqPointSource.cc +++ b/CEP/BB/BBS/src/MNS/MeqPointSource.cc @@ -26,24 +26,18 @@ namespace LOFAR { -MeqPointSource::MeqPointSource() -: itsSourceNr (-1), - itsGroupNr (-1) -{} - MeqPointSource::MeqPointSource (const string& name, const MeqExpr& fluxI, const MeqExpr& fluxQ, const MeqExpr& fluxU, const MeqExpr& fluxV, const MeqExpr& ra, const MeqExpr& dec) -: itsSourceNr (-1), - itsGroupNr (-1), - itsName (name), - itsI (fluxI), - itsQ (fluxQ), - itsU (fluxU), - itsV (fluxV), - itsRa (ra), - itsDec (dec) +: MeqSource (name, "", ra, dec), + itsI (fluxI), + itsQ (fluxQ), + itsU (fluxU), + itsV (fluxV) +{} + +MeqPointSource::~MeqPointSource() {} } diff --git a/CEP/BB/BBS/src/MNS/MeqPointSource.h b/CEP/BB/BBS/src/MNS/MeqPointSource.h index 69e78bf73ad1204669b3aab568b14af0850a3a3e..47f11bc9ef43ff2ee3c23b5d51c670e01cf5d812 100644 --- a/CEP/BB/BBS/src/MNS/MeqPointSource.h +++ b/CEP/BB/BBS/src/MNS/MeqPointSource.h @@ -20,16 +20,14 @@ //# //# $Id$ -#if !defined(MNS_MEQPOINTSOURCE_H) +#ifndef MNS_MEQPOINTSOURCE_H #define MNS_MEQPOINTSOURCE_H // \file // Class holding a point source //# Includes -#include <BBS/MNS/MeqExpr.h> -#include <BBS/MNS/MeqResult.h> -#include <BBS/MNS/MeqRequest.h> +#include <BBS/MNS/MeqSource.h> #include <Common/lofar_string.h> namespace LOFAR { @@ -38,23 +36,16 @@ namespace LOFAR { // \addtogroup MNS // @{ -//# Forward Declarations -class MeqPhaseRef; - -class MeqPointSource +class MeqPointSource: public MeqSource { public: - // The default constructor. - MeqPointSource(); - MeqPointSource (const string& name, const MeqExpr& fluxI, const MeqExpr& fluxQ, const MeqExpr& fluxU, const MeqExpr& fluxV, const MeqExpr& ra, const MeqExpr& dec); - const string& getName() const - { return itsName; } + virtual ~MeqPointSource(); MeqExpr& getI() { return itsI; } @@ -64,37 +55,12 @@ public: { return itsU; } MeqExpr& getV() { return itsV; } - MeqExpr& getRa() - { return itsRa; } - MeqExpr& getDec() - { return itsDec; } - - // Get the source nr. - int getSourceNr() const - { return itsSourceNr; } - - // Get the group nr. - int getGroupNr() const - { return itsGroupNr; } - - // Set the source nr. - void setSourceNr (int sourceNr) - { itsSourceNr = sourceNr; } - - // Set the group nr. - void setGroupNr (int groupNr) - { itsGroupNr = groupNr; } private: - int itsSourceNr; - int itsGroupNr; - string itsName; MeqExpr itsI; MeqExpr itsQ; MeqExpr itsU; MeqExpr itsV; - MeqExpr itsRa; - MeqExpr itsDec; }; // @} diff --git a/CEP/BB/BBS/src/MNS/MeqSourceList.cc b/CEP/BB/BBS/src/MNS/MeqSourceList.cc index a3741c89032ee59b61653c41739c74528bde9881..3ac37f2eebb4b663248416c242e5430347795799 100644 --- a/CEP/BB/BBS/src/MNS/MeqSourceList.cc +++ b/CEP/BB/BBS/src/MNS/MeqSourceList.cc @@ -22,11 +22,14 @@ #include <lofar_config.h> #include <BBS/MNS/MeqSourceList.h> +#include <BBS/MNS/MeqPointSource.h> +#include <BBS/MNS/MeqGaussSource.h> #include <BBS/MNS/MeqParmFunklet.h> #include <Common/LofarLogger.h> #include <casa/Arrays/Vector.h> -#include <casa/Utilities/GenSort.h> +#include <casa/Utilities/GenSort.cc> // for automatic template +#include <algorithm> using namespace casa; @@ -35,79 +38,103 @@ namespace LOFAR { MeqSourceList::MeqSourceList (ParmDB::ParmDB& parmTable, MeqParmGroup* group) { // Get the vector of all parms containing a source name. - vector<string> nams = parmTable.getNames("RA.*"); + // Also get all parms representing a gaussian source. + vector<string> nams = parmTable.getNames("RA:*"); + vector<string> gnams = parmTable.getNames("Phi:*"); if (nams.size() == 0) { map<string,ParmDB::ParmValueSet> pset; - parmTable.getDefValues (pset, "RA.*"); + parmTable.getDefValues (pset, "RA:*"); for (map<string,ParmDB::ParmValueSet>::const_iterator iter = pset.begin(); iter != pset.end(); iter++) { nams.push_back (iter->first); } + pset.clear(); + parmTable.getDefValues (pset, "Phi:*"); + for (map<string,ParmDB::ParmValueSet>::const_iterator iter = pset.begin(); + iter != pset.end(); + iter++) { + gnams.push_back (iter->first); + } } - vector<int> srcs(nams.size()); - // Extract the sourcenrs from the names. + // Extract the sourcenames from the parmnames. for (uint i=0; i<nams.size(); i++) { string name = nams[i]; - // Remove first part from the name which looks like RA.CPn.. - string::size_type idx = name.rfind ('.'); + // Remove first part from the name which looks like RA:name. + string::size_type idx = name.rfind (':'); ASSERT (idx != string::npos); - // Remove first part (RA or so). name = name.substr (idx+1); nams[i] = name; - int srcnr = -1; - // Get sourcenr from name which looks like CPn. - if (name.substr(0,2) == "CP") { - istringstream istr(name.substr(2)); - istr >> srcnr; - srcs[i] = srcnr-1; - } } - // Sort the srcnrs uniquely. + // Extract the sourcenames from the parmnames. + for (uint i=0; i<gnams.size(); i++) { + string name = gnams[i]; + // Remove first part from the name which looks like RA:name. + string::size_type idx = name.rfind (':'); + ASSERT (idx != string::npos); + name = name.substr (idx+1); + gnams[i] = name; + } + // Sort the names uniquely. Vector<uInt> index; - int nr = GenSortIndirect<int>::sort (index, &srcs[0], srcs.size(), - Sort::Ascending, - Sort::QuickSort|Sort::NoDuplicates); + int nr = GenSortIndirect<string>::sort (index, &nams[0], nams.size(), + Sort::Ascending, + Sort::QuickSort|Sort::NoDuplicates); for (int i=0; i<nr; i++) { int inx = index(i); - string name = nams[inx]; - MeqParmFunklet* mr = new MeqParmFunklet("RA."+name, + const string& name = nams[inx]; + MeqParmFunklet* mr = new MeqParmFunklet("RA:"+name, group, &parmTable); - MeqParmFunklet* md = new MeqParmFunklet("DEC."+name, + MeqParmFunklet* md = new MeqParmFunklet("DEC:"+name, group, &parmTable); - MeqParmFunklet* mi = new MeqParmFunklet("StokesI."+name, + MeqParmFunklet* mi = new MeqParmFunklet("StokesI:"+name, group, &parmTable); - MeqParmFunklet* mq = new MeqParmFunklet("StokesQ."+name, + MeqParmFunklet* mq = new MeqParmFunklet("StokesQ:"+name, group, &parmTable); - MeqParmFunklet* mu = new MeqParmFunklet("StokesU."+name, + MeqParmFunklet* mu = new MeqParmFunklet("StokesU:"+name, group, &parmTable); - MeqParmFunklet* mv = new MeqParmFunklet("StokesV."+name, + MeqParmFunklet* mv = new MeqParmFunklet("StokesV:"+name, group, &parmTable); - add (MeqPointSource(name, mi, mq, mu, mv, mr, md)); + if (std::find(gnams.begin(), gnams.end(), name) == gnams.end()) { + add (new MeqPointSource(name, mi, mq, mu, mv, mr, md)); + } else { + MeqParmFunklet* mmin = new MeqParmFunklet("Minor:"+name, + group, &parmTable); + MeqParmFunklet* mmaj = new MeqParmFunklet("Major:"+name, + group, &parmTable); + MeqParmFunklet* mphi = new MeqParmFunklet("Phi:"+name, + group, &parmTable); + add (new MeqGaussSource(name, mi, mq, mu, mv, mr, md, mmin, mmaj, mphi)); + } // cout << "Found source " << name << " (srcnr=" << srcnr << ')' << endl; } } -void MeqSourceList::add (const MeqPointSource& source) +MeqSourceList::~MeqSourceList() { - itsSelected.push_back (itsSources.size()); - itsSources.push_back (source); + for (vector<MeqSource*>::iterator iter = itsSources.begin(); + iter != itsSources.end(); + iter++) { + delete *iter; + } } -void MeqSourceList::setSelected (const vector<int>& sel) +const vector<int>& MeqSourceList::getGroup (const string& groupName) const { - if (sel.size() == 0) { - itsSelected.resize (itsSources.size()); - for (unsigned int i=0; i<itsSources.size(); i++) { - itsSelected[i] = i; - } - } else { - for (unsigned int i=0; i<sel.size(); i++) { - ASSERT (sel[i] >= 0); - ASSERT (sel[i] < int(itsSources.size())); - } - itsSelected = sel; - } + map<string,vector<int> >::const_iterator idx = itsGroupMap.find (groupName); + ASSERTSTR (idx != itsGroupMap.end(), + "Source group " << groupName << " is unknown"); + return idx->second; +} + +void MeqSourceList::add (MeqSource* source) +{ + int idx = itsSources.size(); + itsSources.push_back (source); + itsNameMap[source->getName()] = idx; + vector<int>& group = itsGroupMap[source->getGroupName()]; + group.push_back (idx); } } + diff --git a/CEP/BB/BBS/src/MNS/MeqSourceList.h b/CEP/BB/BBS/src/MNS/MeqSourceList.h index 488fc6b9875444f1b86d098c03d0a8725683ce72..0d2f3478a2b328ac20cc2c6cedae5f6644ec27f9 100644 --- a/CEP/BB/BBS/src/MNS/MeqSourceList.h +++ b/CEP/BB/BBS/src/MNS/MeqSourceList.h @@ -30,6 +30,7 @@ #include <BBS/MNS/MeqPointSource.h> #include <ParmDB/ParmDB.h> #include <Common/lofar_vector.h> +#include <Common/lofar_map.h> namespace LOFAR { @@ -50,28 +51,32 @@ public: // Fill the source list from the sources in the parm table. MeqSourceList (ParmDB::ParmDB& parmTable, MeqParmGroup* group); - // Get the number of sources to be used. - int size() const - { return itsSelected.size(); } + ~MeqSourceList(); - // Get the actual source number in the source list. - int actualSourceNr (int sourceNr) const - { return itsSelected[sourceNr]; } + // Get the total number of sources. + uint size() const + { return itsSources.size(); } - // Get the i-th selected source. - MeqPointSource& operator[] (int i) - { return itsSources[itsSelected[i]]; } + // Get the i-th source. + MeqSource& operator[] (int i) + { return *itsSources[i]; } + + // Get the source indices in the given group. + const vector<int>& getGroup (const string& groupName) const; - // Set the sources to be actually used. - // An empty vector selects all sources. - void setSelected (const vector<int>&); - private: + // Forbid copies. + // <group> + MeqSourceList (const MeqSourceList&); + MeqSourceList& operator= (const MeqSourceList&); + // </group> + // Add a source. - void add (const MeqPointSource&); + void add (MeqSource*); - vector<MeqPointSource> itsSources; - vector<int> itsSelected; + vector<MeqSource*> itsSources; + map<string,int> itsNameMap; + map<string,vector<int> > itsGroupMap; }; // @} diff --git a/CEP/BB/BBS/src/Makefile.am b/CEP/BB/BBS/src/Makefile.am index f800eb5379ce7879691bca172a179e831d3822f9..629bea39f123af553f9cd5efd36299e92d874761 100644 --- a/CEP/BB/BBS/src/Makefile.am +++ b/CEP/BB/BBS/src/Makefile.am @@ -18,6 +18,7 @@ MNS/MeqDiag.h \ MNS/MeqDomain.h \ MNS/MeqExpr.h \ MNS/MeqFunklet.h \ +MNS/MeqGaussSource.h \ MNS/MeqJonesCMul2.h \ MNS/MeqJonesCMul3.h \ MNS/MeqJonesExpr.h \ @@ -37,6 +38,7 @@ MNS/MeqMatrixRealSca.h \ MNS/MeqMatrixRep.h \ MNS/MeqMatrixTmp.h \ MNS/MeqParm.h \ +MNS/MeqParmExpr.h \ MNS/MeqParmFunklet.h \ MNS/MeqParmSingle.h \ MNS/MeqPhaseRef.h \ @@ -46,6 +48,7 @@ MNS/MeqRequest.h \ MNS/MeqRequestId.h \ MNS/MeqResult.h \ MNS/MeqResultVec.h \ +MNS/MeqSource.h \ MNS/MeqSourceList.h \ MNS/MeqStatExpr.h \ MNS/MeqStation.h \ @@ -74,6 +77,7 @@ MNS/MeqDFTPS.cc \ MNS/MeqDomain.cc \ MNS/MeqExpr.cc \ MNS/MeqFunklet.cc \ +MNS/MeqGaussSource.cc \ MNS/MeqJonesCMul2.cc \ MNS/MeqJonesCMul3.cc \ MNS/MeqJonesExpr.cc \ @@ -92,6 +96,7 @@ MNS/MeqMatrixRealSca.cc \ MNS/MeqMatrixRep.cc \ MNS/MeqMatrixTmp.cc \ MNS/MeqParm.cc \ +MNS/MeqParmExpr.cc \ MNS/MeqParmFunklet.cc \ MNS/MeqParmSingle.cc \ MNS/MeqPhaseRef.cc \ @@ -100,6 +105,7 @@ MNS/MeqPolc.cc \ MNS/MeqRequest.cc \ MNS/MeqResult.cc \ MNS/MeqResultVec.cc \ +MNS/MeqSource.cc \ MNS/MeqSourceList.cc \ MNS/MeqStatExpr.cc \ MNS/MeqStation.cc \ diff --git a/CEP/BB/BBS/src/Prediffer.cc b/CEP/BB/BBS/src/Prediffer.cc index ccc0a16b40cf22fdb8f205b14333d12d2975651f..5812e8738555fc76e3b84a10b875a9dca2018994 100644 --- a/CEP/BB/BBS/src/Prediffer.cc +++ b/CEP/BB/BBS/src/Prediffer.cc @@ -143,6 +143,7 @@ Prediffer::Prediffer(const string& msName, itsGSMMEPName (skyPdm.getTableName()), itsGSMMEP (skyPdm), itsCalcUVW (calcUVW), + itsSources (0), itsSrcGrp (sourceGroups), itsNrPert (0), itsNCorr (0), @@ -242,6 +243,7 @@ Prediffer::~Prediffer() { LOG_TRACE_FLOW( "Prediffer destructor" ); + delete itsSources; for (vector<MeqStatUVW*>::iterator iter = itsStatUVW.begin(); iter != itsStatUVW.end(); iter++) { @@ -423,16 +425,16 @@ void Prediffer::countBaseCorr() // // ~getSources // -// Get all sources from the GSM table. +// Get all sources from the parmtable. // //---------------------------------------------------------------------- void Prediffer::getSources() { // Get the sources from the ParmTable - itsSources = MeqSourceList(itsGSMMEP, &itsParmGroup); - int nrsrc = itsSources.size(); + itsSources = new MeqSourceList(itsGSMMEP, &itsParmGroup); + int nrsrc = itsSources->size(); for (int i=0; i<nrsrc; ++i) { - itsSources[i].setSourceNr (i); + (*itsSources)[i].setSourceNr (i); } // Make a map for the sources actually used. itsSrcNrMap.reserve (nrsrc); @@ -444,7 +446,6 @@ void Prediffer::getSources() vec[0] = i+1; // source nrs are 1-relative itsSrcGrp[i] = vec; itsSrcNrMap.push_back (i); - itsSources[i].setGroupNr (i); // group nrs are 0-relative } } else { for (uint j=0; j<itsSrcGrp.size(); ++j) { @@ -454,10 +455,7 @@ void Prediffer::getSources() ASSERTSTR (srcs[i] > 0 && srcs[i] <= nrsrc, "Sourcenr " << srcs[i] << " must be > 0 and <= #sources (=" << nrsrc << ')'); - ASSERTSTR (itsSources[srcs[i]-1].getGroupNr() < 0, - "Sourcenr " << srcs[i] << " multiply used in groups"); - itsSources[srcs[i]-1].setGroupNr (j); - itsSources[srcs[i]-1].setSourceNr (itsSrcNrMap.size()); + (*itsSources)[srcs[i]-1].setSourceNr (itsSrcNrMap.size()); itsSrcNrMap.push_back (srcs[i]-1); } } @@ -467,7 +465,7 @@ void Prediffer::getSources() itsLMN.reserve (nrused); for (int i=0; i<nrused; ++i) { int src = itsSrcNrMap[i]; - MeqLMN* lmn = new MeqLMN(&(itsSources[src])); + MeqLMN* lmn = new MeqLMN(&((*itsSources)[src])); lmn->setPhaseRef (&itsPhaseRef); itsLMN.push_back (lmn); } @@ -498,11 +496,11 @@ void Prediffer::makeLOFARExpr (bool useTEJ, bool usePEJ, bool asAP, int nrgrp = itsSrcGrp.size(); itsStatUVW.reserve (nrstat); // EJ is real/imag or ampl/phase - string ejname1 = "real."; - string ejname2 = "imag."; + string ejname1 = "real:"; + string ejname2 = "imag:"; if (asAP) { - ejname1 = "ampl."; - ejname2 = "phase."; + ejname1 = "ampl:"; + ejname2 = "phase:"; } // Vector containing StatExpr-s. vector<MeqJonesExpr> statExpr(nrstat); @@ -523,21 +521,21 @@ void Prediffer::makeLOFARExpr (bool useTEJ, bool usePEJ, bool asAP, uvw = new MeqStatUVW (itsStations[i], &itsPhaseRef); // Do pure station parameters only if told so. if (useStatParm) { - MeqExpr frot (new MeqParmFunklet ("frot." + - itsStations[i]->getName(), - &itsParmGroup, &itsMEP)); - MeqExpr drot (new MeqParmFunklet ("drot." + - itsStations[i]->getName(), - &itsParmGroup, &itsMEP)); - MeqExpr dell (new MeqParmFunklet ("dell." + - itsStations[i]->getName(), - &itsParmGroup, &itsMEP)); - MeqExpr gain11 (new MeqParmFunklet ("gain.11." + - itsStations[i]->getName(), - &itsParmGroup, &itsMEP)); - MeqExpr gain22 (new MeqParmFunklet ("gain.22." + - itsStations[i]->getName(), - &itsParmGroup, &itsMEP)); + MeqExpr frot (MeqParmFunklet::create ("frot:" + + itsStations[i]->getName(), + &itsParmGroup, &itsMEP)); + MeqExpr drot (MeqParmFunklet::create ("drot:" + + itsStations[i]->getName(), + &itsParmGroup, &itsMEP)); + MeqExpr dell (MeqParmFunklet::create ("dell:" + + itsStations[i]->getName(), + &itsParmGroup, &itsMEP)); + MeqExpr gain11 (MeqParmFunklet::create ("gain:11:" + + itsStations[i]->getName(), + &itsParmGroup, &itsMEP)); + MeqExpr gain22 (MeqParmFunklet::create ("gain:22:" + + itsStations[i]->getName(), + &itsParmGroup, &itsMEP)); statExpr[i] = MeqJonesExpr(new MeqStatExpr (frot, drot, dell, gain11, gain22)); } @@ -553,22 +551,22 @@ void Prediffer::makeLOFARExpr (bool useTEJ, bool usePEJ, bool asAP, if (useTEJ) { // Make a gain/phase expression per station. string nm = itsStations[i]->getName(); - MeqExpr ej11r (new MeqParmFunklet ("EJ11." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej11i (new MeqParmFunklet ("EJ11." + ejname2 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej12r (new MeqParmFunklet ("EJ12." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej12i (new MeqParmFunklet ("EJ12." + ejname2 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej21r (new MeqParmFunklet ("EJ21." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej21i (new MeqParmFunklet ("EJ21." + ejname2 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej22r (new MeqParmFunklet ("EJ22." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej22i (new MeqParmFunklet ("EJ22." + ejname2 + nm, - &itsParmGroup, &itsMEP)); + MeqExpr ej11r (MeqParmFunklet::create ("EJ11:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej11i (MeqParmFunklet::create ("EJ11:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej12r (MeqParmFunklet::create ("EJ12:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej12i (MeqParmFunklet::create ("EJ12:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej21r (MeqParmFunklet::create ("EJ21:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej21i (MeqParmFunklet::create ("EJ21:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej22r (MeqParmFunklet::create ("EJ22:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej22i (MeqParmFunklet::create ("EJ22:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); if (asAP) { ej11 = new MeqExprAPToComplex (ej11r, ej11i); ej12 = new MeqExprAPToComplex (ej12r, ej12i); @@ -589,23 +587,23 @@ void Prediffer::makeLOFARExpr (bool useTEJ, bool usePEJ, bool asAP, for (int j=0; j<nrgrp; j++) { ostringstream ostr; ostr << j+1; - string nm = itsStations[i]->getName() + ".SG" + ostr.str(); - MeqExpr ej11r (new MeqParmFunklet ("EJ11." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej11i (new MeqParmFunklet ("EJ11." + ejname2 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej12r (new MeqParmFunklet ("EJ12." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej12i (new MeqParmFunklet ("EJ12." + ejname2 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej21r (new MeqParmFunklet ("EJ21." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej21i (new MeqParmFunklet ("EJ21." + ejname2 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej22r (new MeqParmFunklet ("EJ22." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej22i (new MeqParmFunklet ("EJ22." + ejname2 + nm, - &itsParmGroup, &itsMEP)); + string nm = itsStations[i]->getName() + ":SG" + ostr.str(); + MeqExpr ej11r (MeqParmFunklet::create ("EJ11:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej11i (MeqParmFunklet::create ("EJ11:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej12r (MeqParmFunklet::create ("EJ12:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej12i (MeqParmFunklet::create ("EJ12:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej21r (MeqParmFunklet::create ("EJ21:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej21i (MeqParmFunklet::create ("EJ21:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej22r (MeqParmFunklet::create ("EJ22:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej22i (MeqParmFunklet::create ("EJ22:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); if (asAP) { ej11 = new MeqExprAPToComplex (ej11r, ej11i); ej12 = new MeqExprAPToComplex (ej12r, ej12i); @@ -661,9 +659,10 @@ void Prediffer::makeLOFARExpr (bool useTEJ, bool usePEJ, bool asAP, MeqExpr expr1 (new MeqBaseDFTPS (pdfts[ant1*nrsrc + src], pdfts[ant2*nrsrc + src], itsLMN[src])); - vecSrc.push_back (MeqJonesExpr - (new MeqBaseLinPS(expr1, - &(itsSources[itsSrcNrMap[src]])))); + // For the time being only point sources are supported. + MeqPointSource& mps = dynamic_cast<MeqPointSource&> + ((*itsSources)[itsSrcNrMap[src]]); + vecSrc.push_back (MeqJonesExpr (new MeqBaseLinPS(expr1, &mps))); } MeqJonesExpr sum; // Sum all sources in the group. @@ -1970,28 +1969,28 @@ void Prediffer::fillUVW() bool Prediffer::setPeelGroups (const vector<int>& peelGroups, const vector<int>& extraGroups) { - vector<int> allNrs; - for (uint i=0; i<extraGroups.size(); ++i) { - ASSERT (extraGroups[i] >= 0 && extraGroups[i] < int(itsSrcGrp.size())); - const vector<int>& grp = itsSrcGrp[i]; - for (uint j=0; j<grp.size(); ++j) { - allNrs.push_back (grp[j] - 1); - } - } - vector<int> peelNrs; - for (uint i=0; i<peelGroups.size(); ++i) { - ASSERT (peelGroups[i] >= 0 && peelGroups[i] < int(itsSrcGrp.size())); - const vector<int>& grp = itsSrcGrp[peelGroups[i]]; - for (uint j=0; j<grp.size(); ++j) { - peelNrs.push_back (grp[j] - 1); - allNrs.push_back (grp[j] - 1); - } - } - LOG_TRACE_OBJ_STR( "peel sources " << peelNrs << "; predict sources " - << allNrs ); - ASSERT (peelNrs.size() > 0); - itsSources.setSelected (allNrs); - itsPeelSourceNrs = peelNrs; +// vector<int> allNrs; +// for (uint i=0; i<extraGroups.size(); ++i) { +// ASSERT (extraGroups[i] >= 0 && extraGroups[i] < int(itsSrcGrp.size())); +// const vector<int>& grp = itsSrcGrp[i]; +// for (uint j=0; j<grp.size(); ++j) { +// allNrs.push_back (grp[j] - 1); +// } +// } +// vector<int> peelNrs; +// for (uint i=0; i<peelGroups.size(); ++i) { +// ASSERT (peelGroups[i] >= 0 && peelGroups[i] < int(itsSrcGrp.size())); +// const vector<int>& grp = itsSrcGrp[peelGroups[i]]; +// for (uint j=0; j<grp.size(); ++j) { +// peelNrs.push_back (grp[j] - 1); +// allNrs.push_back (grp[j] - 1); +// } +// } +// LOG_TRACE_OBJ_STR( "peel sources " << peelNrs << "; predict sources " +// << allNrs ); +// ASSERT (peelNrs.size() > 0); +// itsSources.setSelected (allNrs); +// itsPeelSourceNrs = peelNrs; return true; } diff --git a/CEP/BB/BBS/src/Prediffer.h b/CEP/BB/BBS/src/Prediffer.h index 63077c47e98e5dff989428d727f9b9a846017827..8a72f2a54defe0b7658573f5296f2d2aec2de10e 100644 --- a/CEP/BB/BBS/src/Prediffer.h +++ b/CEP/BB/BBS/src/Prediffer.h @@ -327,7 +327,7 @@ private: MeqPhaseRef itsPhaseRef; //# Phase reference position in J2000 - MeqSourceList itsSources; + MeqSourceList* itsSources; vector<vector<int> > itsSrcGrp; //# sources in each group vector<int> itsSrcNrMap; //# map of all srcnr to used srcnr vector<int> itsPeelSourceNrs; diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.dat b/CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.dat new file mode 100644 index 0000000000000000000000000000000000000000..92402a83c552826f665500bf9c72bb5f7a2f3e6f Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.dat differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0 b/CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0 new file mode 100644 index 0000000000000000000000000000000000000000..b57f473278b80ae392b2c1b3bc67402cbae601e4 Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0 differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0i b/CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0i new file mode 100644 index 0000000000000000000000000000000000000000..33964e5347f22d5a9eaa6ae1342396eeccdbe615 Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0i differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.info b/CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.info new file mode 100644 index 0000000000000000000000000000000000000000..1e2a62505a013c60eb702ea2a58dacdd7f820b62 --- /dev/null +++ b/CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.info @@ -0,0 +1,5 @@ +Type = MEPold +SubType = + +Initial ME Parameter values +Old ME Parameter values diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.lock b/CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.lock new file mode 100644 index 0000000000000000000000000000000000000000..36c25acc40a05c4842e28d04895408068789d419 Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep1/DEFAULTVALUES/table.lock differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.dat b/CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.dat new file mode 100644 index 0000000000000000000000000000000000000000..376d73371132c857d6ea34689eb29aae972076cd Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.dat differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.f0 b/CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.f0 new file mode 100644 index 0000000000000000000000000000000000000000..b4837eddcf727ef2745f1c5f0fd58a644041c6a8 Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.f0 differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.f0i b/CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.f0i new file mode 100644 index 0000000000000000000000000000000000000000..c09f05b309fbcc6ff12c9eb91aff39455347c41e Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.f0i differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.info b/CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.info new file mode 100644 index 0000000000000000000000000000000000000000..a1a976ed49439abda34d2c64cfd0360cfcdef651 --- /dev/null +++ b/CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.info @@ -0,0 +1,3 @@ +Type = +SubType = + diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.lock b/CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.lock new file mode 100644 index 0000000000000000000000000000000000000000..bda58097b47771545f500a22ba10e538987277a8 Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep1/OLDVALUES/table.lock differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep1/table.dat b/CEP/BB/BBS/test/tParmMerge.in_mep1/table.dat new file mode 100644 index 0000000000000000000000000000000000000000..1febb8e5ea7b978633f4a5f540b4967cf5ba8148 Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep1/table.dat differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep1/table.f0 b/CEP/BB/BBS/test/tParmMerge.in_mep1/table.f0 new file mode 100644 index 0000000000000000000000000000000000000000..f83deca64494f24bbe78f5fe426a0895bb722519 Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep1/table.f0 differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep1/table.f0i b/CEP/BB/BBS/test/tParmMerge.in_mep1/table.f0i new file mode 100644 index 0000000000000000000000000000000000000000..5a497c3e4359126508ed7aae16bcc14821094dab Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep1/table.f0i differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep1/table.info b/CEP/BB/BBS/test/tParmMerge.in_mep1/table.info new file mode 100644 index 0000000000000000000000000000000000000000..f785028b10dfc87c48b9eb2c38d540706d1cfd2c --- /dev/null +++ b/CEP/BB/BBS/test/tParmMerge.in_mep1/table.info @@ -0,0 +1,4 @@ +Type = MEP +SubType = + +ME Parameter values diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep1/table.lock b/CEP/BB/BBS/test/tParmMerge.in_mep1/table.lock new file mode 100644 index 0000000000000000000000000000000000000000..18ff0cf15fe51e32036517fc984c70cd6a22f23f Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep1/table.lock differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.dat b/CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.dat new file mode 100644 index 0000000000000000000000000000000000000000..92402a83c552826f665500bf9c72bb5f7a2f3e6f Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.dat differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0 b/CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0 new file mode 100644 index 0000000000000000000000000000000000000000..b57f473278b80ae392b2c1b3bc67402cbae601e4 Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0 differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0i b/CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0i new file mode 100644 index 0000000000000000000000000000000000000000..33964e5347f22d5a9eaa6ae1342396eeccdbe615 Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0i differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.info b/CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.info new file mode 100644 index 0000000000000000000000000000000000000000..1e2a62505a013c60eb702ea2a58dacdd7f820b62 --- /dev/null +++ b/CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.info @@ -0,0 +1,5 @@ +Type = MEPold +SubType = + +Initial ME Parameter values +Old ME Parameter values diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.lock b/CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.lock new file mode 100644 index 0000000000000000000000000000000000000000..36c25acc40a05c4842e28d04895408068789d419 Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep2/DEFAULTVALUES/table.lock differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.dat b/CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.dat new file mode 100644 index 0000000000000000000000000000000000000000..376d73371132c857d6ea34689eb29aae972076cd Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.dat differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.f0 b/CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.f0 new file mode 100644 index 0000000000000000000000000000000000000000..b4837eddcf727ef2745f1c5f0fd58a644041c6a8 Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.f0 differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.f0i b/CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.f0i new file mode 100644 index 0000000000000000000000000000000000000000..c09f05b309fbcc6ff12c9eb91aff39455347c41e Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.f0i differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.info b/CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.info new file mode 100644 index 0000000000000000000000000000000000000000..a1a976ed49439abda34d2c64cfd0360cfcdef651 --- /dev/null +++ b/CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.info @@ -0,0 +1,3 @@ +Type = +SubType = + diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.lock b/CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.lock new file mode 100644 index 0000000000000000000000000000000000000000..bda58097b47771545f500a22ba10e538987277a8 Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep2/OLDVALUES/table.lock differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep2/table.dat b/CEP/BB/BBS/test/tParmMerge.in_mep2/table.dat new file mode 100644 index 0000000000000000000000000000000000000000..838639a5f0db6a34dbe950b6930a7c29b6c1fb83 Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep2/table.dat differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep2/table.f0 b/CEP/BB/BBS/test/tParmMerge.in_mep2/table.f0 new file mode 100644 index 0000000000000000000000000000000000000000..e05e8439f942720587eb4ee06e42831f28b3e0cd Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep2/table.f0 differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep2/table.f0i b/CEP/BB/BBS/test/tParmMerge.in_mep2/table.f0i new file mode 100644 index 0000000000000000000000000000000000000000..dc8bb6443a3481bb1c31d7cb0173140e8275c5d9 Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep2/table.f0i differ diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep2/table.info b/CEP/BB/BBS/test/tParmMerge.in_mep2/table.info new file mode 100644 index 0000000000000000000000000000000000000000..f785028b10dfc87c48b9eb2c38d540706d1cfd2c --- /dev/null +++ b/CEP/BB/BBS/test/tParmMerge.in_mep2/table.info @@ -0,0 +1,4 @@ +Type = MEP +SubType = + +ME Parameter values diff --git a/CEP/BB/BBS/test/tParmMerge.in_mep2/table.lock b/CEP/BB/BBS/test/tParmMerge.in_mep2/table.lock new file mode 100644 index 0000000000000000000000000000000000000000..bdf9db95453ccd639ff18180bd352650711e4f50 Binary files /dev/null and b/CEP/BB/BBS/test/tParmMerge.in_mep2/table.lock differ diff --git a/CEP/BB/BBS/test/tPredSolv.cc b/CEP/BB/BBS/test/tPredSolv.cc index a6080a930f0b03394a13a913c986fd98cedc5d1a..ceeb728d8758aea0042fff3854313668f4429d08 100644 --- a/CEP/BB/BBS/test/tPredSolv.cc +++ b/CEP/BB/BBS/test/tPredSolv.cc @@ -209,9 +209,9 @@ int main (int argc, const char* argv[]) vector<int> corr; pre1.select (antVec2, antVec2, false, corr); // no autocorrelations vector<string> solv(3); - solv[0] = "RA.*"; - solv[1] = "DEC.*"; - solv[2] = "StokesI.*"; + solv[0] = "RA:*"; + solv[1] = "DEC:*"; + solv[2] = "StokesI:*"; doSolve (pre1, solv, 9); cout << "End of first test" << endl; } @@ -236,9 +236,9 @@ int main (int argc, const char* argv[]) pre1.select (antVec2, antVec2, false, corr); // no autocorrelations pre2.select (antVec2, antVec2, false, corr); // no autocorrelations vector<string> solv(3); - solv[0] = "RA.*"; - solv[1] = "DEC.*"; - solv[2] = "StokesI.*"; + solv[0] = "RA:*"; + solv[1] = "DEC:*"; + solv[2] = "StokesI:*"; doSolve2 (pre1, pre2, solv, 1); cout << "End of test with two prediffers" << endl; } @@ -257,9 +257,9 @@ int main (int argc, const char* argv[]) vector<int> antVec2; pre1.select (antVec2, antVec2, false, corrVec); // no autocorrelations vector<string> solv(3); - solv[0] = "RA.*"; - solv[1] = "DEC.*"; - solv[2] = "StokesI.*"; + solv[0] = "RA:*"; + solv[1] = "DEC:*"; + solv[2] = "StokesI:*"; doSolve (pre1, solv, 5); cout << "End of test with 21 antennas" << endl; } @@ -282,9 +282,9 @@ int main (int argc, const char* argv[]) vector<int> corr; pre1.select (antVec2, antVec2, false, corr); // no autocorrelations vector<string> solv(3); - solv[0] = "RA.*"; - solv[1] = "DEC.*"; - solv[2] = "StokesI.*"; + solv[0] = "RA:*"; + solv[1] = "DEC:*"; + solv[2] = "StokesI:*"; doSolve1 (pre1, solv, 5); cout << "End of test with updating parmtable" << endl; } diff --git a/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqLMN.h b/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqLMN.h index 46701b0f7802c59352a7611f9f9b13632a14e21d..4f47863a4e5994ca5228c12b51e83b12589f08ba 100644 --- a/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqLMN.h +++ b/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqLMN.h @@ -37,7 +37,7 @@ namespace LOFAR { // @{ //# Forward Declarations -class MeqPointSource; +class MeqSource; class MeqPhaseRef; @@ -45,9 +45,9 @@ class MeqLMN: public MeqExprRep { public: // Construct for the given point source. - explicit MeqLMN (MeqPointSource*); + explicit MeqLMN (MeqSource*); - const MeqPointSource& getSource() const + const MeqSource& getSource() const { return *itsSource; } // Set the phase reference position. @@ -60,7 +60,7 @@ public: MeqResultVec getAnResultVec (const MeqRequest& request); private: - MeqPointSource* itsSource; + MeqSource* itsSource; const MeqPhaseRef* itsPhaseRef; }; diff --git a/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqParmFunklet.h b/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqParmFunklet.h index 2158e2d0776f42dfb83b7292acbbf366bdc51181..2fa319206aaa862b3bddb040b83db2c65fdd7eae 100644 --- a/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqParmFunklet.h +++ b/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqParmFunklet.h @@ -20,7 +20,7 @@ //# //# $Id$ -#if !defined(MNS_MEQPARMFUNKLET_H) +#ifndef MNS_MEQPARMFUNKLET_H #define MNS_MEQPARMFUNKLET_H // \file @@ -58,6 +58,13 @@ public: virtual ~MeqParmFunklet(); + // Make the correct object depending on the parm type. + // For a parm expression a MeqParmExpr object is created, otherwise + // a MeqParmFunklet. + static MeqExprRep* create (const string& name, + MeqParmGroup* group, + ParmDB::ParmDB* table); + // Get the requested result of the parameter. virtual MeqResult getResult (const MeqRequest&); diff --git a/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqPointSource.h b/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqPointSource.h index 69e78bf73ad1204669b3aab568b14af0850a3a3e..47f11bc9ef43ff2ee3c23b5d51c670e01cf5d812 100644 --- a/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqPointSource.h +++ b/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqPointSource.h @@ -20,16 +20,14 @@ //# //# $Id$ -#if !defined(MNS_MEQPOINTSOURCE_H) +#ifndef MNS_MEQPOINTSOURCE_H #define MNS_MEQPOINTSOURCE_H // \file // Class holding a point source //# Includes -#include <BBS/MNS/MeqExpr.h> -#include <BBS/MNS/MeqResult.h> -#include <BBS/MNS/MeqRequest.h> +#include <BBS/MNS/MeqSource.h> #include <Common/lofar_string.h> namespace LOFAR { @@ -38,23 +36,16 @@ namespace LOFAR { // \addtogroup MNS // @{ -//# Forward Declarations -class MeqPhaseRef; - -class MeqPointSource +class MeqPointSource: public MeqSource { public: - // The default constructor. - MeqPointSource(); - MeqPointSource (const string& name, const MeqExpr& fluxI, const MeqExpr& fluxQ, const MeqExpr& fluxU, const MeqExpr& fluxV, const MeqExpr& ra, const MeqExpr& dec); - const string& getName() const - { return itsName; } + virtual ~MeqPointSource(); MeqExpr& getI() { return itsI; } @@ -64,37 +55,12 @@ public: { return itsU; } MeqExpr& getV() { return itsV; } - MeqExpr& getRa() - { return itsRa; } - MeqExpr& getDec() - { return itsDec; } - - // Get the source nr. - int getSourceNr() const - { return itsSourceNr; } - - // Get the group nr. - int getGroupNr() const - { return itsGroupNr; } - - // Set the source nr. - void setSourceNr (int sourceNr) - { itsSourceNr = sourceNr; } - - // Set the group nr. - void setGroupNr (int groupNr) - { itsGroupNr = groupNr; } private: - int itsSourceNr; - int itsGroupNr; - string itsName; MeqExpr itsI; MeqExpr itsQ; MeqExpr itsU; MeqExpr itsV; - MeqExpr itsRa; - MeqExpr itsDec; }; // @} diff --git a/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqSourceList.h b/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqSourceList.h index 488fc6b9875444f1b86d098c03d0a8725683ce72..0d2f3478a2b328ac20cc2c6cedae5f6644ec27f9 100644 --- a/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqSourceList.h +++ b/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqSourceList.h @@ -30,6 +30,7 @@ #include <BBS/MNS/MeqPointSource.h> #include <ParmDB/ParmDB.h> #include <Common/lofar_vector.h> +#include <Common/lofar_map.h> namespace LOFAR { @@ -50,28 +51,32 @@ public: // Fill the source list from the sources in the parm table. MeqSourceList (ParmDB::ParmDB& parmTable, MeqParmGroup* group); - // Get the number of sources to be used. - int size() const - { return itsSelected.size(); } + ~MeqSourceList(); - // Get the actual source number in the source list. - int actualSourceNr (int sourceNr) const - { return itsSelected[sourceNr]; } + // Get the total number of sources. + uint size() const + { return itsSources.size(); } - // Get the i-th selected source. - MeqPointSource& operator[] (int i) - { return itsSources[itsSelected[i]]; } + // Get the i-th source. + MeqSource& operator[] (int i) + { return *itsSources[i]; } + + // Get the source indices in the given group. + const vector<int>& getGroup (const string& groupName) const; - // Set the sources to be actually used. - // An empty vector selects all sources. - void setSelected (const vector<int>&); - private: + // Forbid copies. + // <group> + MeqSourceList (const MeqSourceList&); + MeqSourceList& operator= (const MeqSourceList&); + // </group> + // Add a source. - void add (const MeqPointSource&); + void add (MeqSource*); - vector<MeqPointSource> itsSources; - vector<int> itsSelected; + vector<MeqSource*> itsSources; + map<string,int> itsNameMap; + map<string,vector<int> > itsGroupMap; }; // @} diff --git a/CEP/BB/BBSKernel/include/BBSKernel/Prediffer.h b/CEP/BB/BBSKernel/include/BBSKernel/Prediffer.h index 63077c47e98e5dff989428d727f9b9a846017827..8a72f2a54defe0b7658573f5296f2d2aec2de10e 100644 --- a/CEP/BB/BBSKernel/include/BBSKernel/Prediffer.h +++ b/CEP/BB/BBSKernel/include/BBSKernel/Prediffer.h @@ -327,7 +327,7 @@ private: MeqPhaseRef itsPhaseRef; //# Phase reference position in J2000 - MeqSourceList itsSources; + MeqSourceList* itsSources; vector<vector<int> > itsSrcGrp; //# sources in each group vector<int> itsSrcNrMap; //# map of all srcnr to used srcnr vector<int> itsPeelSourceNrs; diff --git a/CEP/BB/BBSKernel/src/MNS/MeqFunklet.cc b/CEP/BB/BBSKernel/src/MNS/MeqFunklet.cc index de408f8d3aa2f51576ffacccdf7bbb57323efeae..66898602b54ad39ad8054c56583f2ac1d720dec0 100644 --- a/CEP/BB/BBSKernel/src/MNS/MeqFunklet.cc +++ b/CEP/BB/BBSKernel/src/MNS/MeqFunklet.cc @@ -89,7 +89,8 @@ MeqFunklet* MeqFunklet::make (const ParmDB::ParmValue& pvalue, return new MeqTabular(pvalue); } ASSERTSTR (false, - "Unknown funklet found for parameter " << name); + "Unknown funklet type " << pvalue.rep().itsType + << " found for parameter " << name); } int MeqFunklet::makeSolvable (int scidIndex) diff --git a/CEP/BB/BBSKernel/src/MNS/MeqLMN.cc b/CEP/BB/BBSKernel/src/MNS/MeqLMN.cc index 57450b4bdfcb90d3bdf60624780e5feeb8680227..ec541891b68bdc4d721a28bad2451e0e3bf8d05c 100644 --- a/CEP/BB/BBSKernel/src/MNS/MeqLMN.cc +++ b/CEP/BB/BBSKernel/src/MNS/MeqLMN.cc @@ -23,7 +23,7 @@ #include <lofar_config.h> #include <BBS/MNS/MeqLMN.h> -#include <BBS/MNS/MeqPointSource.h> +#include <BBS/MNS/MeqSource.h> #include <BBS/MNS/MeqPhaseRef.h> #include <BBS/MNS/MeqRequest.h> #include <BBS/MNS/MeqMatrixTmp.h> @@ -32,7 +32,7 @@ namespace LOFAR { -MeqLMN::MeqLMN (MeqPointSource* source) +MeqLMN::MeqLMN (MeqSource* source) : itsSource (source) { addChild (itsSource->getRa()); diff --git a/CEP/BB/BBSKernel/src/MNS/MeqLMN.h b/CEP/BB/BBSKernel/src/MNS/MeqLMN.h index 46701b0f7802c59352a7611f9f9b13632a14e21d..4f47863a4e5994ca5228c12b51e83b12589f08ba 100644 --- a/CEP/BB/BBSKernel/src/MNS/MeqLMN.h +++ b/CEP/BB/BBSKernel/src/MNS/MeqLMN.h @@ -37,7 +37,7 @@ namespace LOFAR { // @{ //# Forward Declarations -class MeqPointSource; +class MeqSource; class MeqPhaseRef; @@ -45,9 +45,9 @@ class MeqLMN: public MeqExprRep { public: // Construct for the given point source. - explicit MeqLMN (MeqPointSource*); + explicit MeqLMN (MeqSource*); - const MeqPointSource& getSource() const + const MeqSource& getSource() const { return *itsSource; } // Set the phase reference position. @@ -60,7 +60,7 @@ public: MeqResultVec getAnResultVec (const MeqRequest& request); private: - MeqPointSource* itsSource; + MeqSource* itsSource; const MeqPhaseRef* itsPhaseRef; }; diff --git a/CEP/BB/BBSKernel/src/MNS/MeqParmFunklet.cc b/CEP/BB/BBSKernel/src/MNS/MeqParmFunklet.cc index e1910128a5ea061158548842d4c42e4bc5d62a00..ddb76f7e32f5e862a0faeb6e9426d024b2291225 100644 --- a/CEP/BB/BBSKernel/src/MNS/MeqParmFunklet.cc +++ b/CEP/BB/BBSKernel/src/MNS/MeqParmFunklet.cc @@ -22,8 +22,11 @@ #include <lofar_config.h> #include <BBS/MNS/MeqParmFunklet.h> +#include <BBS/MNS/MeqParmExpr.h> #include <BBS/MNS/MeqPolc.h> #include <BBS/ParmData.h> +#include <ParmDB/ParmValue.h> +#include <ParmDB/ParmDB.h> #include <Common/LofarLogger.h> #include <casa/BasicMath/Math.h> @@ -49,7 +52,11 @@ MeqParmFunklet::MeqParmFunklet (const string& name, MeqParmGroup* group, itsNrPert (0), itsPertInx (-1), itsTable (table) -{} +{ + // See if the parm is a parm-expression. + // If so, create parm-funklets for them. + +} MeqParmFunklet::~MeqParmFunklet() { @@ -58,6 +65,26 @@ MeqParmFunklet::~MeqParmFunklet() } } +MeqExprRep* MeqParmFunklet::create (const string& name, + MeqParmGroup* group, + ParmDB::ParmDB* table) +{ + // If the parm is an expression, use that. + map<string,ParmDB::ParmValueSet> pset; + table->getDefValues (pset, name); + if (! pset.empty()) { + ParmDB::ParmValueSet& pvset = pset.begin()->second; + if (! pvset.getValues().empty()) { + ParmDB::ParmValueRep& pv = pvset.getValues()[0].rep(); + if (pv.itsType == "parmexpr") { + return new MeqParmExpr (pv.itsExpr, group, table); + } + } + } + // It is a normal funklet. + return new MeqParmFunklet (name, group, table); +} + void MeqParmFunklet::add (const MeqFunklet& funklet) { itsFunklets.push_back (funklet.clone()); diff --git a/CEP/BB/BBSKernel/src/MNS/MeqParmFunklet.h b/CEP/BB/BBSKernel/src/MNS/MeqParmFunklet.h index 2158e2d0776f42dfb83b7292acbbf366bdc51181..2fa319206aaa862b3bddb040b83db2c65fdd7eae 100644 --- a/CEP/BB/BBSKernel/src/MNS/MeqParmFunklet.h +++ b/CEP/BB/BBSKernel/src/MNS/MeqParmFunklet.h @@ -20,7 +20,7 @@ //# //# $Id$ -#if !defined(MNS_MEQPARMFUNKLET_H) +#ifndef MNS_MEQPARMFUNKLET_H #define MNS_MEQPARMFUNKLET_H // \file @@ -58,6 +58,13 @@ public: virtual ~MeqParmFunklet(); + // Make the correct object depending on the parm type. + // For a parm expression a MeqParmExpr object is created, otherwise + // a MeqParmFunklet. + static MeqExprRep* create (const string& name, + MeqParmGroup* group, + ParmDB::ParmDB* table); + // Get the requested result of the parameter. virtual MeqResult getResult (const MeqRequest&); diff --git a/CEP/BB/BBSKernel/src/MNS/MeqPointSource.cc b/CEP/BB/BBSKernel/src/MNS/MeqPointSource.cc index e2642d1d06d192304e4c71e054fd7b034c49993c..aa4cbb71011b7a07783091db5e9ebd838772786d 100644 --- a/CEP/BB/BBSKernel/src/MNS/MeqPointSource.cc +++ b/CEP/BB/BBSKernel/src/MNS/MeqPointSource.cc @@ -26,24 +26,18 @@ namespace LOFAR { -MeqPointSource::MeqPointSource() -: itsSourceNr (-1), - itsGroupNr (-1) -{} - MeqPointSource::MeqPointSource (const string& name, const MeqExpr& fluxI, const MeqExpr& fluxQ, const MeqExpr& fluxU, const MeqExpr& fluxV, const MeqExpr& ra, const MeqExpr& dec) -: itsSourceNr (-1), - itsGroupNr (-1), - itsName (name), - itsI (fluxI), - itsQ (fluxQ), - itsU (fluxU), - itsV (fluxV), - itsRa (ra), - itsDec (dec) +: MeqSource (name, "", ra, dec), + itsI (fluxI), + itsQ (fluxQ), + itsU (fluxU), + itsV (fluxV) +{} + +MeqPointSource::~MeqPointSource() {} } diff --git a/CEP/BB/BBSKernel/src/MNS/MeqPointSource.h b/CEP/BB/BBSKernel/src/MNS/MeqPointSource.h index 69e78bf73ad1204669b3aab568b14af0850a3a3e..47f11bc9ef43ff2ee3c23b5d51c670e01cf5d812 100644 --- a/CEP/BB/BBSKernel/src/MNS/MeqPointSource.h +++ b/CEP/BB/BBSKernel/src/MNS/MeqPointSource.h @@ -20,16 +20,14 @@ //# //# $Id$ -#if !defined(MNS_MEQPOINTSOURCE_H) +#ifndef MNS_MEQPOINTSOURCE_H #define MNS_MEQPOINTSOURCE_H // \file // Class holding a point source //# Includes -#include <BBS/MNS/MeqExpr.h> -#include <BBS/MNS/MeqResult.h> -#include <BBS/MNS/MeqRequest.h> +#include <BBS/MNS/MeqSource.h> #include <Common/lofar_string.h> namespace LOFAR { @@ -38,23 +36,16 @@ namespace LOFAR { // \addtogroup MNS // @{ -//# Forward Declarations -class MeqPhaseRef; - -class MeqPointSource +class MeqPointSource: public MeqSource { public: - // The default constructor. - MeqPointSource(); - MeqPointSource (const string& name, const MeqExpr& fluxI, const MeqExpr& fluxQ, const MeqExpr& fluxU, const MeqExpr& fluxV, const MeqExpr& ra, const MeqExpr& dec); - const string& getName() const - { return itsName; } + virtual ~MeqPointSource(); MeqExpr& getI() { return itsI; } @@ -64,37 +55,12 @@ public: { return itsU; } MeqExpr& getV() { return itsV; } - MeqExpr& getRa() - { return itsRa; } - MeqExpr& getDec() - { return itsDec; } - - // Get the source nr. - int getSourceNr() const - { return itsSourceNr; } - - // Get the group nr. - int getGroupNr() const - { return itsGroupNr; } - - // Set the source nr. - void setSourceNr (int sourceNr) - { itsSourceNr = sourceNr; } - - // Set the group nr. - void setGroupNr (int groupNr) - { itsGroupNr = groupNr; } private: - int itsSourceNr; - int itsGroupNr; - string itsName; MeqExpr itsI; MeqExpr itsQ; MeqExpr itsU; MeqExpr itsV; - MeqExpr itsRa; - MeqExpr itsDec; }; // @} diff --git a/CEP/BB/BBSKernel/src/MNS/MeqSourceList.cc b/CEP/BB/BBSKernel/src/MNS/MeqSourceList.cc index a3741c89032ee59b61653c41739c74528bde9881..3ac37f2eebb4b663248416c242e5430347795799 100644 --- a/CEP/BB/BBSKernel/src/MNS/MeqSourceList.cc +++ b/CEP/BB/BBSKernel/src/MNS/MeqSourceList.cc @@ -22,11 +22,14 @@ #include <lofar_config.h> #include <BBS/MNS/MeqSourceList.h> +#include <BBS/MNS/MeqPointSource.h> +#include <BBS/MNS/MeqGaussSource.h> #include <BBS/MNS/MeqParmFunklet.h> #include <Common/LofarLogger.h> #include <casa/Arrays/Vector.h> -#include <casa/Utilities/GenSort.h> +#include <casa/Utilities/GenSort.cc> // for automatic template +#include <algorithm> using namespace casa; @@ -35,79 +38,103 @@ namespace LOFAR { MeqSourceList::MeqSourceList (ParmDB::ParmDB& parmTable, MeqParmGroup* group) { // Get the vector of all parms containing a source name. - vector<string> nams = parmTable.getNames("RA.*"); + // Also get all parms representing a gaussian source. + vector<string> nams = parmTable.getNames("RA:*"); + vector<string> gnams = parmTable.getNames("Phi:*"); if (nams.size() == 0) { map<string,ParmDB::ParmValueSet> pset; - parmTable.getDefValues (pset, "RA.*"); + parmTable.getDefValues (pset, "RA:*"); for (map<string,ParmDB::ParmValueSet>::const_iterator iter = pset.begin(); iter != pset.end(); iter++) { nams.push_back (iter->first); } + pset.clear(); + parmTable.getDefValues (pset, "Phi:*"); + for (map<string,ParmDB::ParmValueSet>::const_iterator iter = pset.begin(); + iter != pset.end(); + iter++) { + gnams.push_back (iter->first); + } } - vector<int> srcs(nams.size()); - // Extract the sourcenrs from the names. + // Extract the sourcenames from the parmnames. for (uint i=0; i<nams.size(); i++) { string name = nams[i]; - // Remove first part from the name which looks like RA.CPn.. - string::size_type idx = name.rfind ('.'); + // Remove first part from the name which looks like RA:name. + string::size_type idx = name.rfind (':'); ASSERT (idx != string::npos); - // Remove first part (RA or so). name = name.substr (idx+1); nams[i] = name; - int srcnr = -1; - // Get sourcenr from name which looks like CPn. - if (name.substr(0,2) == "CP") { - istringstream istr(name.substr(2)); - istr >> srcnr; - srcs[i] = srcnr-1; - } } - // Sort the srcnrs uniquely. + // Extract the sourcenames from the parmnames. + for (uint i=0; i<gnams.size(); i++) { + string name = gnams[i]; + // Remove first part from the name which looks like RA:name. + string::size_type idx = name.rfind (':'); + ASSERT (idx != string::npos); + name = name.substr (idx+1); + gnams[i] = name; + } + // Sort the names uniquely. Vector<uInt> index; - int nr = GenSortIndirect<int>::sort (index, &srcs[0], srcs.size(), - Sort::Ascending, - Sort::QuickSort|Sort::NoDuplicates); + int nr = GenSortIndirect<string>::sort (index, &nams[0], nams.size(), + Sort::Ascending, + Sort::QuickSort|Sort::NoDuplicates); for (int i=0; i<nr; i++) { int inx = index(i); - string name = nams[inx]; - MeqParmFunklet* mr = new MeqParmFunklet("RA."+name, + const string& name = nams[inx]; + MeqParmFunklet* mr = new MeqParmFunklet("RA:"+name, group, &parmTable); - MeqParmFunklet* md = new MeqParmFunklet("DEC."+name, + MeqParmFunklet* md = new MeqParmFunklet("DEC:"+name, group, &parmTable); - MeqParmFunklet* mi = new MeqParmFunklet("StokesI."+name, + MeqParmFunklet* mi = new MeqParmFunklet("StokesI:"+name, group, &parmTable); - MeqParmFunklet* mq = new MeqParmFunklet("StokesQ."+name, + MeqParmFunklet* mq = new MeqParmFunklet("StokesQ:"+name, group, &parmTable); - MeqParmFunklet* mu = new MeqParmFunklet("StokesU."+name, + MeqParmFunklet* mu = new MeqParmFunklet("StokesU:"+name, group, &parmTable); - MeqParmFunklet* mv = new MeqParmFunklet("StokesV."+name, + MeqParmFunklet* mv = new MeqParmFunklet("StokesV:"+name, group, &parmTable); - add (MeqPointSource(name, mi, mq, mu, mv, mr, md)); + if (std::find(gnams.begin(), gnams.end(), name) == gnams.end()) { + add (new MeqPointSource(name, mi, mq, mu, mv, mr, md)); + } else { + MeqParmFunklet* mmin = new MeqParmFunklet("Minor:"+name, + group, &parmTable); + MeqParmFunklet* mmaj = new MeqParmFunklet("Major:"+name, + group, &parmTable); + MeqParmFunklet* mphi = new MeqParmFunklet("Phi:"+name, + group, &parmTable); + add (new MeqGaussSource(name, mi, mq, mu, mv, mr, md, mmin, mmaj, mphi)); + } // cout << "Found source " << name << " (srcnr=" << srcnr << ')' << endl; } } -void MeqSourceList::add (const MeqPointSource& source) +MeqSourceList::~MeqSourceList() { - itsSelected.push_back (itsSources.size()); - itsSources.push_back (source); + for (vector<MeqSource*>::iterator iter = itsSources.begin(); + iter != itsSources.end(); + iter++) { + delete *iter; + } } -void MeqSourceList::setSelected (const vector<int>& sel) +const vector<int>& MeqSourceList::getGroup (const string& groupName) const { - if (sel.size() == 0) { - itsSelected.resize (itsSources.size()); - for (unsigned int i=0; i<itsSources.size(); i++) { - itsSelected[i] = i; - } - } else { - for (unsigned int i=0; i<sel.size(); i++) { - ASSERT (sel[i] >= 0); - ASSERT (sel[i] < int(itsSources.size())); - } - itsSelected = sel; - } + map<string,vector<int> >::const_iterator idx = itsGroupMap.find (groupName); + ASSERTSTR (idx != itsGroupMap.end(), + "Source group " << groupName << " is unknown"); + return idx->second; +} + +void MeqSourceList::add (MeqSource* source) +{ + int idx = itsSources.size(); + itsSources.push_back (source); + itsNameMap[source->getName()] = idx; + vector<int>& group = itsGroupMap[source->getGroupName()]; + group.push_back (idx); } } + diff --git a/CEP/BB/BBSKernel/src/MNS/MeqSourceList.h b/CEP/BB/BBSKernel/src/MNS/MeqSourceList.h index 488fc6b9875444f1b86d098c03d0a8725683ce72..0d2f3478a2b328ac20cc2c6cedae5f6644ec27f9 100644 --- a/CEP/BB/BBSKernel/src/MNS/MeqSourceList.h +++ b/CEP/BB/BBSKernel/src/MNS/MeqSourceList.h @@ -30,6 +30,7 @@ #include <BBS/MNS/MeqPointSource.h> #include <ParmDB/ParmDB.h> #include <Common/lofar_vector.h> +#include <Common/lofar_map.h> namespace LOFAR { @@ -50,28 +51,32 @@ public: // Fill the source list from the sources in the parm table. MeqSourceList (ParmDB::ParmDB& parmTable, MeqParmGroup* group); - // Get the number of sources to be used. - int size() const - { return itsSelected.size(); } + ~MeqSourceList(); - // Get the actual source number in the source list. - int actualSourceNr (int sourceNr) const - { return itsSelected[sourceNr]; } + // Get the total number of sources. + uint size() const + { return itsSources.size(); } - // Get the i-th selected source. - MeqPointSource& operator[] (int i) - { return itsSources[itsSelected[i]]; } + // Get the i-th source. + MeqSource& operator[] (int i) + { return *itsSources[i]; } + + // Get the source indices in the given group. + const vector<int>& getGroup (const string& groupName) const; - // Set the sources to be actually used. - // An empty vector selects all sources. - void setSelected (const vector<int>&); - private: + // Forbid copies. + // <group> + MeqSourceList (const MeqSourceList&); + MeqSourceList& operator= (const MeqSourceList&); + // </group> + // Add a source. - void add (const MeqPointSource&); + void add (MeqSource*); - vector<MeqPointSource> itsSources; - vector<int> itsSelected; + vector<MeqSource*> itsSources; + map<string,int> itsNameMap; + map<string,vector<int> > itsGroupMap; }; // @} diff --git a/CEP/BB/BBSKernel/src/Makefile.am b/CEP/BB/BBSKernel/src/Makefile.am index f800eb5379ce7879691bca172a179e831d3822f9..629bea39f123af553f9cd5efd36299e92d874761 100644 --- a/CEP/BB/BBSKernel/src/Makefile.am +++ b/CEP/BB/BBSKernel/src/Makefile.am @@ -18,6 +18,7 @@ MNS/MeqDiag.h \ MNS/MeqDomain.h \ MNS/MeqExpr.h \ MNS/MeqFunklet.h \ +MNS/MeqGaussSource.h \ MNS/MeqJonesCMul2.h \ MNS/MeqJonesCMul3.h \ MNS/MeqJonesExpr.h \ @@ -37,6 +38,7 @@ MNS/MeqMatrixRealSca.h \ MNS/MeqMatrixRep.h \ MNS/MeqMatrixTmp.h \ MNS/MeqParm.h \ +MNS/MeqParmExpr.h \ MNS/MeqParmFunklet.h \ MNS/MeqParmSingle.h \ MNS/MeqPhaseRef.h \ @@ -46,6 +48,7 @@ MNS/MeqRequest.h \ MNS/MeqRequestId.h \ MNS/MeqResult.h \ MNS/MeqResultVec.h \ +MNS/MeqSource.h \ MNS/MeqSourceList.h \ MNS/MeqStatExpr.h \ MNS/MeqStation.h \ @@ -74,6 +77,7 @@ MNS/MeqDFTPS.cc \ MNS/MeqDomain.cc \ MNS/MeqExpr.cc \ MNS/MeqFunklet.cc \ +MNS/MeqGaussSource.cc \ MNS/MeqJonesCMul2.cc \ MNS/MeqJonesCMul3.cc \ MNS/MeqJonesExpr.cc \ @@ -92,6 +96,7 @@ MNS/MeqMatrixRealSca.cc \ MNS/MeqMatrixRep.cc \ MNS/MeqMatrixTmp.cc \ MNS/MeqParm.cc \ +MNS/MeqParmExpr.cc \ MNS/MeqParmFunklet.cc \ MNS/MeqParmSingle.cc \ MNS/MeqPhaseRef.cc \ @@ -100,6 +105,7 @@ MNS/MeqPolc.cc \ MNS/MeqRequest.cc \ MNS/MeqResult.cc \ MNS/MeqResultVec.cc \ +MNS/MeqSource.cc \ MNS/MeqSourceList.cc \ MNS/MeqStatExpr.cc \ MNS/MeqStation.cc \ diff --git a/CEP/BB/BBSKernel/src/Prediffer.cc b/CEP/BB/BBSKernel/src/Prediffer.cc index ccc0a16b40cf22fdb8f205b14333d12d2975651f..5812e8738555fc76e3b84a10b875a9dca2018994 100644 --- a/CEP/BB/BBSKernel/src/Prediffer.cc +++ b/CEP/BB/BBSKernel/src/Prediffer.cc @@ -143,6 +143,7 @@ Prediffer::Prediffer(const string& msName, itsGSMMEPName (skyPdm.getTableName()), itsGSMMEP (skyPdm), itsCalcUVW (calcUVW), + itsSources (0), itsSrcGrp (sourceGroups), itsNrPert (0), itsNCorr (0), @@ -242,6 +243,7 @@ Prediffer::~Prediffer() { LOG_TRACE_FLOW( "Prediffer destructor" ); + delete itsSources; for (vector<MeqStatUVW*>::iterator iter = itsStatUVW.begin(); iter != itsStatUVW.end(); iter++) { @@ -423,16 +425,16 @@ void Prediffer::countBaseCorr() // // ~getSources // -// Get all sources from the GSM table. +// Get all sources from the parmtable. // //---------------------------------------------------------------------- void Prediffer::getSources() { // Get the sources from the ParmTable - itsSources = MeqSourceList(itsGSMMEP, &itsParmGroup); - int nrsrc = itsSources.size(); + itsSources = new MeqSourceList(itsGSMMEP, &itsParmGroup); + int nrsrc = itsSources->size(); for (int i=0; i<nrsrc; ++i) { - itsSources[i].setSourceNr (i); + (*itsSources)[i].setSourceNr (i); } // Make a map for the sources actually used. itsSrcNrMap.reserve (nrsrc); @@ -444,7 +446,6 @@ void Prediffer::getSources() vec[0] = i+1; // source nrs are 1-relative itsSrcGrp[i] = vec; itsSrcNrMap.push_back (i); - itsSources[i].setGroupNr (i); // group nrs are 0-relative } } else { for (uint j=0; j<itsSrcGrp.size(); ++j) { @@ -454,10 +455,7 @@ void Prediffer::getSources() ASSERTSTR (srcs[i] > 0 && srcs[i] <= nrsrc, "Sourcenr " << srcs[i] << " must be > 0 and <= #sources (=" << nrsrc << ')'); - ASSERTSTR (itsSources[srcs[i]-1].getGroupNr() < 0, - "Sourcenr " << srcs[i] << " multiply used in groups"); - itsSources[srcs[i]-1].setGroupNr (j); - itsSources[srcs[i]-1].setSourceNr (itsSrcNrMap.size()); + (*itsSources)[srcs[i]-1].setSourceNr (itsSrcNrMap.size()); itsSrcNrMap.push_back (srcs[i]-1); } } @@ -467,7 +465,7 @@ void Prediffer::getSources() itsLMN.reserve (nrused); for (int i=0; i<nrused; ++i) { int src = itsSrcNrMap[i]; - MeqLMN* lmn = new MeqLMN(&(itsSources[src])); + MeqLMN* lmn = new MeqLMN(&((*itsSources)[src])); lmn->setPhaseRef (&itsPhaseRef); itsLMN.push_back (lmn); } @@ -498,11 +496,11 @@ void Prediffer::makeLOFARExpr (bool useTEJ, bool usePEJ, bool asAP, int nrgrp = itsSrcGrp.size(); itsStatUVW.reserve (nrstat); // EJ is real/imag or ampl/phase - string ejname1 = "real."; - string ejname2 = "imag."; + string ejname1 = "real:"; + string ejname2 = "imag:"; if (asAP) { - ejname1 = "ampl."; - ejname2 = "phase."; + ejname1 = "ampl:"; + ejname2 = "phase:"; } // Vector containing StatExpr-s. vector<MeqJonesExpr> statExpr(nrstat); @@ -523,21 +521,21 @@ void Prediffer::makeLOFARExpr (bool useTEJ, bool usePEJ, bool asAP, uvw = new MeqStatUVW (itsStations[i], &itsPhaseRef); // Do pure station parameters only if told so. if (useStatParm) { - MeqExpr frot (new MeqParmFunklet ("frot." + - itsStations[i]->getName(), - &itsParmGroup, &itsMEP)); - MeqExpr drot (new MeqParmFunklet ("drot." + - itsStations[i]->getName(), - &itsParmGroup, &itsMEP)); - MeqExpr dell (new MeqParmFunklet ("dell." + - itsStations[i]->getName(), - &itsParmGroup, &itsMEP)); - MeqExpr gain11 (new MeqParmFunklet ("gain.11." + - itsStations[i]->getName(), - &itsParmGroup, &itsMEP)); - MeqExpr gain22 (new MeqParmFunklet ("gain.22." + - itsStations[i]->getName(), - &itsParmGroup, &itsMEP)); + MeqExpr frot (MeqParmFunklet::create ("frot:" + + itsStations[i]->getName(), + &itsParmGroup, &itsMEP)); + MeqExpr drot (MeqParmFunklet::create ("drot:" + + itsStations[i]->getName(), + &itsParmGroup, &itsMEP)); + MeqExpr dell (MeqParmFunklet::create ("dell:" + + itsStations[i]->getName(), + &itsParmGroup, &itsMEP)); + MeqExpr gain11 (MeqParmFunklet::create ("gain:11:" + + itsStations[i]->getName(), + &itsParmGroup, &itsMEP)); + MeqExpr gain22 (MeqParmFunklet::create ("gain:22:" + + itsStations[i]->getName(), + &itsParmGroup, &itsMEP)); statExpr[i] = MeqJonesExpr(new MeqStatExpr (frot, drot, dell, gain11, gain22)); } @@ -553,22 +551,22 @@ void Prediffer::makeLOFARExpr (bool useTEJ, bool usePEJ, bool asAP, if (useTEJ) { // Make a gain/phase expression per station. string nm = itsStations[i]->getName(); - MeqExpr ej11r (new MeqParmFunklet ("EJ11." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej11i (new MeqParmFunklet ("EJ11." + ejname2 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej12r (new MeqParmFunklet ("EJ12." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej12i (new MeqParmFunklet ("EJ12." + ejname2 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej21r (new MeqParmFunklet ("EJ21." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej21i (new MeqParmFunklet ("EJ21." + ejname2 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej22r (new MeqParmFunklet ("EJ22." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej22i (new MeqParmFunklet ("EJ22." + ejname2 + nm, - &itsParmGroup, &itsMEP)); + MeqExpr ej11r (MeqParmFunklet::create ("EJ11:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej11i (MeqParmFunklet::create ("EJ11:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej12r (MeqParmFunklet::create ("EJ12:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej12i (MeqParmFunklet::create ("EJ12:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej21r (MeqParmFunklet::create ("EJ21:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej21i (MeqParmFunklet::create ("EJ21:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej22r (MeqParmFunklet::create ("EJ22:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej22i (MeqParmFunklet::create ("EJ22:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); if (asAP) { ej11 = new MeqExprAPToComplex (ej11r, ej11i); ej12 = new MeqExprAPToComplex (ej12r, ej12i); @@ -589,23 +587,23 @@ void Prediffer::makeLOFARExpr (bool useTEJ, bool usePEJ, bool asAP, for (int j=0; j<nrgrp; j++) { ostringstream ostr; ostr << j+1; - string nm = itsStations[i]->getName() + ".SG" + ostr.str(); - MeqExpr ej11r (new MeqParmFunklet ("EJ11." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej11i (new MeqParmFunklet ("EJ11." + ejname2 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej12r (new MeqParmFunklet ("EJ12." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej12i (new MeqParmFunklet ("EJ12." + ejname2 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej21r (new MeqParmFunklet ("EJ21." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej21i (new MeqParmFunklet ("EJ21." + ejname2 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej22r (new MeqParmFunklet ("EJ22." + ejname1 + nm, - &itsParmGroup, &itsMEP)); - MeqExpr ej22i (new MeqParmFunklet ("EJ22." + ejname2 + nm, - &itsParmGroup, &itsMEP)); + string nm = itsStations[i]->getName() + ":SG" + ostr.str(); + MeqExpr ej11r (MeqParmFunklet::create ("EJ11:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej11i (MeqParmFunklet::create ("EJ11:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej12r (MeqParmFunklet::create ("EJ12:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej12i (MeqParmFunklet::create ("EJ12:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej21r (MeqParmFunklet::create ("EJ21:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej21i (MeqParmFunklet::create ("EJ21:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej22r (MeqParmFunklet::create ("EJ22:" + ejname1 + nm, + &itsParmGroup, &itsMEP)); + MeqExpr ej22i (MeqParmFunklet::create ("EJ22:" + ejname2 + nm, + &itsParmGroup, &itsMEP)); if (asAP) { ej11 = new MeqExprAPToComplex (ej11r, ej11i); ej12 = new MeqExprAPToComplex (ej12r, ej12i); @@ -661,9 +659,10 @@ void Prediffer::makeLOFARExpr (bool useTEJ, bool usePEJ, bool asAP, MeqExpr expr1 (new MeqBaseDFTPS (pdfts[ant1*nrsrc + src], pdfts[ant2*nrsrc + src], itsLMN[src])); - vecSrc.push_back (MeqJonesExpr - (new MeqBaseLinPS(expr1, - &(itsSources[itsSrcNrMap[src]])))); + // For the time being only point sources are supported. + MeqPointSource& mps = dynamic_cast<MeqPointSource&> + ((*itsSources)[itsSrcNrMap[src]]); + vecSrc.push_back (MeqJonesExpr (new MeqBaseLinPS(expr1, &mps))); } MeqJonesExpr sum; // Sum all sources in the group. @@ -1970,28 +1969,28 @@ void Prediffer::fillUVW() bool Prediffer::setPeelGroups (const vector<int>& peelGroups, const vector<int>& extraGroups) { - vector<int> allNrs; - for (uint i=0; i<extraGroups.size(); ++i) { - ASSERT (extraGroups[i] >= 0 && extraGroups[i] < int(itsSrcGrp.size())); - const vector<int>& grp = itsSrcGrp[i]; - for (uint j=0; j<grp.size(); ++j) { - allNrs.push_back (grp[j] - 1); - } - } - vector<int> peelNrs; - for (uint i=0; i<peelGroups.size(); ++i) { - ASSERT (peelGroups[i] >= 0 && peelGroups[i] < int(itsSrcGrp.size())); - const vector<int>& grp = itsSrcGrp[peelGroups[i]]; - for (uint j=0; j<grp.size(); ++j) { - peelNrs.push_back (grp[j] - 1); - allNrs.push_back (grp[j] - 1); - } - } - LOG_TRACE_OBJ_STR( "peel sources " << peelNrs << "; predict sources " - << allNrs ); - ASSERT (peelNrs.size() > 0); - itsSources.setSelected (allNrs); - itsPeelSourceNrs = peelNrs; +// vector<int> allNrs; +// for (uint i=0; i<extraGroups.size(); ++i) { +// ASSERT (extraGroups[i] >= 0 && extraGroups[i] < int(itsSrcGrp.size())); +// const vector<int>& grp = itsSrcGrp[i]; +// for (uint j=0; j<grp.size(); ++j) { +// allNrs.push_back (grp[j] - 1); +// } +// } +// vector<int> peelNrs; +// for (uint i=0; i<peelGroups.size(); ++i) { +// ASSERT (peelGroups[i] >= 0 && peelGroups[i] < int(itsSrcGrp.size())); +// const vector<int>& grp = itsSrcGrp[peelGroups[i]]; +// for (uint j=0; j<grp.size(); ++j) { +// peelNrs.push_back (grp[j] - 1); +// allNrs.push_back (grp[j] - 1); +// } +// } +// LOG_TRACE_OBJ_STR( "peel sources " << peelNrs << "; predict sources " +// << allNrs ); +// ASSERT (peelNrs.size() > 0); +// itsSources.setSelected (allNrs); +// itsPeelSourceNrs = peelNrs; return true; } diff --git a/CEP/BB/BBSKernel/src/Prediffer.h b/CEP/BB/BBSKernel/src/Prediffer.h index 63077c47e98e5dff989428d727f9b9a846017827..8a72f2a54defe0b7658573f5296f2d2aec2de10e 100644 --- a/CEP/BB/BBSKernel/src/Prediffer.h +++ b/CEP/BB/BBSKernel/src/Prediffer.h @@ -327,7 +327,7 @@ private: MeqPhaseRef itsPhaseRef; //# Phase reference position in J2000 - MeqSourceList itsSources; + MeqSourceList* itsSources; vector<vector<int> > itsSrcGrp; //# sources in each group vector<int> itsSrcNrMap; //# map of all srcnr to used srcnr vector<int> itsPeelSourceNrs; diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.dat b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.dat new file mode 100644 index 0000000000000000000000000000000000000000..92402a83c552826f665500bf9c72bb5f7a2f3e6f Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.dat differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0 b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0 new file mode 100644 index 0000000000000000000000000000000000000000..b57f473278b80ae392b2c1b3bc67402cbae601e4 Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0 differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0i b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0i new file mode 100644 index 0000000000000000000000000000000000000000..33964e5347f22d5a9eaa6ae1342396eeccdbe615 Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.f0i differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.info b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.info new file mode 100644 index 0000000000000000000000000000000000000000..1e2a62505a013c60eb702ea2a58dacdd7f820b62 --- /dev/null +++ b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.info @@ -0,0 +1,5 @@ +Type = MEPold +SubType = + +Initial ME Parameter values +Old ME Parameter values diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.lock b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.lock new file mode 100644 index 0000000000000000000000000000000000000000..36c25acc40a05c4842e28d04895408068789d419 Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/DEFAULTVALUES/table.lock differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.dat b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.dat new file mode 100644 index 0000000000000000000000000000000000000000..376d73371132c857d6ea34689eb29aae972076cd Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.dat differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.f0 b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.f0 new file mode 100644 index 0000000000000000000000000000000000000000..b4837eddcf727ef2745f1c5f0fd58a644041c6a8 Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.f0 differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.f0i b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.f0i new file mode 100644 index 0000000000000000000000000000000000000000..c09f05b309fbcc6ff12c9eb91aff39455347c41e Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.f0i differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.info b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.info new file mode 100644 index 0000000000000000000000000000000000000000..a1a976ed49439abda34d2c64cfd0360cfcdef651 --- /dev/null +++ b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.info @@ -0,0 +1,3 @@ +Type = +SubType = + diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.lock b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.lock new file mode 100644 index 0000000000000000000000000000000000000000..bda58097b47771545f500a22ba10e538987277a8 Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/OLDVALUES/table.lock differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.dat b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.dat new file mode 100644 index 0000000000000000000000000000000000000000..1febb8e5ea7b978633f4a5f540b4967cf5ba8148 Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.dat differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.f0 b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.f0 new file mode 100644 index 0000000000000000000000000000000000000000..f83deca64494f24bbe78f5fe426a0895bb722519 Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.f0 differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.f0i b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.f0i new file mode 100644 index 0000000000000000000000000000000000000000..5a497c3e4359126508ed7aae16bcc14821094dab Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.f0i differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.info b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.info new file mode 100644 index 0000000000000000000000000000000000000000..f785028b10dfc87c48b9eb2c38d540706d1cfd2c --- /dev/null +++ b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.info @@ -0,0 +1,4 @@ +Type = MEP +SubType = + +ME Parameter values diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.lock b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.lock new file mode 100644 index 0000000000000000000000000000000000000000..18ff0cf15fe51e32036517fc984c70cd6a22f23f Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep1/table.lock differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.dat b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.dat new file mode 100644 index 0000000000000000000000000000000000000000..92402a83c552826f665500bf9c72bb5f7a2f3e6f Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.dat differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0 b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0 new file mode 100644 index 0000000000000000000000000000000000000000..b57f473278b80ae392b2c1b3bc67402cbae601e4 Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0 differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0i b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0i new file mode 100644 index 0000000000000000000000000000000000000000..33964e5347f22d5a9eaa6ae1342396eeccdbe615 Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.f0i differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.info b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.info new file mode 100644 index 0000000000000000000000000000000000000000..1e2a62505a013c60eb702ea2a58dacdd7f820b62 --- /dev/null +++ b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.info @@ -0,0 +1,5 @@ +Type = MEPold +SubType = + +Initial ME Parameter values +Old ME Parameter values diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.lock b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.lock new file mode 100644 index 0000000000000000000000000000000000000000..36c25acc40a05c4842e28d04895408068789d419 Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/DEFAULTVALUES/table.lock differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.dat b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.dat new file mode 100644 index 0000000000000000000000000000000000000000..376d73371132c857d6ea34689eb29aae972076cd Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.dat differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.f0 b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.f0 new file mode 100644 index 0000000000000000000000000000000000000000..b4837eddcf727ef2745f1c5f0fd58a644041c6a8 Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.f0 differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.f0i b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.f0i new file mode 100644 index 0000000000000000000000000000000000000000..c09f05b309fbcc6ff12c9eb91aff39455347c41e Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.f0i differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.info b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.info new file mode 100644 index 0000000000000000000000000000000000000000..a1a976ed49439abda34d2c64cfd0360cfcdef651 --- /dev/null +++ b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.info @@ -0,0 +1,3 @@ +Type = +SubType = + diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.lock b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.lock new file mode 100644 index 0000000000000000000000000000000000000000..bda58097b47771545f500a22ba10e538987277a8 Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/OLDVALUES/table.lock differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.dat b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.dat new file mode 100644 index 0000000000000000000000000000000000000000..838639a5f0db6a34dbe950b6930a7c29b6c1fb83 Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.dat differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.f0 b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.f0 new file mode 100644 index 0000000000000000000000000000000000000000..e05e8439f942720587eb4ee06e42831f28b3e0cd Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.f0 differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.f0i b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.f0i new file mode 100644 index 0000000000000000000000000000000000000000..dc8bb6443a3481bb1c31d7cb0173140e8275c5d9 Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.f0i differ diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.info b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.info new file mode 100644 index 0000000000000000000000000000000000000000..f785028b10dfc87c48b9eb2c38d540706d1cfd2c --- /dev/null +++ b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.info @@ -0,0 +1,4 @@ +Type = MEP +SubType = + +ME Parameter values diff --git a/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.lock b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.lock new file mode 100644 index 0000000000000000000000000000000000000000..bdf9db95453ccd639ff18180bd352650711e4f50 Binary files /dev/null and b/CEP/BB/BBSKernel/test/tParmMerge.in_mep2/table.lock differ diff --git a/CEP/BB/BBSKernel/test/tPredSolv.cc b/CEP/BB/BBSKernel/test/tPredSolv.cc index a6080a930f0b03394a13a913c986fd98cedc5d1a..ceeb728d8758aea0042fff3854313668f4429d08 100644 --- a/CEP/BB/BBSKernel/test/tPredSolv.cc +++ b/CEP/BB/BBSKernel/test/tPredSolv.cc @@ -209,9 +209,9 @@ int main (int argc, const char* argv[]) vector<int> corr; pre1.select (antVec2, antVec2, false, corr); // no autocorrelations vector<string> solv(3); - solv[0] = "RA.*"; - solv[1] = "DEC.*"; - solv[2] = "StokesI.*"; + solv[0] = "RA:*"; + solv[1] = "DEC:*"; + solv[2] = "StokesI:*"; doSolve (pre1, solv, 9); cout << "End of first test" << endl; } @@ -236,9 +236,9 @@ int main (int argc, const char* argv[]) pre1.select (antVec2, antVec2, false, corr); // no autocorrelations pre2.select (antVec2, antVec2, false, corr); // no autocorrelations vector<string> solv(3); - solv[0] = "RA.*"; - solv[1] = "DEC.*"; - solv[2] = "StokesI.*"; + solv[0] = "RA:*"; + solv[1] = "DEC:*"; + solv[2] = "StokesI:*"; doSolve2 (pre1, pre2, solv, 1); cout << "End of test with two prediffers" << endl; } @@ -257,9 +257,9 @@ int main (int argc, const char* argv[]) vector<int> antVec2; pre1.select (antVec2, antVec2, false, corrVec); // no autocorrelations vector<string> solv(3); - solv[0] = "RA.*"; - solv[1] = "DEC.*"; - solv[2] = "StokesI.*"; + solv[0] = "RA:*"; + solv[1] = "DEC:*"; + solv[2] = "StokesI:*"; doSolve (pre1, solv, 5); cout << "End of test with 21 antennas" << endl; } @@ -282,9 +282,9 @@ int main (int argc, const char* argv[]) vector<int> corr; pre1.select (antVec2, antVec2, false, corr); // no autocorrelations vector<string> solv(3); - solv[0] = "RA.*"; - solv[1] = "DEC.*"; - solv[2] = "StokesI.*"; + solv[0] = "RA:*"; + solv[1] = "DEC:*"; + solv[2] = "StokesI:*"; doSolve1 (pre1, solv, 5); cout << "End of test with updating parmtable" << endl; }