[1757] | 1 | //#--------------------------------------------------------------------------- |
---|
| 2 | //# NRO45Reader.cc: Class to read NRO 45m OTF data. |
---|
| 3 | //#--------------------------------------------------------------------------- |
---|
| 4 | //# Copyright (C) 2000-2006 |
---|
| 5 | //# Associated Universities, Inc. Washington DC, USA. |
---|
| 6 | //# |
---|
| 7 | //# This library is free software; you can redistribute it and/or modify it |
---|
| 8 | //# under the terms of the GNU Library General Public License as published by |
---|
| 9 | //# the Free Software Foundation; either version 2 of the License, or (at your |
---|
| 10 | //# option) any later version. |
---|
| 11 | //# |
---|
| 12 | //# This library is distributed in the hope that it will be useful, but WITHOUT |
---|
| 13 | //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
---|
| 14 | //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public |
---|
| 15 | //# License for more details. |
---|
| 16 | //# |
---|
| 17 | //# You should have received a copy of the GNU Library General Public License |
---|
| 18 | //# along with this library; if not, write to the Free Software Foundation, |
---|
| 19 | //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. |
---|
| 20 | //# |
---|
| 21 | //# Correspondence concerning AIPS++ should be addressed as follows: |
---|
| 22 | //# Internet email: aips2-request@nrao.edu. |
---|
| 23 | //# Postal address: AIPS++ Project Office |
---|
| 24 | //# National Radio Astronomy Observatory |
---|
| 25 | //# 520 Edgemont Road |
---|
| 26 | //# Charlottesville, VA 22903-2475 USA |
---|
| 27 | //# |
---|
| 28 | //# $Id$ |
---|
| 29 | //#--------------------------------------------------------------------------- |
---|
| 30 | //# Original: 2008/11/04, Takeshi Nakazato, NAOJ |
---|
| 31 | //#--------------------------------------------------------------------------- |
---|
| 32 | |
---|
| 33 | #include <atnf/PKSIO/NRO45Reader.h> |
---|
| 34 | #include <atnf/PKSIO/NROOTFDataset.h> |
---|
| 35 | |
---|
| 36 | #include <string> |
---|
| 37 | #include <stdio.h> |
---|
| 38 | |
---|
| 39 | using namespace std ; |
---|
| 40 | |
---|
| 41 | // Constructor |
---|
| 42 | NRO45Reader::NRO45Reader( string name ) |
---|
| 43 | : NROReader( name ) |
---|
| 44 | { |
---|
| 45 | // DEBUG |
---|
| 46 | //cout << "NRO45Reader::NRO45Reader()" << endl ; |
---|
| 47 | // |
---|
| 48 | } |
---|
| 49 | |
---|
| 50 | // Destructor. |
---|
| 51 | NRO45Reader::~NRO45Reader() |
---|
| 52 | { |
---|
| 53 | } |
---|
| 54 | |
---|
| 55 | // Read data header |
---|
| 56 | Int NRO45Reader::read() |
---|
| 57 | { |
---|
| 58 | LogIO os( LogOrigin( "NRO45Reader", "read()", WHERE ) ) ; |
---|
| 59 | |
---|
| 60 | // DEBUG |
---|
| 61 | //cout << "NRO45Reader::read()" << endl ; |
---|
| 62 | // |
---|
| 63 | int status = 0 ; |
---|
| 64 | |
---|
| 65 | // create NROOTFDataset |
---|
| 66 | dataset_ = new NROOTFDataset( filename_ ) ; |
---|
| 67 | |
---|
| 68 | // fill NROOTFDataset |
---|
| 69 | status = dataset_->fillHeader() ; |
---|
| 70 | |
---|
| 71 | if ( status != 0 ) { |
---|
| 72 | os << LogIO::SEVERE << "Failed to fill data header." << LogIO::EXCEPTION ; |
---|
| 73 | } |
---|
| 74 | |
---|
| 75 | return status ; |
---|
| 76 | } |
---|
| 77 | |
---|
| 78 | vector<double> NRO45Reader::getAntennaPosition() |
---|
| 79 | { |
---|
| 80 | // NOBEYAMA in ITRF2005 |
---|
| 81 | // Obtained from ITRF website http://itrf.ensg.ign.fr/ |
---|
| 82 | //vector<double> pos( 3 ) ; |
---|
| 83 | //pos[0] = -3871169.229 ; |
---|
| 84 | //pos[1] = 3428274.975 ; |
---|
| 85 | //pos[2] = 3723698.519 ; |
---|
| 86 | |
---|
| 87 | // NOBEYAMA in World Geodetic System |
---|
| 88 | // |
---|
| 89 | // E138d28m21.2s N35d56m40.9s 1350m in old Japanese Geodetic System |
---|
| 90 | // (from http://www.nro.nao.ac.jp/Misc/hist_NRO.html) |
---|
| 91 | // |
---|
| 92 | // E138d28m09.96444s N35d56m52.3314s 1350m in World Geodetic System |
---|
| 93 | // (conversion is done by http://vldb.gsi.go.jp/sokuchi/tky2jgd/) |
---|
| 94 | |
---|
[1868] | 95 | // double elon = 138. + 28. / 60. + 9.96444 / 3600. ; |
---|
| 96 | // double nlat = 35. + 56. / 60. + 52.3314 / 3600. ; |
---|
| 97 | // double alti = 1350. ; |
---|
[1757] | 98 | |
---|
[1868] | 99 | // Double elon = 138.4725 ; |
---|
| 100 | // Double nlat = 35.9445 ; |
---|
| 101 | // Double alti = 1412.599 ; |
---|
| 102 | |
---|
| 103 | // MPosition p( MVPosition( Quantity( alti, "m" ), |
---|
| 104 | // Quantity( elon, "deg" ), |
---|
| 105 | // Quantity( nlat, "deg" ) ), |
---|
| 106 | // MPosition::Ref( MPosition::WGS84 ) ) ; |
---|
| 107 | |
---|
| 108 | Double posx = -3.8710235e6 ; |
---|
| 109 | Double posy = 3.4281068e6 ; |
---|
| 110 | Double posz = 3.7240395e6 ; |
---|
| 111 | MPosition p( MVPosition( posx, posy, posz ), |
---|
| 112 | MPosition::ITRF ) ; |
---|
| 113 | |
---|
[1757] | 114 | MeasFrame frame( p ) ; |
---|
| 115 | MVPosition mvp ; |
---|
| 116 | frame.getITRF( mvp ) ; |
---|
| 117 | Vector<Double> pp = mvp.getValue() ; |
---|
| 118 | vector<double> pos ; |
---|
| 119 | pp.tovector( pos ) ; |
---|
| 120 | //cout << "NRO45Reader::getAntennaPosition() pp[0] = " << pp[0] |
---|
| 121 | // << " pp[1] = " << pp[1] << " pp[2] = " << pp[2] << endl ; |
---|
| 122 | |
---|
| 123 | return pos ; |
---|
| 124 | } |
---|
| 125 | |
---|
[2154] | 126 | Int NRO45Reader::getNumIF() |
---|
| 127 | { |
---|
| 128 | Int nif = 1 ; |
---|
| 129 | if ( (dataset_->getRX()[0]).find("MULT2-") == string::npos ) { |
---|
| 130 | vector<Bool> v ; |
---|
| 131 | vector<int> arry = dataset_->getARRY() ; |
---|
| 132 | for ( uInt i = 0 ; i < arry.size() ; i++ ) { |
---|
| 133 | if ( arry[i] != 0 ) { |
---|
| 134 | v.push_back( True ) ; |
---|
| 135 | } |
---|
| 136 | } |
---|
| 137 | nif = v.size() ; |
---|
| 138 | } |
---|
| 139 | return nif ; |
---|
| 140 | } |
---|
| 141 | |
---|
| 142 | Int NRO45Reader::getNumBeam() |
---|
| 143 | { |
---|
| 144 | Int nbeam = 25 ; |
---|
| 145 | if ( (dataset_->getRX()[0]).find("MULT2-") == string::npos ) { |
---|
| 146 | nbeam = 1 ; |
---|
| 147 | } |
---|
| 148 | return nbeam ; |
---|
| 149 | } |
---|