1
/* DATAIO - FITS-IDI interface to PolConvert
3
Copyright (C) 2013 Ivan Marti-Vidal
4
Nordic Node of EU ALMA Regional Center (Onsala, Sweden)
5
Max-Planck-Institut fuer Radioastronomie (Bonn, Germany)
7
This program is free software: you can redistribute it and/or modify
8
it under the terms of the GNU General Public License as published by
9
the Free Software Foundation, either version 3 of the License, or
10
(at your option) any later version.
12
This program is distributed in the hope that it will be useful,
13
but WITHOUT ANY WARRANTY; without even the implied warranty of
14
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
GNU General Public License for more details.
17
You should have received a copy of the GNU General Public License
18
along with this program. If not, see <http://www.gnu.org/licenses/>
24
#include <sys/types.h>
44
DataIO::DataIO() { printf("\nCreating VLBI data structure");};
47
// SELF-EXPLANATORY FUNCTIONS:
48
int DataIO::getNfreqs() {return Nfreqs;}; // NUMBER OF IFs
49
int DataIO::getNant() {return Nants;}; // TOTAL NUMBER OF ANTENNAS
50
int DataIO::getNchan(int freqid) {return Freqs[freqid].Nchan;}; // # OF CHANNEL IN freqid IF
51
long DataIO::getMixedNvis() {return NLinVis;}; // NUMBER OF MIXED-POLARIZATION VISIBILITIES FOUND
55
// GET FREQUENCIES OF CURRENT IF:
56
void DataIO::getFrequencies(double* output){
57
memcpy(output,Freqvals[currFreq],Freqs[currFreq].Nchan*sizeof(double));
61
// CHECK WHETHER SOMETHING FAILED:
62
bool DataIO::succeed(){return success;};
65
// GET FIRST DAY OF OBSERVATION (MODIFIED JULIAN DATE)
66
double DataIO::getDay0(){return day0;};
74
void DataIO::getParAng(int sidx, int Ant1, int Ant2, double*UVW, double &P1, double &P2){
76
double V2, Bx, By, Bz;
77
double CH, SH, CT1, CT2, HAng, H1, H2;
81
if(sidx<Geometry->NtotSou && Ant1<Geometry->NtotAnt && Ant2<Geometry->NtotAnt){
83
V2 = Geometry->SinDec[sidx]*UVW[1] - Geometry->CosDec[sidx]*UVW[2];
84
ibas = Geometry->BasNum[Ant1][Ant2];
89
Bx = -Geometry->BaseLine[0][ibas];
90
By = -Geometry->BaseLine[1][ibas];
91
Bz = -Geometry->BaseLine[2][ibas];
93
Bx = Geometry->BaseLine[0][ibas];
94
By = Geometry->BaseLine[1][ibas];
95
Bz = Geometry->BaseLine[2][ibas];
98
CH = (UVW[0]*By - V2*Bx); // /(By**2. + Bx**2.);
99
SH = (UVW[0]*Bx + V2*By); // /(By**2. + Bx**2.);
100
CT1 = Geometry->CosDec[sidx]*tan(Geometry->Lat[Ant1]);
101
CT2 = Geometry->CosDec[sidx]*tan(Geometry->Lat[Ant2]);
104
H1 = HAng + Geometry->AntLon[Ant1];
105
H2 = HAng + Geometry->AntLon[Ant2];
107
P1 = atan2(sin(H1), CT1 - Geometry->SinDec[sidx]*cos(H1));
108
P2 = atan2(sin(H2), CT2 - Geometry->SinDec[sidx]*cos(H2));