[1452] | 1 | //#---------------------------------------------------------------------------
|
---|
| 2 | //# MBrecord.h: Class to store an MBFITS single-dish data record.
|
---|
| 3 | //#---------------------------------------------------------------------------
|
---|
[1720] | 4 | //# livedata - processing pipeline for single-dish, multibeam spectral data.
|
---|
| 5 | //# Copyright (C) 2000-2009, Australia Telescope National Facility, CSIRO
|
---|
[1452] | 6 | //#
|
---|
[1720] | 7 | //# This file is part of livedata.
|
---|
[1452] | 8 | //#
|
---|
[1720] | 9 | //# livedata is free software: you can redistribute it and/or modify it under
|
---|
| 10 | //# the terms of the GNU General Public License as published by the Free
|
---|
| 11 | //# Software Foundation, either version 3 of the License, or (at your option)
|
---|
| 12 | //# any later version.
|
---|
| 13 | //#
|
---|
| 14 | //# livedata is distributed in the hope that it will be useful, but WITHOUT
|
---|
[1452] | 15 | //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
---|
[1720] | 16 | //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
---|
| 17 | //# more details.
|
---|
[1452] | 18 | //#
|
---|
[1720] | 19 | //# You should have received a copy of the GNU General Public License along
|
---|
| 20 | //# with livedata. If not, see <http://www.gnu.org/licenses/>.
|
---|
[1452] | 21 | //#
|
---|
[1720] | 22 | //# Correspondence concerning livedata may be directed to:
|
---|
| 23 | //# Internet email: mcalabre@atnf.csiro.au
|
---|
| 24 | //# Postal address: Dr. Mark Calabretta
|
---|
| 25 | //# Australia Telescope National Facility, CSIRO
|
---|
| 26 | //# PO Box 76
|
---|
| 27 | //# Epping NSW 1710
|
---|
[1452] | 28 | //# AUSTRALIA
|
---|
| 29 | //#
|
---|
[1720] | 30 | //# http://www.atnf.csiro.au/computing/software/livedata.html
|
---|
| 31 | //# $Id: MBrecord.h,v 19.16 2009-09-29 07:33:38 cal103 Exp $
|
---|
[1452] | 32 | //#---------------------------------------------------------------------------
|
---|
| 33 | //# The MBrecord class stores an MBFITS single-dish data record.
|
---|
| 34 | //#
|
---|
| 35 | //# Storage for spectral data may be managed in either of two ways:
|
---|
| 36 | //#
|
---|
| 37 | //# 1) The allocate() member function may be used to allocate storage that
|
---|
| 38 | //# is subsequently managed by the MBrecord class; the assignment
|
---|
| 39 | //# operator automatically deletes and reallocates more if insufficient
|
---|
| 40 | //# was provided, and the MBrecord destructor deletes it.
|
---|
| 41 | //#
|
---|
| 42 | //# Allocation of storage for cross-polarization data is optional.
|
---|
| 43 | //#
|
---|
| 44 | //# 2) In some cases it may be desirable for the user to provide storage via
|
---|
| 45 | //# the 'spectra', and 'flagged' (and 'xpol') variables in order to avoid
|
---|
| 46 | //# in-core copying. It is assumed that space has been provided for at
|
---|
| 47 | //# least nChan*nPol floats for 'spectra', nChan*nPol unsigned chars for
|
---|
| 48 | //# 'flagged', and 2*nChan floats for 'xpol'. This storage will not be
|
---|
| 49 | //# reassigned by the assignment operator nor deleted by the destructor.
|
---|
| 50 | //#
|
---|
| 51 | //# The two methods may not be mixed; allocate() checks that either
|
---|
| 52 | //#
|
---|
| 53 | //# a) the 'spectra', 'flagged', and 'xpol' variables are null pointers,
|
---|
| 54 | //#
|
---|
| 55 | //# b) storage was previously allocated via allocate().
|
---|
| 56 | //#
|
---|
| 57 | //# Original: 2000/08/01 Mark Calabretta, ATNF
|
---|
| 58 | //#---------------------------------------------------------------------------
|
---|
| 59 |
|
---|
| 60 | #ifndef ATNF_MBRECORD_H
|
---|
| 61 | #define ATNF_MBRECORD_H
|
---|
| 62 |
|
---|
| 63 | using namespace std;
|
---|
| 64 |
|
---|
| 65 | // <summary>
|
---|
| 66 | // Class to store an MBFITS single-dish data record.
|
---|
| 67 | // </summary>
|
---|
| 68 |
|
---|
| 69 | class MBrecord
|
---|
| 70 | {
|
---|
| 71 | public:
|
---|
| 72 | // Default constructor allocates arrays for the required number of IFs.
|
---|
| 73 | MBrecord(int nIF = 0);
|
---|
| 74 |
|
---|
| 75 | // Destructor; deletes any storage that may have been auto-allocated by
|
---|
| 76 | // the assignment operator.
|
---|
| 77 | ~MBrecord();
|
---|
| 78 |
|
---|
| 79 | // Expand arrays if necessary to accomodate the required number of IFs.
|
---|
| 80 | void setNIFs(int nIF);
|
---|
| 81 |
|
---|
| 82 | // Ensure there is enough storage for the specified number of spectral
|
---|
| 83 | // products (channels x polarizations) for IF with array index iif (i.e.
|
---|
| 84 | // the actual IF number is IFno[iif]). Expands arrays if necessary but
|
---|
| 85 | // never contracts.
|
---|
| 86 | void allocate(int iIF, int nprod, int nxpol);
|
---|
| 87 |
|
---|
| 88 | // Free all allocate()'d storage.
|
---|
| 89 | void free();
|
---|
| 90 |
|
---|
| 91 | // The assignment operator does a deep copy and will auto-allocate or
|
---|
| 92 | // re-allocate data storage if necessary.
|
---|
| 93 | MBrecord &operator=(const MBrecord &other);
|
---|
| 94 |
|
---|
| 95 | // Extract a selected IF from a MBrecord into another.
|
---|
| 96 | int extract(const MBrecord &other, int iIF);
|
---|
| 97 |
|
---|
| 98 | int scanNo; // Scan number.
|
---|
| 99 | int cycleNo; // Integration cycle number.
|
---|
| 100 | char datobs[12]; // Date of observation YYYY-MM-DD.
|
---|
| 101 | double utc; // UTC of the integration, s.
|
---|
| 102 | float exposure; // Integration time, s.
|
---|
| 103 | char srcName[20]; // Source name.
|
---|
| 104 | double srcRA; // Source J2000 right ascension, radian.
|
---|
| 105 | double srcDec; // Source J2000 declination, radian.
|
---|
| 106 | double restFreq; // Line rest frequency, Hz.
|
---|
| 107 | char obsType[16]; // Two-letter observation type codes.
|
---|
| 108 |
|
---|
| 109 | // Beam-dependent parameters.
|
---|
| 110 | short beamNo; // Multibeam beam number.
|
---|
| 111 | double ra; // J2000 right ascension, radian.
|
---|
| 112 | double dec; // J2000 declination, radian,
|
---|
| 113 | int pCode; // Pointing problem code:
|
---|
| 114 | // 1: position and timestamp unchanged,
|
---|
| 115 | // 2: position changed but not timestamp,
|
---|
| 116 | // 3: position and timestamp are rubbish,
|
---|
| 117 | // 4: timestamp/1000 scale error (repaired),
|
---|
| 118 | // 5: timestamp late by 1.0 sec (repaired),
|
---|
| 119 | // 6: timestamp late by 0.5 sec (repaired).
|
---|
| 120 | float rateAge; // Scan rate age (staleness), s.
|
---|
| 121 | float raRate; // Scan rate in right ascension, radian/s.
|
---|
| 122 | float decRate; // Scan rate in declination, radian/s.
|
---|
| 123 | float paRate; // Rate of change of position angle, radian/s.
|
---|
| 124 |
|
---|
| 125 | // IF-dependent parameters.
|
---|
| 126 | short nIF; // Number of IFs.
|
---|
| 127 | short *IFno; // IF number.
|
---|
| 128 | int *nChan; // Number of channels.
|
---|
| 129 | int *nPol; // Number of polarizations.
|
---|
| 130 | float *fqRefPix; // Frequency reference pixel.
|
---|
| 131 | double *fqRefVal; // Frequency reference value, Hz.
|
---|
| 132 | double *fqDelt; // Frequency separation between channels, Hz.
|
---|
| 133 | float (*tsys)[2]; // Tsys for each polarization, Jy.
|
---|
| 134 | float (*calfctr)[2]; // Calibration factor for each polarization.
|
---|
| 135 | float (*xcalfctr)[2]; // Calibration factor for cross-polarizations.
|
---|
| 136 | int haveBase; // Are baseline parameters present?
|
---|
| 137 | float (*baseLin)[2][2]; // Linear baseline fit for each polarization.
|
---|
[1635] | 138 | float (*baseSub)[2][24]; // Polynomial baseline subtracted.
|
---|
[1452] | 139 | int haveSpectra; // Is spectral data present?
|
---|
| 140 | float* *spectra; // Spectra for each polarization, Jy.
|
---|
| 141 | unsigned char* *flagged; // Channel flagging, 0 = good, else bad.
|
---|
| 142 | float* *xpol; // Cross polarization spectra (if any).
|
---|
| 143 |
|
---|
| 144 | // Only present for Parkes Multibeam or LBA data after 1997/02/02.
|
---|
| 145 | float (*tcal)[2]; // Tcal for each polarization.
|
---|
| 146 |
|
---|
| 147 | // Extra syscal data available for Parkes Multibeam observations only.
|
---|
| 148 | int extraSysCal; // Is this extra SysCal data available?
|
---|
| 149 |
|
---|
| 150 | float azimuth; // Azimuth, radian.
|
---|
| 151 | float elevation; // Elevation, radian.
|
---|
| 152 | float parAngle; // Parallactic angle, radian.
|
---|
| 153 |
|
---|
| 154 | float focusAxi; // Axial focus position, m.
|
---|
| 155 | float focusTan; // Focus platform translation, m.
|
---|
| 156 | float focusRot; // Focus rotation, radian.
|
---|
| 157 |
|
---|
| 158 | float temp; // Temperature, C.
|
---|
| 159 | float pressure; // Pressure, Pa.
|
---|
| 160 | float humidity; // Relative humidity, %.
|
---|
| 161 | float windSpeed; // Wind speed, m/s.
|
---|
| 162 | float windAz; // Wind azimuth, radian.
|
---|
| 163 |
|
---|
| 164 | char tcalTime[20]; // Time of measurement of cal signals.
|
---|
| 165 |
|
---|
| 166 | short refBeam; // Reference beam, in beam-switching (MX)
|
---|
| 167 | // mode (added 1999/03/17).
|
---|
[1757] | 168 | int polNo ; // polarization ID
|
---|
[1868] | 169 | double srcVelocity ; // source velocity w.r.t. reference frame
|
---|
[1452] | 170 |
|
---|
[1868] | 171 | int srcType ; // source type
|
---|
| 172 |
|
---|
[1452] | 173 | private:
|
---|
| 174 | int cNIF; // Number of IFs allocated.
|
---|
| 175 | int* cNProd; // Storage allocated for data.
|
---|
| 176 | int* cNXPol; // Storage allocated for xpol.
|
---|
| 177 | };
|
---|
| 178 |
|
---|
| 179 | #endif
|
---|