Skip to content
Snippets Groups Projects
Commit f273443c authored by Sven Duscha's avatar Sven Duscha
Browse files

task #2850 moved patch No. of sources check to PatchExpr::initSourcesList()

parent 337c0abf
No related branches found
No related tags found
No related merge requests found
......@@ -79,7 +79,6 @@ public:
//
// @{
virtual const string &name() const;
size_t nSources() const;
virtual Expr<Vector<2> >::Ptr position() const;
virtual Expr<JonesMatrix>::Ptr coherence(const baseline_t &baseline,
const Expr<Vector<3> >::Ptr &uvwLHS,
......@@ -87,6 +86,7 @@ public:
// @}
private:
size_t nSources() const;
void initSourceList(Scope &scope, SourceDB &sourceDB, const string &name);
void initPositionExpr(const vector<Source::Ptr> &sources);
void initLMNExpr(const vector<Source::Ptr> &sources,
......
......@@ -24,6 +24,7 @@
#include <lofar_config.h>
#include <BBSKernel/MeasurementExprLOFARUtil.h>
#include <BBSKernel/Exceptions.h>
#include <BBSKernel/PatchExpr.h>
#include <BBSKernel/Expr/ExprVisData.h>
#include <BBSKernel/Expr/EquatorialCentroid.h>
......@@ -117,6 +118,12 @@ void PatchExpr::initSourceList(Scope &scope, SourceDB &sourceDB,
{
vector<SourceInfo> sources(sourceDB.getPatchSources(name));
if(sources.size() == 0)
{
THROW(BBSKernelException, "Patch " << name << " does not contain "
<< "any sources");
}
itsSourceList.reserve(sources.size());
for(vector<SourceInfo>::const_iterator it = sources.begin(),
end = sources.end(); it != end; ++it)
......
......@@ -449,16 +449,8 @@ PatchExprBase::Ptr StationExprLOFAR::makePatchExpr(const string &name,
it->second));
}
PatchExpr::Ptr exprPatch(new PatchExpr(itsScope, sourceDB, name, refPhase));
// Check if the exprPatch created from patch name does contain any sources
if(exprPatch->nSources() == 0)
{
THROW(BBSKernelException, "Patch " << name << " does not contain "
<< "any sources");
}
return exprPatch;
return PatchExprBase::Ptr(new PatchExpr(itsScope, sourceDB, name,
refPhase));
}
} //# namespace BBS
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment