diff --git a/CEP/BB/BBS/src/MNS/MeqGaussSource.cc b/CEP/BB/BBS/src/MNS/MeqGaussSource.cc new file mode 100644 index 0000000000000000000000000000000000000000..4addf29c716f9f655793689089f042ebbd17b591 --- /dev/null +++ b/CEP/BB/BBS/src/MNS/MeqGaussSource.cc @@ -0,0 +1,48 @@ +//# MeqGaussSource.cc: Class holding the expressions defining a gauss source +//# +//# Copyright (C) 2002 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +#include <lofar_config.h> +#include <BBS/MNS/MeqGaussSource.h> + + +namespace LOFAR { + +MeqGaussSource::MeqGaussSource (const string& name, + const MeqExpr& fluxI, const MeqExpr& fluxQ, + const MeqExpr& fluxU, const MeqExpr& fluxV, + const MeqExpr& ra, const MeqExpr& dec, + const MeqExpr& minor, const MeqExpr& major, + const MeqExpr& phi) +: MeqSource (name, "", ra, dec), + itsI (fluxI), + itsQ (fluxQ), + itsU (fluxU), + itsV (fluxV), + itsMinor (minor), + itsMajor (major), + itsPhi (phi) +{} + +MeqGaussSource::~MeqGaussSource() +{} + +} diff --git a/CEP/BB/BBS/src/MNS/MeqGaussSource.h b/CEP/BB/BBS/src/MNS/MeqGaussSource.h new file mode 100644 index 0000000000000000000000000000000000000000..4760348d99f13a4a68639436d15975aa9ead1c72 --- /dev/null +++ b/CEP/BB/BBS/src/MNS/MeqGaussSource.h @@ -0,0 +1,82 @@ +//# MeqGaussSource.h: Class holding a gaussian source +//# +//# Copyright (C) 2002 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +#ifndef MNS_MEQGAUSSSOURCE_H +#define MNS_MEQGAUSSSOURCE_H + +// \file +// Class holding a gaussian source + +//# Includes +#include <BBS/MNS/MeqSource.h> +#include <Common/lofar_string.h> + +namespace LOFAR { + +// \ingroup BBS +// \addtogroup MNS +// @{ + + +class MeqGaussSource: public MeqSource +{ +public: + MeqGaussSource (const string& name, + const MeqExpr& fluxI, const MeqExpr& fluxQ, + const MeqExpr& fluxU, const MeqExpr& fluxV, + const MeqExpr& ra, const MeqExpr& dec, + const MeqExpr& minor, const MeqExpr& major, + const MeqExpr& phi); + + + virtual ~MeqGaussSource(); + + MeqExpr& getI() + { return itsI; } + MeqExpr& getQ() + { return itsQ; } + MeqExpr& getU() + { return itsU; } + MeqExpr& getV() + { return itsV; } + MeqExpr& getMinor() + { return itsMinor; } + MeqExpr& getMajor() + { return itsMajor; } + MeqExpr& getPhi() + { return itsPhi; } + +private: + MeqExpr itsI; + MeqExpr itsQ; + MeqExpr itsU; + MeqExpr itsV; + MeqExpr itsMinor; + MeqExpr itsMajor; + MeqExpr itsPhi; +}; + +// @} + +} + +#endif diff --git a/CEP/BB/BBS/src/MNS/MeqParmExpr.cc b/CEP/BB/BBS/src/MNS/MeqParmExpr.cc new file mode 100644 index 0000000000000000000000000000000000000000..dcc98d239f172b427ce3ba5daa9f8cc45af7a139 --- /dev/null +++ b/CEP/BB/BBS/src/MNS/MeqParmExpr.cc @@ -0,0 +1,63 @@ +//# MeqParmExpr.h: A parm expression +//# +//# Copyright (C) 2006 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +#include <BBS/MNS/MeqParmExpr.h> +#include <BBS/MNS/MeqParmFunklet.h> +#include <BBS/MNS/MeqMatrixTmp.h> + +namespace LOFAR { + + MeqParmExpr::MeqParmExpr (const string& expr, MeqParmGroup* group, + ParmDB::ParmDB* table) + { + // Only the multiplication of 2 parms is currently supported. + string::size_type idx = expr.find('*'); + ASSERTSTR (idx != string::npos, + "Currently parmexpr only supports multiplication of two parms"); + string p1, p2; + for (string::size_type i=0; i<idx; ++i) { + if (expr[i] != ' ') { + p1.push_back (expr[i]); + } + } + for (string::size_type i=idx+1; i<expr.size(); ++i) { + if (expr[i] != ' ') { + p2.push_back (expr[i]); + } + } + ASSERTSTR (!p1.empty() && !p2.empty(), + "Currently parmexpr only supports multiplication of two parms"); + itsExpr1 = MeqExpr (MeqParmFunklet::create (p1, group, table)); + itsExpr2 = MeqExpr (MeqParmFunklet::create (p2, group, table)); + addChild (itsExpr1); + addChild (itsExpr2); + } + + MeqParmExpr::~MeqParmExpr() + {} + + MeqMatrix MeqParmExpr::getResultValue (const vector<const MeqMatrix*>& v) + { + return *v[0] * *v[1]; + } + +} diff --git a/CEP/BB/BBS/src/MNS/MeqParmExpr.h b/CEP/BB/BBS/src/MNS/MeqParmExpr.h new file mode 100644 index 0000000000000000000000000000000000000000..84496d99c6c93f9ddb42dbbb618f1d16f49c3371 --- /dev/null +++ b/CEP/BB/BBS/src/MNS/MeqParmExpr.h @@ -0,0 +1,67 @@ +//# MeqParmExpr.h: A parm expression +//# +//# Copyright (C) 2006 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +#ifndef MNS_MEQPARMEXPR_H +#define MNS_MEQPARMEXPR_H + +// \file +// A parm which is an expression of other parms. + +//# Includes +#include <BBS/MNS/MeqExpr.h> +#include <ParmDB/ParmDB.h> + +namespace LOFAR { + +// \ingroup BBS +// \addtogroup MNS +// @{ + +//# Forward declarations +class MeqParmGroup; + +// MeqParmExpr represents a parm which is an expression of other parms. +// The current implementation is very limited, as it can only handle +// the multiplication of two parms. This is sufficient for the first needs. +// It should be rather simple to make more compilcated expression possible. + +class MeqParmExpr: public MeqExprRep +{ +public: + // Create from an expression. + MeqParmExpr (const string& expr, MeqParmGroup*, ParmDB::ParmDB* table); + + virtual ~MeqParmExpr(); + + // Calculate the value. + MeqMatrix getResultValue (const std::vector<const MeqMatrix*>&); + +private: + MeqExpr itsExpr1; + MeqExpr itsExpr2; +}; + +// @} + +} + +#endif diff --git a/CEP/BB/BBS/src/MNS/MeqSource.cc b/CEP/BB/BBS/src/MNS/MeqSource.cc new file mode 100644 index 0000000000000000000000000000000000000000..03cd94c9cf1b4c2681a95405969e0813ee66fa84 --- /dev/null +++ b/CEP/BB/BBS/src/MNS/MeqSource.cc @@ -0,0 +1,42 @@ +//# MeqSource.cc: Class holding the expressions defining a source +//# +//# Copyright (C) 2006 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +#include <lofar_config.h> +#include <BBS/MNS/MeqSource.h> + + +namespace LOFAR { + + + MeqSource::MeqSource (const string& name, const string& groupName, + const MeqExpr& ra, const MeqExpr& dec) +: itsSourceNr (-1), + itsName (name), + itsGroupName (groupName), + itsRa (ra), + itsDec (dec) +{} + +MeqSource::~MeqSource() +{} + +} diff --git a/CEP/BB/BBS/src/MNS/MeqSource.h b/CEP/BB/BBS/src/MNS/MeqSource.h new file mode 100644 index 0000000000000000000000000000000000000000..e14bf86f72374b34a1bbb363c1037b697c955993 --- /dev/null +++ b/CEP/BB/BBS/src/MNS/MeqSource.h @@ -0,0 +1,81 @@ +//# MeqPointSource.h: Abstract base class for holding a source +//# +//# Copyright (C) 2006 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +#ifndef MNS_MEQSOURCE_H +#define MNS_MEQSOURCE_H + +// \file +// Abstract base class for holding a source + +//# Includes +#include <BBS/MNS/MeqExpr.h> +#include <Common/lofar_string.h> + +namespace LOFAR { + +// \ingroup BBS +// \addtogroup MNS +// @{ + +class MeqSource +{ +public: + // The default constructor. + MeqSource(); + + MeqSource (const string& name, const string& groupName, + const MeqExpr& ra, const MeqExpr& dec); + + virtual ~MeqSource(); + + const string& getName() const + { return itsName; } + + const string& getGroupName() const + { return itsGroupName; } + + // Get the source nr. + int getSourceNr() const + { return itsSourceNr; } + + // Set the source nr. + void setSourceNr (int sourceNr) + { itsSourceNr = sourceNr; } + + MeqExpr& getRa() + { return itsRa; } + MeqExpr& getDec() + { return itsDec; } + +private: + int itsSourceNr; + string itsName; + string itsGroupName; + MeqExpr itsRa; + MeqExpr itsDec; +}; + +// @} + +} + +#endif diff --git a/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqGaussSource.h b/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqGaussSource.h new file mode 100644 index 0000000000000000000000000000000000000000..4760348d99f13a4a68639436d15975aa9ead1c72 --- /dev/null +++ b/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqGaussSource.h @@ -0,0 +1,82 @@ +//# MeqGaussSource.h: Class holding a gaussian source +//# +//# Copyright (C) 2002 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +#ifndef MNS_MEQGAUSSSOURCE_H +#define MNS_MEQGAUSSSOURCE_H + +// \file +// Class holding a gaussian source + +//# Includes +#include <BBS/MNS/MeqSource.h> +#include <Common/lofar_string.h> + +namespace LOFAR { + +// \ingroup BBS +// \addtogroup MNS +// @{ + + +class MeqGaussSource: public MeqSource +{ +public: + MeqGaussSource (const string& name, + const MeqExpr& fluxI, const MeqExpr& fluxQ, + const MeqExpr& fluxU, const MeqExpr& fluxV, + const MeqExpr& ra, const MeqExpr& dec, + const MeqExpr& minor, const MeqExpr& major, + const MeqExpr& phi); + + + virtual ~MeqGaussSource(); + + MeqExpr& getI() + { return itsI; } + MeqExpr& getQ() + { return itsQ; } + MeqExpr& getU() + { return itsU; } + MeqExpr& getV() + { return itsV; } + MeqExpr& getMinor() + { return itsMinor; } + MeqExpr& getMajor() + { return itsMajor; } + MeqExpr& getPhi() + { return itsPhi; } + +private: + MeqExpr itsI; + MeqExpr itsQ; + MeqExpr itsU; + MeqExpr itsV; + MeqExpr itsMinor; + MeqExpr itsMajor; + MeqExpr itsPhi; +}; + +// @} + +} + +#endif diff --git a/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqParmExpr.h b/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqParmExpr.h new file mode 100644 index 0000000000000000000000000000000000000000..84496d99c6c93f9ddb42dbbb618f1d16f49c3371 --- /dev/null +++ b/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqParmExpr.h @@ -0,0 +1,67 @@ +//# MeqParmExpr.h: A parm expression +//# +//# Copyright (C) 2006 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +#ifndef MNS_MEQPARMEXPR_H +#define MNS_MEQPARMEXPR_H + +// \file +// A parm which is an expression of other parms. + +//# Includes +#include <BBS/MNS/MeqExpr.h> +#include <ParmDB/ParmDB.h> + +namespace LOFAR { + +// \ingroup BBS +// \addtogroup MNS +// @{ + +//# Forward declarations +class MeqParmGroup; + +// MeqParmExpr represents a parm which is an expression of other parms. +// The current implementation is very limited, as it can only handle +// the multiplication of two parms. This is sufficient for the first needs. +// It should be rather simple to make more compilcated expression possible. + +class MeqParmExpr: public MeqExprRep +{ +public: + // Create from an expression. + MeqParmExpr (const string& expr, MeqParmGroup*, ParmDB::ParmDB* table); + + virtual ~MeqParmExpr(); + + // Calculate the value. + MeqMatrix getResultValue (const std::vector<const MeqMatrix*>&); + +private: + MeqExpr itsExpr1; + MeqExpr itsExpr2; +}; + +// @} + +} + +#endif diff --git a/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqSource.h b/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqSource.h new file mode 100644 index 0000000000000000000000000000000000000000..e14bf86f72374b34a1bbb363c1037b697c955993 --- /dev/null +++ b/CEP/BB/BBSKernel/include/BBSKernel/MNS/MeqSource.h @@ -0,0 +1,81 @@ +//# MeqPointSource.h: Abstract base class for holding a source +//# +//# Copyright (C) 2006 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +#ifndef MNS_MEQSOURCE_H +#define MNS_MEQSOURCE_H + +// \file +// Abstract base class for holding a source + +//# Includes +#include <BBS/MNS/MeqExpr.h> +#include <Common/lofar_string.h> + +namespace LOFAR { + +// \ingroup BBS +// \addtogroup MNS +// @{ + +class MeqSource +{ +public: + // The default constructor. + MeqSource(); + + MeqSource (const string& name, const string& groupName, + const MeqExpr& ra, const MeqExpr& dec); + + virtual ~MeqSource(); + + const string& getName() const + { return itsName; } + + const string& getGroupName() const + { return itsGroupName; } + + // Get the source nr. + int getSourceNr() const + { return itsSourceNr; } + + // Set the source nr. + void setSourceNr (int sourceNr) + { itsSourceNr = sourceNr; } + + MeqExpr& getRa() + { return itsRa; } + MeqExpr& getDec() + { return itsDec; } + +private: + int itsSourceNr; + string itsName; + string itsGroupName; + MeqExpr itsRa; + MeqExpr itsDec; +}; + +// @} + +} + +#endif diff --git a/CEP/BB/BBSKernel/src/MNS/MeqGaussSource.cc b/CEP/BB/BBSKernel/src/MNS/MeqGaussSource.cc new file mode 100644 index 0000000000000000000000000000000000000000..4addf29c716f9f655793689089f042ebbd17b591 --- /dev/null +++ b/CEP/BB/BBSKernel/src/MNS/MeqGaussSource.cc @@ -0,0 +1,48 @@ +//# MeqGaussSource.cc: Class holding the expressions defining a gauss source +//# +//# Copyright (C) 2002 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +#include <lofar_config.h> +#include <BBS/MNS/MeqGaussSource.h> + + +namespace LOFAR { + +MeqGaussSource::MeqGaussSource (const string& name, + const MeqExpr& fluxI, const MeqExpr& fluxQ, + const MeqExpr& fluxU, const MeqExpr& fluxV, + const MeqExpr& ra, const MeqExpr& dec, + const MeqExpr& minor, const MeqExpr& major, + const MeqExpr& phi) +: MeqSource (name, "", ra, dec), + itsI (fluxI), + itsQ (fluxQ), + itsU (fluxU), + itsV (fluxV), + itsMinor (minor), + itsMajor (major), + itsPhi (phi) +{} + +MeqGaussSource::~MeqGaussSource() +{} + +} diff --git a/CEP/BB/BBSKernel/src/MNS/MeqGaussSource.h b/CEP/BB/BBSKernel/src/MNS/MeqGaussSource.h new file mode 100644 index 0000000000000000000000000000000000000000..4760348d99f13a4a68639436d15975aa9ead1c72 --- /dev/null +++ b/CEP/BB/BBSKernel/src/MNS/MeqGaussSource.h @@ -0,0 +1,82 @@ +//# MeqGaussSource.h: Class holding a gaussian source +//# +//# Copyright (C) 2002 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +#ifndef MNS_MEQGAUSSSOURCE_H +#define MNS_MEQGAUSSSOURCE_H + +// \file +// Class holding a gaussian source + +//# Includes +#include <BBS/MNS/MeqSource.h> +#include <Common/lofar_string.h> + +namespace LOFAR { + +// \ingroup BBS +// \addtogroup MNS +// @{ + + +class MeqGaussSource: public MeqSource +{ +public: + MeqGaussSource (const string& name, + const MeqExpr& fluxI, const MeqExpr& fluxQ, + const MeqExpr& fluxU, const MeqExpr& fluxV, + const MeqExpr& ra, const MeqExpr& dec, + const MeqExpr& minor, const MeqExpr& major, + const MeqExpr& phi); + + + virtual ~MeqGaussSource(); + + MeqExpr& getI() + { return itsI; } + MeqExpr& getQ() + { return itsQ; } + MeqExpr& getU() + { return itsU; } + MeqExpr& getV() + { return itsV; } + MeqExpr& getMinor() + { return itsMinor; } + MeqExpr& getMajor() + { return itsMajor; } + MeqExpr& getPhi() + { return itsPhi; } + +private: + MeqExpr itsI; + MeqExpr itsQ; + MeqExpr itsU; + MeqExpr itsV; + MeqExpr itsMinor; + MeqExpr itsMajor; + MeqExpr itsPhi; +}; + +// @} + +} + +#endif diff --git a/CEP/BB/BBSKernel/src/MNS/MeqParmExpr.cc b/CEP/BB/BBSKernel/src/MNS/MeqParmExpr.cc new file mode 100644 index 0000000000000000000000000000000000000000..dcc98d239f172b427ce3ba5daa9f8cc45af7a139 --- /dev/null +++ b/CEP/BB/BBSKernel/src/MNS/MeqParmExpr.cc @@ -0,0 +1,63 @@ +//# MeqParmExpr.h: A parm expression +//# +//# Copyright (C) 2006 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +#include <BBS/MNS/MeqParmExpr.h> +#include <BBS/MNS/MeqParmFunklet.h> +#include <BBS/MNS/MeqMatrixTmp.h> + +namespace LOFAR { + + MeqParmExpr::MeqParmExpr (const string& expr, MeqParmGroup* group, + ParmDB::ParmDB* table) + { + // Only the multiplication of 2 parms is currently supported. + string::size_type idx = expr.find('*'); + ASSERTSTR (idx != string::npos, + "Currently parmexpr only supports multiplication of two parms"); + string p1, p2; + for (string::size_type i=0; i<idx; ++i) { + if (expr[i] != ' ') { + p1.push_back (expr[i]); + } + } + for (string::size_type i=idx+1; i<expr.size(); ++i) { + if (expr[i] != ' ') { + p2.push_back (expr[i]); + } + } + ASSERTSTR (!p1.empty() && !p2.empty(), + "Currently parmexpr only supports multiplication of two parms"); + itsExpr1 = MeqExpr (MeqParmFunklet::create (p1, group, table)); + itsExpr2 = MeqExpr (MeqParmFunklet::create (p2, group, table)); + addChild (itsExpr1); + addChild (itsExpr2); + } + + MeqParmExpr::~MeqParmExpr() + {} + + MeqMatrix MeqParmExpr::getResultValue (const vector<const MeqMatrix*>& v) + { + return *v[0] * *v[1]; + } + +} diff --git a/CEP/BB/BBSKernel/src/MNS/MeqParmExpr.h b/CEP/BB/BBSKernel/src/MNS/MeqParmExpr.h new file mode 100644 index 0000000000000000000000000000000000000000..84496d99c6c93f9ddb42dbbb618f1d16f49c3371 --- /dev/null +++ b/CEP/BB/BBSKernel/src/MNS/MeqParmExpr.h @@ -0,0 +1,67 @@ +//# MeqParmExpr.h: A parm expression +//# +//# Copyright (C) 2006 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +#ifndef MNS_MEQPARMEXPR_H +#define MNS_MEQPARMEXPR_H + +// \file +// A parm which is an expression of other parms. + +//# Includes +#include <BBS/MNS/MeqExpr.h> +#include <ParmDB/ParmDB.h> + +namespace LOFAR { + +// \ingroup BBS +// \addtogroup MNS +// @{ + +//# Forward declarations +class MeqParmGroup; + +// MeqParmExpr represents a parm which is an expression of other parms. +// The current implementation is very limited, as it can only handle +// the multiplication of two parms. This is sufficient for the first needs. +// It should be rather simple to make more compilcated expression possible. + +class MeqParmExpr: public MeqExprRep +{ +public: + // Create from an expression. + MeqParmExpr (const string& expr, MeqParmGroup*, ParmDB::ParmDB* table); + + virtual ~MeqParmExpr(); + + // Calculate the value. + MeqMatrix getResultValue (const std::vector<const MeqMatrix*>&); + +private: + MeqExpr itsExpr1; + MeqExpr itsExpr2; +}; + +// @} + +} + +#endif diff --git a/CEP/BB/BBSKernel/src/MNS/MeqSource.cc b/CEP/BB/BBSKernel/src/MNS/MeqSource.cc new file mode 100644 index 0000000000000000000000000000000000000000..03cd94c9cf1b4c2681a95405969e0813ee66fa84 --- /dev/null +++ b/CEP/BB/BBSKernel/src/MNS/MeqSource.cc @@ -0,0 +1,42 @@ +//# MeqSource.cc: Class holding the expressions defining a source +//# +//# Copyright (C) 2006 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +#include <lofar_config.h> +#include <BBS/MNS/MeqSource.h> + + +namespace LOFAR { + + + MeqSource::MeqSource (const string& name, const string& groupName, + const MeqExpr& ra, const MeqExpr& dec) +: itsSourceNr (-1), + itsName (name), + itsGroupName (groupName), + itsRa (ra), + itsDec (dec) +{} + +MeqSource::~MeqSource() +{} + +} diff --git a/CEP/BB/BBSKernel/src/MNS/MeqSource.h b/CEP/BB/BBSKernel/src/MNS/MeqSource.h new file mode 100644 index 0000000000000000000000000000000000000000..e14bf86f72374b34a1bbb363c1037b697c955993 --- /dev/null +++ b/CEP/BB/BBSKernel/src/MNS/MeqSource.h @@ -0,0 +1,81 @@ +//# MeqPointSource.h: Abstract base class for holding a source +//# +//# Copyright (C) 2006 +//# ASTRON (Netherlands Foundation for Research in Astronomy) +//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl +//# +//# This program is free software; you can redistribute it and/or modify +//# it under the terms of the GNU General Public License as published by +//# the Free Software Foundation; either version 2 of the License, or +//# (at your option) any later version. +//# +//# This program is distributed in the hope that it will be useful, +//# but WITHOUT ANY WARRANTY; without even the implied warranty of +//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +//# GNU General Public License for more details. +//# +//# You should have received a copy of the GNU General Public License +//# along with this program; if not, write to the Free Software +//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +//# +//# $Id$ + +#ifndef MNS_MEQSOURCE_H +#define MNS_MEQSOURCE_H + +// \file +// Abstract base class for holding a source + +//# Includes +#include <BBS/MNS/MeqExpr.h> +#include <Common/lofar_string.h> + +namespace LOFAR { + +// \ingroup BBS +// \addtogroup MNS +// @{ + +class MeqSource +{ +public: + // The default constructor. + MeqSource(); + + MeqSource (const string& name, const string& groupName, + const MeqExpr& ra, const MeqExpr& dec); + + virtual ~MeqSource(); + + const string& getName() const + { return itsName; } + + const string& getGroupName() const + { return itsGroupName; } + + // Get the source nr. + int getSourceNr() const + { return itsSourceNr; } + + // Set the source nr. + void setSourceNr (int sourceNr) + { itsSourceNr = sourceNr; } + + MeqExpr& getRa() + { return itsRa; } + MeqExpr& getDec() + { return itsDec; } + +private: + int itsSourceNr; + string itsName; + string itsGroupName; + MeqExpr itsRa; + MeqExpr itsDec; +}; + +// @} + +} + +#endif