source: trunk/src/SDAttr.cc @ 362

Last change on this file since 362 was 362, checked in by kil064, 19 years ago

move gain elevation info into here from SDMath

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.0 KB
Line 
1//#---------------------------------------------------------------------------
2//# SDAttr.cc: A collection of attributes for different telescopes
3//#---------------------------------------------------------------------------
4//# Copyright (C) 2004
5//# ATNF
6//#
7//# This program is free software; you can redistribute it and/or modify it
8//# under the terms of the GNU General Public License as published by the Free
9//# Software Foundation; either version 2 of the License, or (at your option)
10//# any later version.
11//#
12//# This program is distributed in the hope that it will be useful, but
13//# WITHOUT ANY WARRANTY; without even the implied warranty of
14//# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General
15//# Public License for more details.
16//#
17//# You should have received a copy of the GNU General Public License along
18//# with this program; if not, write to the Free Software Foundation, Inc.,
19//# 675 Massachusetts Ave, Cambridge, MA 02139, USA.
20//#
21//# Correspondence concerning this software should be addressed as follows:
22//#        Internet email: Malte.Marquarding@csiro.au
23//#        Postal address: Malte Marquarding,
24//#                        Australia Telescope National Facility,
25//#                        P.O. Box 76,
26//#                        Epping, NSW, 2121,
27//#                        AUSTRALIA
28//#
29//# $Id:
30//#---------------------------------------------------------------------------
31
32#include "SDAttr.h"
33#include <casa/aips.h>
34#include <casa/Arrays/Vector.h>
35#include <casa/Arrays/ArrayMath.h>
36#include <casa/Exceptions.h>
37#include <casa/Quanta/QC.h>
38#include <casa/Quanta/Quantum.h>
39
40#include <measures/Measures/MEpoch.h>
41
42#include <scimath/Mathematics/InterpolateArray1D.h>
43
44using namespace casa;
45using namespace asap;
46
47SDAttr::SDAttr ()
48{
49   initData();
50}
51
52SDAttr::SDAttr(const SDAttr& other)
53{
54   initData();                                 // state just private 'static' data
55}
56
57SDAttr& SDAttr::operator=(const SDAttr& other)
58{
59  if (this != &other) {
60    ;                                      // state just private 'static' data
61  }
62  return *this;
63}
64
65SDAttr::~SDAttr()
66{;}
67
68
69Float SDAttr::diameter (Instrument inst)  const
70{
71   Float D = 1.0;
72   switch (inst) {
73      case ATMOPRA:
74        {
75           D = 22.0;
76        }
77        break;
78      case ATPKSMB:
79      case ATPKSHOH:
80        {
81           D = 64.0;
82        }
83        break;
84      case TIDBINBILLA:
85        {
86           D = 70.0;
87        }
88        break;
89      case CEDUNA:
90        {
91           D = 30.0;
92        }
93        break;
94      case HOBART:
95        {
96           D = 26.0;
97        }
98        break;
99      default:
100        {
101            throw(AipsError("Unknown instrument"));
102        }
103   }
104//
105   return D;
106}
107
108Vector<Float> SDAttr::beamEfficiency (Instrument inst, const MEpoch& dateObs, const Vector<Float>& freqs) const
109{
110
111// Look at date where appropriate
112
113   Vector<Float> facs(freqs.nelements(),1.0);
114   switch (inst) {
115      case ATMOPRA:
116        {
117           facs = interp (freqs/1.0e9f, MopEtaBeamX_, MopEtaBeam2004Y_);
118        }
119        break;
120      default:
121        {
122           cerr << "No beam efficiency data for this instrument - assuming unity" << endl;
123        }
124   }
125//
126   return facs;
127}
128
129Vector<Float> SDAttr::apertureEfficiency (Instrument inst, const MEpoch& dateObs, const Vector<Float>& freqs) const
130{
131
132// Look at date where appropriate
133
134   Vector<Float> facs(freqs.nelements(),1.0);
135   switch (inst) {
136      case ATMOPRA:
137        {
138           facs = interp (freqs/1.0e9f, MopEtaApX_, MopEtaAp2004Y_);
139        }
140        break;
141      default:
142        {
143           cerr << "No aperture efficiency data for this instrument - assuming unity" << endl;
144        }
145   }
146   return facs;
147}
148
149Vector<Float> SDAttr::JyPerK (Instrument inst, const MEpoch& dateObs, const Vector<Float>& freqs) const
150{
151
152// FInd what we need
153
154   Vector<Float> etaAp = apertureEfficiency (inst, dateObs, freqs);
155   Float D = diameter(inst);
156
157// Compute it
158
159   Vector<Float> facs(freqs.nelements(),1.0);
160   for (uInt i=0; i<freqs.nelements(); i++) {
161      facs(i) = SDAttr::findJyPerKFac (etaAp(i), D);
162   }
163//
164   return facs;
165}
166
167
168Float SDAttr::findJyPerKFac (Float etaAp, Float D)
169//
170// Converts K -> Jy
171// D in m
172//
173{
174   Double kb = QC::k.getValue(Unit(String("erg/K")));
175   Float gA = C::pi * D * D / 4.0;
176   return (2.0 * 1.0e19 * kb / etaAp / gA);
177}
178
179
180Vector<Float> SDAttr::gainElevationPoly (Instrument inst) const
181{
182
183// Look at date where appropriate
184
185   switch (inst) {
186      case TIDBINBILLA:
187        {
188           return TidGainElPoly_.copy();
189        }
190        break;
191      default:
192        {
193           Vector<Float> t;
194           return t.copy();
195        }
196   }
197}
198
199
200
201
202// Private
203
204Vector<Float> SDAttr::interp (const Vector<Float>& xOut, const Vector<Float>& xIn,
205                              const Vector<Float>& yIn) const
206{
207   Int method = 1;                         // Linear
208   Vector<Float> yOut;
209   Vector<Bool> mOut;
210//
211   Vector<Bool> mIn(xIn.nelements(),True);
212//
213   InterpolateArray1D<Float,Float>::interpolate(yOut, mOut, xOut,
214                                                 xIn, yIn, mIn,
215                                                 method, True, True);
216//
217   return yOut;
218}
219
220void SDAttr::initData ()
221//
222// Mopra data from online Mopra guide.
223//
224{
225
226// Beam efficiency
227
228   MopEtaBeamX_.resize(3);
229   MopEtaBeamX_(0) = 86.0;
230   MopEtaBeamX_(1) = 100.0;
231   MopEtaBeamX_(2) = 115.0;
232//
233   MopEtaBeam2003Y_.resize(3);
234   MopEtaBeam2003Y_(0) = 0.39;
235   MopEtaBeam2003Y_(1) = 0.37;
236   MopEtaBeam2003Y_(2) = 0.37;                // replicated from (1)
237//
238   MopEtaBeam2004Y_.resize(3);
239   MopEtaBeam2004Y_(0) = 0.49;
240   MopEtaBeam2004Y_(1) = 0.44;
241   MopEtaBeam2004Y_(2) = 0.42;
242
243// Aperture efficiency
244
245   MopEtaApX_.resize(2);
246   MopEtaApX_(0) = 86.0;
247   MopEtaApX_(1) = 115.0;
248//
249   MopEtaAp2004Y_.resize(2);
250   MopEtaAp2004Y_(0) = 0.33;
251   MopEtaAp2004Y_(1) = 0.24;
252
253// Gain elevation correction polynomial coefficients (for elevation in degrees)
254
255   TidGainElPoly_.resize(3);
256   TidGainElPoly_(0) = 3.58788e-1;
257   TidGainElPoly_(1) = 2.87243e-2;
258   TidGainElPoly_(2) = -3.219093e-4;
259}
Note: See TracBrowser for help on using the repository browser.