casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
BeamCalc.h
Go to the documentation of this file.
1 //# VLAIlluminationConvFunc.h: Definition for VLAIlluminationConvFunc
2 //# Copyright (C) 1996,1997,1998,1999,2000,2002
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_BEAMCALC_H
30 #define SYNTHESIS_BEAMCALC_H
31 
32 //#include <casa/complex.h>
34 #include <casa/Exceptions.h>
35 #include <casa/Logging/LogIO.h>
36 
37 namespace casa
38 {
39 
40 #define MAXGEOM 2000
41 
42  typedef struct /* all dimensions in meters, GHz */
43  {
44  char name[16]; /* name of antenna, e.g., VLA */
45  char bandName[16];
46  casacore::Double sub_h; /* subreflector vertex height above primary vertex */
47  casacore::Double feedpos[3]; /* position of feed */
48  casacore::Double subangle; /* angle subtended by the subreflector */
49  casacore::Double legwidth; /* strut width */
50  casacore::Double legfoot; /* distance from optic axis of leg foot */
51  casacore::Double legapex; /* hight of leg intersection */
52  casacore::Double Rhole; /* radius of central hole */
53  casacore::Double Rant; /* antenna radius */
54  casacore::Double reffreq; /* a reference frequency */
55  casacore::Double taperpoly[5]; /* polynomial expanded about reffreq */
56  casacore::Int ntaperpoly; /* number of terms in polynomial */
57 
58  casacore::Double astigm_0; /* astigmatism: coefficient of Zernike Polyn. Z6 a.k.a. 0-90 */
59  casacore::Double astigm_45; /* astigmatism: coefficient of Zernike Polyn. Z5 a.k.a. 45-135 */
60 
61  /* to be added later
62  casacore::Double focus;
63  casacore::Double dfeedpos[3];
64  casacore::Double dsub_z;
65  */
67 
68  typedef struct
69  {
70  casacore::Int oversamp; /* average this many points per cell */
71  casacore::TempImage<casacore::Complex> *aperture; /* Jones planes [Nx,Ny,NStokes,NFreq]*/
72  casacore::Double x0, y0; /* center of cell 0, 0, meters */
73  casacore::Double dx, dy; /* increment in meters */
74  casacore::Int nx, ny; /* calculation plane size in cells */
75  /* last cell is at coordinates:
76  X = x0 + (nx-1)*dx
77  Y = y0 + (ny-1)*dy
78  */
79  casacore::Double pa; /* Parallactic angle, radians */
83 
84  /*
85  * calcAntenna parameters
86  */
87  typedef struct
88  {
89  casacore::Double sub_h; /* height of subreflector (on axis) */
90  casacore::Double feed[3]; /* position of the feed */
91  casacore::Double feeddir[3]; /* unit vector pointing along feed */
92  casacore::Double pfeeddir[3]; /* same as above after pathology applied */
93  casacore::Double radius; /* antenna radius (m) */
96  casacore::Double zedge; /* height at the edge of the dish */
97  casacore::Double bestparabola; /* best fit parabola quadratic coef */
98  casacore::Double ftaper; /* taper of feed */
99  casacore::Double thmax; /* maximum angle of feed */
107  casacore::Double astigm_0; /* astigmatism: coefficient of Zernike Polyn. Z6 a.k.a. 0-90 */
108  casacore::Double astigm_45; /* astigmatism: coefficient of Zernike Polyn. Z5 a.k.a. 45-135 */
110  casacore::Double hhat[3], vhat[3]; /* unit vectors orthogonal to dir */
115  char name[16];
117  } calcAntenna;
118 
119  typedef struct
120  {
121  casacore::Double subrot[3][3]; /* 3x3 matrix rotating x,y,z or nx,ny,nz */
122  casacore::Double feedrot[3][3]; /* 3x3 matrix rotating x,y,z or nx,ny,nz */
123  casacore::Double subshift[3]; /* 3 length vector */
124  casacore::Double feedshift[3]; /* 3 length vector */
125  casacore::Double subrotpoint[3]; /* 3 vector describing point to rotate sub. */
126  casacore::Double az_offset; /* azimuth pointing offset (radians) */
127  casacore::Double el_offset; /* elevation pointing offset (radians) */
128  casacore::Double phase_offset; /* DC offset in phase (radians) */
129  casacore::Double focus; /* meters out of focus toward subreflector */
130  } Pathology;
131 
132  typedef struct
133  {
134  casacore::Double aper[6]; /* aperture x, y, z, nx, ny, nz */
135  casacore::Double dish[6]; /* dish x, y, z, nx, ny, nz */
136  casacore::Double sub[6]; /* subreflector x, y, z, nx, ny, nz */
137  casacore::Double feed[3]; /* feed x, y, z */
138  } Ray;
139 
148 
149  VLABeamCalc_NumBandCodes /* this line last */
150  };
151 
162 
163  EVLABeamCalc_NumBandCodes /* this line last */
164  };
165 
166 
178 
179  ALMABeamCalc_NumBandCodes /* this line last */
180  };
181 
184  extern BeamCalcGeometry VLABeamCalcGeometryDefaults[VLABeamCalc_NumBandCodes];
191 
192  class BeamCalc
193  {
194  public:
195 
196  // This is a SINGLETON class
197  static BeamCalc* Instance();
198 
199  void setBeamCalcGeometries(const casacore::String& obsName, // (the observatory name, e.g. "ALMA" or "ACA")
200  const casacore::String& antennaType = "STANDARD",
201  const casacore::MEpoch& obsTime = casacore::MEpoch(casacore::Quantity(50000., "d")),
202  const casacore::String& otherAntRayPath=""); // override the AntennaResponses casacore::Table in Observatories
203 
204  casacore::Int getBandID(const casacore::Double freq, // in Hz
205  const casacore::String& obsname,
206  const casacore::String& bandName,
207  const casacore::String& antennaType="STANDARD",
208  const casacore::MEpoch& obsTime = casacore::MEpoch(casacore::Quantity(50000., "d")),
209  const casacore::String& otherAntRayPath=""); // override the AntennaResponses casacore::Table in Observatories
210 
214 
215  protected:
216  BeamCalc();
217 
218  private:
219 
220  void computePixelValues(const ApertureCalcParams *ap, const calcAntenna *a, const Pathology *p,
222  const casacore::Int &i, const casacore::Int &j);
223  void computePixelValues(const ApertureCalcParams *ap,
224  const calcAntenna *a, const Pathology *p,
225  const casacore::Double &L0,
227  const casacore::Int &i, const casacore::Int &j,
228  const casacore::Int& whichStokes);
230  const calcAntenna *a, const Pathology *p,
231  const casacore::Double &L0,
233  const casacore::Int &i, const casacore::Int &j,
234  const casacore::Int& whichStokes);
235  //normalizes a "vector" of 3 Doubles in the vector sense
236  inline void norm3(casacore::Double *v)
237  {
239  s = sqrt(v[0]*v[0] + v[1]*v[1] + v[2]*v[2]);
240  v[0] /= s;
241  v[1] /= s;
242  v[2] /= s;
243  }
244 
246  casacore::Double ftaper, casacore::Double thmax, const char *geomfile);
247 
248  void deleteAntenna(calcAntenna *a);
249 
251 
252  void Antennasetdir(calcAntenna *a, const casacore::Double *dir);
253 
254  // sets feeddir after pathology is considered
255  void alignfeed(calcAntenna *a, const Pathology *p);
256 
257  void getfeedbasis(const calcAntenna *a, casacore::Double B[3][3]);
258 
259  void Efield(const calcAntenna *a, const casacore::Complex *pol, casacore::Complex *E);
260 
261  casacore::Int Antennasetfeedpattern(calcAntenna *a, const char *filename, casacore::Double scale);
262 
264 
266 
268 
269  // Returns position of subreflector piece (x, y, z) and
270  // its normal (u, v, w)
272 
274 
275  void printAntenna(const calcAntenna *a);
276 
277  Ray* newRay(const casacore::Double *sub);
278 
279  void deleteRay(Ray *ray);
280 
282 
284 
285  void deletePathology(Pathology *P);
286 
287  void normvec(const casacore::Double *a, const casacore::Double *b, casacore::Double *c);
288 
289  casacore::Double dAdOmega(const calcAntenna *a, const Ray *ray1, const Ray *ray2,
290  const Ray *ray3, const Pathology *p);
291 
292  casacore::Double dOmega(const calcAntenna *a, const Ray *ray1, const Ray *ray2,
293  const Ray *ray3, const Pathology *p);
294 
295  casacore::Double Raylen(const Ray *ray);
296 
297  void Pathologize(casacore::Double *sub, const Pathology *p);
298 
299  void applyPathology(Pathology *P, calcAntenna *a);
300 
301  void intersectdish(const calcAntenna *a, const casacore::Double *sub, const casacore::Double *unitdir,
302  casacore::Double *dish, casacore::Int niter);
303 
304  void intersectaperture(const calcAntenna *a, const casacore::Double *dish,
305  const casacore::Double *unitdir, casacore::Double *aper);
306 
308 
309  casacore::Double feedgain(const calcAntenna *a, const Ray *ray, const Pathology *p);
310 
311  Ray* trace(const calcAntenna *a, casacore::Double x, casacore::Double y, const Pathology *p);
312 
313  void tracepol(casacore::Complex *E0, const Ray *ray, casacore::Complex *E1);
314 
316 
317  casacore::Int legplanewaveblock2(const calcAntenna *a, const Ray *ray);
318 
319  casacore::Int legsphericalwaveblock(const calcAntenna *a, const Ray *ray);
320 
322 
324 
333 
338  static const casacore::Double DEG_RAD;
339  static const casacore::Double RAD_DEG;
340 
341  };
342 
343 };
344 
345 #endif
casacore::Double K
Definition: BeamCalc.h:94
casacore::Double focus
Definition: BeamCalc.h:129
casacore::uInt BeamCalc_NumBandCodes_p
Definition: BeamCalc.h:328
casacore::Double dOmega(const calcAntenna *a, const Ray *ray1, const Ray *ray2, const Ray *ray3, const Pathology *p)
A 1-D Specialization of the Array class.
void Pathologize(casacore::Double *sub, const Pathology *p)
static const casacore::Double INCH_METER
Definition: BeamCalc.h:335
VLABeamCalcBandCode
Definition: BeamCalc.h:140
int Int
Definition: aipstype.h:50
casacore::Int legsphericalwaveblock(const calcAntenna *a, const Ray *ray)
casacore::Int getBandID(const casacore::Double freq, const casacore::String &obsname, const casacore::String &bandName, const casacore::String &antennaType="STANDARD", const casacore::MEpoch &obsTime=casacore::MEpoch(casacore::Quantity(50000.,"d")), const casacore::String &otherAntRayPath="")
casacore::Double reffreq
Definition: BeamCalc.h:54
void normvec(const casacore::Double *a, const casacore::Double *b, casacore::Double *c)
casacore::Double ALMABandMaxFreqDefaults[ALMABeamCalc_NumBandCodes]
casacore::Int Antennasetfeedpattern(calcAntenna *a, const char *filename, casacore::Double scale)
static const casacore::Double RAD_DEG
Definition: BeamCalc.h:339
static const casacore::Double NS_METER
Definition: BeamCalc.h:336
void Efield(const calcAntenna *a, const casacore::Complex *pol, casacore::Complex *E)
casacore::Double pa
Definition: BeamCalc.h:79
calcAntenna * newAntennafromApertureCalcParams(ApertureCalcParams *ap)
casacore::Double feedfunc(const calcAntenna *a, casacore::Double theta)
void deletePathology(Pathology *P)
casacore::Int dishfromsub(const calcAntenna *a, casacore::Double x, casacore::Double y, casacore::Double *dishpoint)
casacore::Int legplanewaveblock(const calcAntenna *a, casacore::Double x, casacore::Double y)
void getfeedbasis(const calcAntenna *a, casacore::Double B[3][3])
casacore::Double legapex
Definition: BeamCalc.h:103
void setBeamCalcGeometries(const casacore::String &obsName, const casacore::String &antennaType="STANDARD", const casacore::MEpoch &obsTime=casacore::MEpoch(casacore::Quantity(50000.,"d")), const casacore::String &otherAntRayPath="")
static const casacore::Double METER_INCH
Definition: BeamCalc.h:334
casacore::Double zedge
Definition: BeamCalc.h:96
casacore::Int legplanewaveblock2(const calcAntenna *a, const Ray *ray)
casacore::String antType_p
Definition: BeamCalc.h:326
casacore::Double Rhole
Definition: BeamCalc.h:52
casacore::Double legthick
Definition: BeamCalc.h:104
casacore::String obsName_p
Definition: BeamCalc.h:325
Pathology * newPathologyfromApertureCalcParams(ApertureCalcParams *ap)
Ray * trace(const calcAntenna *a, casacore::Double x, casacore::Double y, const Pathology *p)
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
Pathology * newPathology()
casacore::Double ftaper
Definition: BeamCalc.h:98
void deleteAntenna(calcAntenna *a)
casacore::Int ntaperpoly
Definition: BeamCalc.h:56
A Measure: instant in time.
Definition: MEpoch.h:104
casacore::Int oversamp
Definition: BeamCalc.h:70
void Antennasetdir(calcAntenna *a, const casacore::Double *dir)
casacore::Double VLABandMaxFreqDefaults[VLABeamCalc_NumBandCodes]
casacore::Double astigm_0
Definition: BeamCalc.h:58
void Antennasetfreq(calcAntenna *a, casacore::Double freq)
casacore::Double freq
Definition: BeamCalc.h:80
casacore::Double dy
Definition: BeamCalc.h:73
casacore::Int calculateApertureLinPol(ApertureCalcParams *ap, const casacore::Int &whichStokes)
casacore::Double legfoot
Definition: BeamCalc.h:50
casacore::Double deltar
Definition: BeamCalc.h:95
casacore::Double el_offset
Definition: BeamCalc.h:127
void computePixelValuesLinPol(const ApertureCalcParams *ap, const calcAntenna *a, const Pathology *p, const casacore::Double &L0, casacore::Complex *Ex, casacore::Complex *Ey, const casacore::Int &i, const casacore::Int &j, const casacore::Int &whichStokes)
casacore::Double lambda
Definition: BeamCalc.h:106
casacore::String antRespPath_p
Definition: BeamCalc.h:332
static const casacore::Double METER_NS
Definition: BeamCalc.h:337
double Double
Definition: aipstype.h:55
casacore::Double az_offset
Definition: BeamCalc.h:126
casacore::Double ALMABandMinFreqDefaults[ALMABeamCalc_NumBandCodes]
casacore::Double bestparabola
Definition: BeamCalc.h:97
casacore::Double legwidth
Definition: BeamCalc.h:101
void applyPathology(Pathology *P, calcAntenna *a)
static BeamCalc * Instance()
This is a SINGLETON class.
LatticeExprNode sqrt(const LatticeExprNode &expr)
#define MAXGEOM
Definition: BeamCalc.h:40
casacore::Vector< BeamCalcGeometry > BeamCalcGeometries_p
Definition: BeamCalc.h:329
casacore::Int band
Definition: BeamCalc.h:81
casacore::Double astigm_45
Definition: BeamCalc.h:59
void computePixelValues(const ApertureCalcParams *ap, const calcAntenna *a, const Pathology *p, const casacore::Double &L0, casacore::Complex *Er, casacore::Complex *El, const casacore::Int &i, const casacore::Int &j)
casacore::Vector< casacore::Double > bandMinFreq_p
Definition: BeamCalc.h:330
casacore::Double subangle
Definition: BeamCalc.h:48
casacore::TempImage< casacore::Complex > * aperture
Definition: BeamCalc.h:71
void alignfeed(calcAntenna *a, const Pathology *p)
sets feeddir after pathology is considered
casacore::MEpoch obsTime_p
Definition: BeamCalc.h:327
void printAntenna(const calcAntenna *a)
casacore::Int calculateAperture(ApertureCalcParams *ap)
calcAntenna * newAntenna(casacore::Double sub_h, casacore::Double feed_x, casacore::Double feed_y, casacore::Double feed_z, casacore::Double ftaper, casacore::Double thmax, const char *geomfile)
casacore::Double legwidth
Definition: BeamCalc.h:49
casacore::Double Raylen(const Ray *ray)
casacore::Int gridsize
Definition: BeamCalc.h:116
void deleteRay(Ray *ray)
casacore::Double sub_h
Definition: BeamCalc.h:89
void intersectaperture(const calcAntenna *a, const casacore::Double *dish, const casacore::Double *unitdir, casacore::Double *aper)
BeamCalcGeometry ALMABeamCalcGeometryDefaults[ALMABeamCalc_NumBandCodes]
casacore::Double legfootz
Definition: BeamCalc.h:102
casacore::Double feedgain(const calcAntenna *a, const Ray *ray, const Pathology *p)
casacore::Double hole_radius
Definition: BeamCalc.h:105
BeamCalcGeometry EVLABeamCalcGeometryDefaults[EVLABeamCalc_NumBandCodes]
casacore::Int subfromdish(const calcAntenna *a, casacore::Double x, casacore::Double y, casacore::Double *subpoint)
Returns position of subreflector piece (x, y, z) and its normal (u, v, w)
const Double c
Fundamental physical constants (SI units):
casacore::Double Rant
Definition: BeamCalc.h:53
casacore::Double EVLABandMaxFreqDefaults[EVLABeamCalc_NumBandCodes]
casacore::Int ny
Definition: BeamCalc.h:74
String: the storage and methods of handling collections of characters.
Definition: String.h:223
casacore::Double EVLABandMinFreqDefaults[EVLABeamCalc_NumBandCodes]
casacore::Double radius
Definition: BeamCalc.h:93
casacore::Double fa2pi
Definition: BeamCalc.h:100
casacore::Double astigm_45
Definition: BeamCalc.h:108
casacore::Double VLABandMinFreqDefaults[VLABeamCalc_NumBandCodes]
casacore::Double sub_h
Definition: BeamCalc.h:46
void norm3(casacore::Double *v)
normalizes a &quot;vector&quot; of 3 Doubles in the vector sense
Definition: BeamCalc.h:236
casacore::Double dAdOmega(const calcAntenna *a, const Ray *ray1, const Ray *ray2, const Ray *ray3, const Pathology *p)
Ray * newRay(const casacore::Double *sub)
ALMABeamCalcBandCode
Definition: BeamCalc.h:167
BeamCalcGeometry VLABeamCalcGeometryDefaults[VLABeamCalc_NumBandCodes]
static const casacore::Double DEG_RAD
Definition: BeamCalc.h:338
casacore::Double thmax
Definition: BeamCalc.h:99
casacore::Double y0
Definition: BeamCalc.h:72
casacore::Int ngeom
Definition: BeamCalc.h:114
casacore::Int dishvalue(const calcAntenna *a, casacore::Double r, casacore::Double *z, casacore::Double *m)
void tracepol(casacore::Complex *E0, const Ray *ray, casacore::Complex *E1)
casacore::Double astigm_0
Definition: BeamCalc.h:107
static BeamCalc * instance_p
Definition: BeamCalc.h:323
EVLABeamCalcBandCode
Definition: BeamCalc.h:152
void intersectdish(const calcAntenna *a, const casacore::Double *sub, const casacore::Double *unitdir, casacore::Double *dish, casacore::Int niter)
casacore::Int astigdishvalue(const calcAntenna *a, casacore::Double x, casacore::Double y, casacore::Double *z, casacore::Double *m)
casacore::Double phase_offset
Definition: BeamCalc.h:128
unsigned int uInt
Definition: aipstype.h:51
void copyBeamCalcGeometry(BeamCalcGeometry *to, BeamCalcGeometry *from)
casacore::Double legapex
Definition: BeamCalc.h:51
casacore::Vector< casacore::Double > bandMaxFreq_p
Definition: BeamCalc.h:331