source: trunk/src/SDAttr.cc @ 361

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

document where Mopra numbers come from
init -> initData

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 6.1 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   if (inst==ATPKSMB || inst==ATPKSHOH) {
73      D = 64.0;
74   } else if (inst==ATMOPRA) {
75      D = 22.0;
76   } else if (inst==TIDBINBILLA) {
77      D = 70.0;
78   } else if (inst==CEDUNA) {
79      D = 30.0;
80   } else if (inst==HOBART) {
81      D = 26.0;
82   } else {
83      throw(AipsError("Unknown instrument"));
84   }
85//
86   return D;
87}
88
89Vector<Float> SDAttr::beamEfficiency (Instrument inst, const MEpoch& dateObs, const Vector<Float>& freqs) const
90{
91
92// Look at date where appropriate
93
94   Vector<Float> facs(freqs.nelements(),1.0);
95   if (inst==ATPKSMB) {
96      cerr << "No beam efficiency data for this instrument - assuming unity" << endl;
97   } else if (inst==ATPKSHOH) {
98      cerr << "No beam efficiency data for this instrument - assuming unity" << endl;
99   } else if (inst==ATMOPRA) {
100      facs = interp (freqs/1.0e9f, MopEtaBeamX_, MopEtaBeam2004Y_);
101   } else if (inst==TIDBINBILLA) {
102      cerr << "No beam efficiency data for this instrument - assuming unity" << endl;
103   } else if (inst==CEDUNA) {
104      cerr << "No beam efficiency data for this instrument - assuming unity" << endl;
105   } else if (inst==HOBART) {
106      cerr << "No beam efficiency data for this instrument - assuming unity" << endl;
107   } else {
108   }
109//
110   return facs;
111}
112
113Vector<Float> SDAttr::apertureEfficiency (Instrument inst, const MEpoch& dateObs, const Vector<Float>& freqs) const
114{
115
116// Look at date where appropriate
117
118   Vector<Float> facs(freqs.nelements(),1.0);
119   if (inst==ATPKSMB) {
120      cerr << "No aperture efficiency data for this instrument - assuming unity" << endl;
121   } else if (inst==ATPKSHOH) {
122      cerr << "No aperture efficiency data for this instrument - assuming unity" << endl;
123   } else if (inst==ATMOPRA) {
124      facs = interp (freqs/1.0e9f, MopEtaApX_, MopEtaAp2004Y_);
125   } else if (inst==TIDBINBILLA) {
126      cerr << "No aperture efficiency data for this instrument - assuming unity" << endl;
127   } else if (inst==CEDUNA) {
128      cerr << "No aperture efficiency data for this instrument - assuming unity" << endl;
129   } else if (inst==HOBART) {
130      cerr << "No aperture efficiency data for this instrument - assuming unity" << endl;
131   } else {
132      cerr << "No aperture efficiency data for this instrument - assuming unity" << endl;
133   }
134   return facs;
135}
136
137Vector<Float> SDAttr::JyPerK (Instrument inst, const MEpoch& dateObs, const Vector<Float>& freqs) const
138{
139
140// FInd what we need
141
142   Vector<Float> etaAp = apertureEfficiency (inst, dateObs, freqs);
143   Float D = diameter(inst);
144
145// Compute it
146
147   Vector<Float> facs(freqs.nelements(),1.0);
148   for (uInt i=0; i<freqs.nelements(); i++) {
149      facs(i) = SDAttr::findJyPerKFac (etaAp(i), D);
150   }
151//
152   return facs;
153}
154
155
156Float SDAttr::findJyPerKFac (Float etaAp, Float D)
157//
158// Converts K -> Jy
159// D in m
160//
161{
162   Double kb = QC::k.getValue(Unit(String("erg/K")));
163   Float gA = C::pi * D * D / 4.0;
164   return (2.0 * 1.0e19 * kb / etaAp / gA);
165}
166
167
168
169// Private
170
171Vector<Float> SDAttr::interp (const Vector<Float>& xOut, const Vector<Float>& xIn,
172                              const Vector<Float>& yIn) const
173{
174   Int method = 1;                         // Linear
175   Vector<Float> yOut;
176   Vector<Bool> mOut;
177//
178   Vector<Bool> mIn(xIn.nelements(),True);
179//
180   InterpolateArray1D<Float,Float>::interpolate(yOut, mOut, xOut,
181                                                 xIn, yIn, mIn,
182                                                 method, True, True);
183//
184   return yOut;
185}
186
187void SDAttr::initData ()
188{
189//
190// Mopra data from online Mopra guide.
191//
192   MopEtaBeamX_.resize(3);
193   MopEtaBeamX_(0) = 86.0;
194   MopEtaBeamX_(1) = 100.0;
195   MopEtaBeamX_(2) = 115.0;
196//
197   MopEtaBeam2003Y_.resize(3);
198   MopEtaBeam2003Y_(0) = 0.39;
199   MopEtaBeam2003Y_(1) = 0.37;
200   MopEtaBeam2003Y_(2) = 0.37;                // replicated from (1)
201//
202   MopEtaBeam2004Y_.resize(3);
203   MopEtaBeam2004Y_(0) = 0.49;
204   MopEtaBeam2004Y_(1) = 0.44;
205   MopEtaBeam2004Y_(2) = 0.42;
206//
207   MopEtaApX_.resize(2);
208   MopEtaApX_(0) = 86.0;
209   MopEtaApX_(1) = 115.0;
210//
211   MopEtaAp2004Y_.resize(2);
212   MopEtaAp2004Y_(0) = 0.33;
213   MopEtaAp2004Y_(1) = 0.24;
214}
215
Note: See TracBrowser for help on using the repository browser.