| 1 | //#---------------------------------------------------------------------------
|
|---|
| 2 | //# MBrecord.h: Class to store an MBFITS single-dish data record.
|
|---|
| 3 | //#---------------------------------------------------------------------------
|
|---|
| 4 | //# livedata - processing pipeline for single-dish, multibeam spectral data.
|
|---|
| 5 | //# Copyright (C) 2000-2009, Australia Telescope National Facility, CSIRO
|
|---|
| 6 | //#
|
|---|
| 7 | //# This file is part of livedata.
|
|---|
| 8 | //#
|
|---|
| 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
|
|---|
| 15 | //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|---|
| 16 | //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|---|
| 17 | //# more details.
|
|---|
| 18 | //#
|
|---|
| 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/>.
|
|---|
| 21 | //#
|
|---|
| 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
|
|---|
| 28 | //# AUSTRALIA
|
|---|
| 29 | //#
|
|---|
| 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 $
|
|---|
| 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 |
|
|---|
| 64 | // <summary>
|
|---|
| 65 | // Class to store an MBFITS single-dish data record.
|
|---|
| 66 | // </summary>
|
|---|
| 67 |
|
|---|
| 68 | class MBrecord
|
|---|
| 69 | {
|
|---|
| 70 | public:
|
|---|
| 71 | // Default constructor allocates arrays for the required number of IFs.
|
|---|
| 72 | MBrecord(int nIF = 0);
|
|---|
| 73 |
|
|---|
| 74 | // Destructor; deletes any storage that may have been auto-allocated by
|
|---|
| 75 | // the assignment operator.
|
|---|
| 76 | ~MBrecord();
|
|---|
| 77 |
|
|---|
| 78 | // Expand arrays if necessary to accomodate the required number of IFs.
|
|---|
| 79 | void setNIFs(int nIF);
|
|---|
| 80 |
|
|---|
| 81 | // Ensure there is enough storage for the specified number of spectral
|
|---|
| 82 | // products (channels x polarizations) for IF with array index iif (i.e.
|
|---|
| 83 | // the actual IF number is IFno[iif]). Expands arrays if necessary but
|
|---|
| 84 | // never contracts.
|
|---|
| 85 | void allocate(int iIF, int nprod, int nxpol);
|
|---|
| 86 |
|
|---|
| 87 | // Free all allocate()'d storage.
|
|---|
| 88 | void free();
|
|---|
| 89 |
|
|---|
| 90 | // The assignment operator does a deep copy and will auto-allocate or
|
|---|
| 91 | // re-allocate data storage if necessary.
|
|---|
| 92 | MBrecord &operator=(const MBrecord &other);
|
|---|
| 93 |
|
|---|
| 94 | // Extract a selected IF from a MBrecord into another.
|
|---|
| 95 | int extract(const MBrecord &other, int iIF);
|
|---|
| 96 |
|
|---|
| 97 | int scanNo; // Scan number.
|
|---|
| 98 | int cycleNo; // Integration cycle number.
|
|---|
| 99 | char datobs[12]; // Date of observation YYYY-MM-DD.
|
|---|
| 100 | double utc; // UTC of the integration, s.
|
|---|
| 101 | float exposure; // Integration time, s.
|
|---|
| 102 | char srcName[20]; // Source name.
|
|---|
| 103 | double srcRA; // Source J2000 right ascension, radian.
|
|---|
| 104 | double srcDec; // Source J2000 declination, radian.
|
|---|
| 105 | double restFreq; // Line rest frequency, Hz.
|
|---|
| 106 | char obsType[16]; // Two-letter observation type codes.
|
|---|
| 107 |
|
|---|
| 108 | // Beam-dependent parameters.
|
|---|
| 109 | short beamNo; // Multibeam beam number.
|
|---|
| 110 | double ra; // J2000 right ascension, radian.
|
|---|
| 111 | double dec; // J2000 declination, radian,
|
|---|
| 112 | int pCode; // Pointing problem code:
|
|---|
| 113 | // 1: position and timestamp unchanged,
|
|---|
| 114 | // 2: position changed but not timestamp,
|
|---|
| 115 | // 3: position and timestamp are rubbish,
|
|---|
| 116 | // 4: timestamp/1000 scale error (repaired),
|
|---|
| 117 | // 5: timestamp late by 1.0 sec (repaired),
|
|---|
| 118 | // 6: timestamp late by 0.5 sec (repaired).
|
|---|
| 119 | float rateAge; // Scan rate age (staleness), s.
|
|---|
| 120 | float raRate; // Scan rate in right ascension, radian/s.
|
|---|
| 121 | float decRate; // Scan rate in declination, radian/s.
|
|---|
| 122 | float paRate; // Rate of change of position angle, radian/s.
|
|---|
| 123 |
|
|---|
| 124 | // IF-dependent parameters.
|
|---|
| 125 | short nIF; // Number of IFs.
|
|---|
| 126 | short *IFno; // IF number.
|
|---|
| 127 | int *nChan; // Number of channels.
|
|---|
| 128 | int *nPol; // Number of polarizations.
|
|---|
| 129 | float *fqRefPix; // Frequency reference pixel.
|
|---|
| 130 | double *fqRefVal; // Frequency reference value, Hz.
|
|---|
| 131 | double *fqDelt; // Frequency separation between channels, Hz.
|
|---|
| 132 | float (*tsys)[2]; // Tsys for each polarization, Jy.
|
|---|
| 133 | float (*calfctr)[2]; // Calibration factor for each polarization.
|
|---|
| 134 | float (*xcalfctr)[2]; // Calibration factor for cross-polarizations.
|
|---|
| 135 | int haveBase; // Are baseline parameters present?
|
|---|
| 136 | float (*baseLin)[2][2]; // Linear baseline fit for each polarization.
|
|---|
| 137 | float (*baseSub)[2][24]; // Polynomial baseline subtracted.
|
|---|
| 138 | int haveSpectra; // Is spectral data present?
|
|---|
| 139 | float* *spectra; // Spectra for each polarization, Jy.
|
|---|
| 140 | unsigned char* *flagged; // Channel flagging, 0 = good, else bad.
|
|---|
| 141 | float* *xpol; // Cross polarization spectra (if any).
|
|---|
| 142 |
|
|---|
| 143 | // Only present for Parkes Multibeam or LBA data after 1997/02/02.
|
|---|
| 144 | float (*tcal)[2]; // Tcal for each polarization.
|
|---|
| 145 |
|
|---|
| 146 | // Extra syscal data available for Parkes Multibeam observations only.
|
|---|
| 147 | int extraSysCal; // Is this extra SysCal data available?
|
|---|
| 148 |
|
|---|
| 149 | float azimuth; // Azimuth, radian.
|
|---|
| 150 | float elevation; // Elevation, radian.
|
|---|
| 151 | float parAngle; // Parallactic angle, radian.
|
|---|
| 152 |
|
|---|
| 153 | float focusAxi; // Axial focus position, m.
|
|---|
| 154 | float focusTan; // Focus platform translation, m.
|
|---|
| 155 | float focusRot; // Focus rotation, radian.
|
|---|
| 156 |
|
|---|
| 157 | float temp; // Temperature, C.
|
|---|
| 158 | float pressure; // Pressure, Pa.
|
|---|
| 159 | float humidity; // Relative humidity, %.
|
|---|
| 160 | float windSpeed; // Wind speed, m/s.
|
|---|
| 161 | float windAz; // Wind azimuth, radian.
|
|---|
| 162 |
|
|---|
| 163 | char tcalTime[20]; // Time of measurement of cal signals.
|
|---|
| 164 |
|
|---|
| 165 | short refBeam; // Reference beam, in beam-switching (MX)
|
|---|
| 166 | // mode (added 1999/03/17).
|
|---|
| 167 | int polNo ; // polarization ID
|
|---|
| 168 | double srcVelocity ; // source velocity w.r.t. reference frame
|
|---|
| 169 |
|
|---|
| 170 | int srcType ; // source type
|
|---|
| 171 |
|
|---|
| 172 | private:
|
|---|
| 173 | int cNIF; // Number of IFs allocated.
|
|---|
| 174 | int* cNProd; // Storage allocated for data.
|
|---|
| 175 | int* cNXPol; // Storage allocated for xpol.
|
|---|
| 176 | };
|
|---|
| 177 |
|
|---|
| 178 | #endif
|
|---|