casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
PBMathInterface.h
Go to the documentation of this file.
1 //# PBMathInterface.h: Definitions of interface for PBMath objects
2 //# Copyright (C) 1996,1997,1998,1999,2000,2003
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be adressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //#
27 //# $Id$
28 
29 #ifndef SYNTHESIS_PBMATHINTERFACE_H
30 #define SYNTHESIS_PBMATHINTERFACE_H
31 
32 #include <casa/aips.h>
37 #include <casa/BasicSL/Complex.h>
39 
40 namespace casacore{
41 
42 class Table;
43 class MDirection;
44 class CoordinateSystem;
45 class ImageRegion;
46 class String;
47 }
48 
49 namespace casa { //# NAMESPACE CASA - BEGIN
50 
51 //Forward declaration
52 class SkyComponent;
53 
54 // <summary> Virtual base class defining the Primary Beam interface </summary>
55 
56 
57 // <use visibility=export>
58 
59 // <reviewed reviewer="" date="" tests="" demos="">
60 
61 // <prerequisite>
62 // <li> <linkto class="SkyJones">SkyJones</linkto> class
63 // <li> <linkto class="BeamSkyJones">BeamSkyJones</linkto> class
64 // </prerequisite>
65 //
66 // <etymology>
67 // PBMathInterface defines the interface to PB Math objects, the
68 // encapsulations of the PB mathematical functioning
69 // </etymology>
70 //
71 // <synopsis>
72 // PBMathInterface is a virtual base class that defines the
73 // PBMath interface. The big thing that it does is to define
74 // the applyPB, applyVP, and applyPB2 methods, which call a polymorphic
75 // low level apply method depending upon whether the PBMath type is a
76 // 1D or 2D type.
77 //
78 // PBMathInterface - there are many forms the primary beam can
79 // take, each of which will be derived from this virtual class which
80 // defines the generic interface to the multitude of PBMath objects.
81 // The main part of that interface is application of the PB to
82 // images, which is defined by PBMathInterface.
83 //
84 // PBMathInterface is the virtual base class, and
85 // PBMath is an envelope type which is derived from
86 // PBMathInterface. The two letter classes currently
87 // envisioned are PBMath1D and PBMath2D.
88 //
89 // PBMath can function independent of MeasurementSets.
90 // PBMath is used by the BeamSkyJones classes VPSkyJones and
91 // DBeamSkyJones.
92 // </synopsis>
93 //
94 //
95 // <example>
96 // <srcblock>
97 
98 // </srcblock>
99 // </example>
100 //
101 // <motivation>
102 // The SkyJones classes are all tied up with the casacore::MS or VisBuffers. This class
103 // encapsulates the raw mathematical functionality of the PB from the
104 // BeamSkyJones-derived classes which deal with the casacore::MS/VisBuff's.
105 // Also, several different BeamSkyJones objects and effects can be treated
106 // with the same PBMath heirarchy objects.
107 // </motivation>
108 //
109 // <todo asof="98/10/21">
110 // <li> summary()
111 // </todo>
112 
113 
115 public:
116 
117  // required so PBMath can see the protected "apply" method
118  // Other derivatives of PBMathInterface, such as PBMath2D, will
119  // also require friend class PBMath;
120  friend class PBMath;
121 
122  // Allowed PBMath Classes.
123  // Currently, COMMONPB, Airy, Gauss, Poly, Ipoly, CosPoly, Numerical
124  // are all implemented; Image and Zernike (2D PB's) are not.
125  // This enumeration order becomes locked in when we get permanent
126  // PB's in the casacore::MeasurementSet Tables.
127  //
128  // COMMPNPB is not really a PB Class, but is here for consistency with
129  // glish code in vpmanager
132 
133  // Number of different classes in PBClass enumeration
134  enum {
136  };
137 
138  // Useful constructor
140  BeamSquint squint,
141  casacore::Bool useSymmetricBeam);
142 
143  // virtual destructor
144  virtual ~PBMathInterface() = 0;
145 
146  // Apply Jones matrix to an image (and adjoint)
147  // <group>
148 
151  const casacore::MDirection& sp,
152  const casacore::Quantity parAngle = casacore::Quantity(0.0,"deg"),
153  const BeamSquint::SquintType doSquint = BeamSquint::NONE,
154  casacore::Bool inverse = false,
155  casacore::Bool conjugate = false,
156  casacore::Float cutoff = 0.01,
157  casacore::Bool forward=true);
158 
161  const casacore::MDirection& sp,
162  const casacore::Quantity parAngle = casacore::Quantity(0.0,"deg"),
163  const BeamSquint::SquintType doSquint = BeamSquint::NONE,
164  casacore::Bool inverse = false,
165  casacore::Float cutoff = 0.01,
166  casacore::Bool forward=true);
167 
170  const casacore::MDirection& sp,
171  const casacore::Quantity parAngle = casacore::Quantity(0.0,"deg"),
172  const BeamSquint::SquintType doSquint = BeamSquint::NONE,
173  casacore::Float cutoff = 0.01);
174 
175  // This has a very specialized role (in SkyEquation) and should
176  // not be used elsewhere
179  const casacore::MDirection& sp,
180  const casacore::Quantity parAngle = casacore::Quantity(0.0,"deg"),
181  const BeamSquint::SquintType doSquint = BeamSquint::NONE,
182  casacore::Float cutoff=0.01);
183  // </group>
184 
185  // Apply Jones matrix to a sky component (and adjoint)
186  // <group>
188  SkyComponent& out,
189  const casacore::MDirection& sp,
190  const casacore::Quantity frequency,
191  const casacore::Quantity parAngle = casacore::Quantity(0.0,"deg"),
192  const BeamSquint::SquintType doSquint = BeamSquint::NONE,
193  casacore::Bool inverse = false,
194  casacore::Bool conjugate = false,
195  casacore::Float cutoff = 0.01,
196  casacore::Bool forward = true);
198  SkyComponent& out,
199  const casacore::MDirection& sp,
200  const casacore::Quantity frequency,
201  const casacore::Quantity parAngle = casacore::Quantity(0.0,"deg"),
202  const BeamSquint::SquintType doSquint = BeamSquint::NONE,
203  casacore::Bool inverse = false,
204  casacore::Float cutoff = 0.01,
205  casacore::Bool forward = true);
207  SkyComponent& out,
208  const casacore::MDirection& sp,
209  const casacore::Quantity frequency,
210  const casacore::Quantity parAngle = casacore::Quantity(0.0,"deg"),
211  const BeamSquint::SquintType doSquint = BeamSquint::NONE);
212  // </group>
213 
214  // Which PBClass is this one?
215  virtual PBClass whichPBClass() = 0;
216 
217  // Convert PBClass enumeration into PBClass String
219 
220  // Convert enumeration into a string
221  static void namePBClass(const PBMathInterface::PBClass iPB, casacore::String & str);
222 
223  // Fit an azimuthally symmetric beam to the squinted or otherwise 2-D beam
224  // for casacore::Stokes I?
225  virtual void setUseSymmetric(casacore::Bool useSym=true) { useSymmetricBeam_p = useSym; }
226 
227  // Get value of useSymmetric
229 
230  // Get the casacore::ImageRegion of the primary beam on an Image for a given pointing
231  // Note: casacore::ImageRegion is not necesarily constrained to lie within the
232  // image region (for example, if the pointing center is near the edge of the
233  // image). fPad: fractional padding for extra support beyond PB.
234  // (note: we do not properly treat squint yet, this will cover it for now)
235  // iChan: frequency channel to take: lowest frequency channel is safe for all
236  //
237  // Potential problem: this casacore::ImageRegion includes all casacore::Stokes and Frequency Channels
238  // present in the input image.
240  const casacore::Int row, const casacore::Float fPad, const casacore::Int iChan,
241  const SkyJones::SizeType) = 0;
243  const casacore::Int row, const casacore::Float fPad, const casacore::Int iChan,
244  const SkyJones::SizeType) = 0;
245 
246 
247 
248  virtual casacore::Int support (const casacore::CoordinateSystem& cs)=0;
249 
250  // Summarize the Voltage Pattern;
251  // For PBMath1D, list nValues worth of the PB array
252  virtual void summary(casacore::Int nValues=0);
253 
254  // Is state of PBMath object OK?
255  virtual casacore::Bool ok()=0;
256 
257  virtual void setBandOrFeedName(const casacore::String elnamo){
258  bandOrFeedName_p=elnamo;
259  };
260 protected:
261 
262  // Dumb constructor: protected, as it won't do you any good!
263  PBMathInterface();
264 
265  // lower level helping apply methods
266  // <group>
267 
268  virtual
272  const casacore::MDirection& sp,
273  const casacore::Quantity parAngle,
274  const BeamSquint::SquintType doSquint,
275  casacore::Bool Inverse,
276  casacore::Bool Conjugate,
277  casacore::Int ipower, // ie, 1=VP, 2=PB
278  casacore::Float cutoff,
279  casacore::Bool forward) =0;
280 
281  virtual
285  const casacore::MDirection& sp,
286  const casacore::Quantity parAngle,
287  const BeamSquint::SquintType doSquint,
288  casacore::Float cutoff, const casacore::Int ipower=4) =0;
289 
290  virtual SkyComponent&
291  apply(SkyComponent& in,
292  SkyComponent& out,
293  const casacore::MDirection& sp,
294  const casacore::Quantity frequency,
295  const casacore::Quantity parAngle,
296  const BeamSquint::SquintType doSquint,
297  casacore::Bool Inverse,
298  casacore::Bool Conjugate,
299  casacore::Int ipower, // ie, 1=VP, 2=PB, 4=PB^2
300  casacore::Float cutoff,
301  casacore::Bool forward) =0;
302  // </group>
303 
304 
305  // Functions to deal with conversions to Float
306  // <group>
307  static casacore::Float asFloat(const casacore::Complex & value) {return value.real(); }
308  static casacore::Float asFloat(const casacore::DComplex & value){return (casacore::Float) value.real(); }
309  static casacore::Float asFloat(const casacore::Float & value) {return value; }
311 
312  // </group>
313 
314 
315 
316  // Are the parameters being provided in the derived class constructor
317  // describing a Voltage Pattern or a Primary Beam? The default is Voltage
318  // Pattern, and we keep it internally as a voltage pattern
320 
321  // Beam squint: convention is AZ-EL offset of the
322  // casacore::Stokes RR beam w.r.t. pointing position
323  // casacore::Stokes LL will be at -squint_p
324  // Southern observatories have the same AZ-EL and PA definitions as Northern
326 
327  // Should we use the effective az-symmetrical primary beam?
328  // Otherwise, use squinted beam; if no squint, no difference
330 
332 
333 private:
334 
335 };
336 
337 
338 } //# NAMESPACE CASA - END
339 
340 #endif
341 
A Measure: astronomical direction.
Definition: MDirection.h:174
static casacore::Float asFloat(const casacore::Complex &value)
Functions to deal with conversions to Float.
int Int
Definition: aipstype.h:50
virtual void setUseSymmetric(casacore::Bool useSym=true)
Fit an azimuthally symmetric beam to the squinted or otherwise 2-D beam for casacore::Stokes I...
virtual casacore::ImageRegion * extent(const casacore::ImageInterface< casacore::Complex > &im, const casacore::MDirection &pointing, const casacore::Int row, const casacore::Float fPad, const casacore::Int iChan, const SkyJones::SizeType)=0
Get the casacore::ImageRegion of the primary beam on an Image for a given pointing Note: casacore::Im...
virtual casacore::Bool ok()=0
Is state of PBMath object OK?
encapsulates beam squint (RR and LL beams at different directions)
Definition: BeamSquint.h:101
static casacore::Float asFloat(const casacore::Double &value)
casacore::ImageInterface< casacore::Complex > & applyPB(const casacore::ImageInterface< casacore::Complex > &in, casacore::ImageInterface< casacore::Complex > &out, const casacore::MDirection &sp, const casacore::Quantity parAngle=casacore::Quantity(0.0,"deg"), const BeamSquint::SquintType doSquint=BeamSquint::NONE, casacore::Bool inverse=false, casacore::Float cutoff=0.01, casacore::Bool forward=true)
virtual casacore::ImageInterface< casacore::Complex > & apply(const casacore::ImageInterface< casacore::Complex > &in, casacore::ImageInterface< casacore::Complex > &out, const casacore::MDirection &sp, const casacore::Quantity parAngle, const BeamSquint::SquintType doSquint, casacore::Bool Inverse, casacore::Bool Conjugate, casacore::Int ipower, casacore::Float cutoff, casacore::Bool forward)=0
lower level helping apply methods
casacore::ImageInterface< casacore::Float > & applyPB2(const casacore::ImageInterface< casacore::Float > &in, casacore::ImageInterface< casacore::Float > &out, const casacore::MDirection &sp, const casacore::Quantity parAngle=casacore::Quantity(0.0,"deg"), const BeamSquint::SquintType doSquint=BeamSquint::NONE, casacore::Float cutoff=0.01)
This has a very specialized role (in SkyEquation) and should not be used elsewhere.
Primary beam envelope class, derived from PBMathInterface.
Definition: PBMath.h:126
SquintType
Allowed Squints: NONE = no squint: PB is centered on the pointing center RR = PB is shifted from poin...
Definition: BeamSquint.h:109
casacore::ImageInterface< casacore::Complex > & applyVP(const casacore::ImageInterface< casacore::Complex > &in, casacore::ImageInterface< casacore::Complex > &out, const casacore::MDirection &sp, const casacore::Quantity parAngle=casacore::Quantity(0.0,"deg"), const BeamSquint::SquintType doSquint=BeamSquint::NONE, casacore::Bool inverse=false, casacore::Bool conjugate=false, casacore::Float cutoff=0.01, casacore::Bool forward=true)
Apply Jones matrix to an image (and adjoint)
virtual ~PBMathInterface()=0
virtual destructor
ABSTRACT CLASSES Abstract class for colors Any implementation of color should be able to provide a hexadecimal form of the if a human readable name(i.e."black").In many places throughout the plotter
PBClass
Allowed PBMath Classes.
static casacore::Float asFloat(const casacore::DComplex &value)
virtual void setBandOrFeedName(const casacore::String elnamo)
virtual void summary(casacore::Int nValues=0)
Summarize the Voltage Pattern; For PBMath1D, list nValues worth of the PB array.
casacore::Bool isThisVP_p
Are the parameters being provided in the derived class constructor describing a Voltage Pattern or a ...
void namePBClass(casacore::String &name)
Convert PBClass enumeration into PBClass String.
virtual casacore::Bool getUseSymmetric()
Get value of useSymmetric.
casacore::Matrix< T > inverse(const casacore::Matrix< T > &A)
double Double
Definition: aipstype.h:55
static casacore::Float asFloat(const casacore::Float &value)
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
float Float
Definition: aipstype.h:54
virtual casacore::Int support(const casacore::CoordinateSystem &cs)=0
virtual PBClass whichPBClass()=0
Which PBClass is this one?
Class to hold a region of interest in an image.
Definition: ImageRegion.h:86
casacore::Bool useSymmetricBeam_p
Should we use the effective az-symmetrical primary beam? Otherwise, use squinted beam; if no squint...
PBMathInterface()
Dumb constructor: protected, as it won&#39;t do you any good!
A component of a model of the sky.
Definition: SkyComponent.h:130
String: the storage and methods of handling collections of characters.
Definition: String.h:223
Virtual base class defining the Primary Beam interface.
Matrix< casacore::Complex > conjugate(const casacore::Matrix< casacore::Complex > &A)
complex space function specifications
Interconvert pixel and world coordinates.
LatticeExprNode value(const LatticeExprNode &expr)
This function returns the value of the expression without a mask.
casacore::String bandOrFeedName_p
BeamSquint squint_p
Beam squint: convention is AZ-EL offset of the casacore::Stokes RR beam w.r.t.
#define casacore
&lt;X11/Intrinsic.h&gt; #defines true, false, casacore::Bool, and String.
Definition: X11Intrinsic.h:42