[1325] | 1 | //#--------------------------------------------------------------------------- |
---|
| 2 | //# PKSMBrecord.h: Class to store an MBFITS single-dish data record. |
---|
| 3 | //#--------------------------------------------------------------------------- |
---|
| 4 | //# Copyright (C) 2000-2006 |
---|
| 5 | //# Mark Calabretta, ATNF |
---|
| 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 this software should be addressed as follows: |
---|
| 22 | //# Internet email: mcalabre@atnf.csiro.au. |
---|
| 23 | //# Postal address: Dr. Mark Calabretta, |
---|
| 24 | //# Australia Telescope National Facility, |
---|
| 25 | //# P.O. Box 76, |
---|
| 26 | //# Epping, NSW, 2121, |
---|
| 27 | //# AUSTRALIA |
---|
| 28 | //# |
---|
| 29 | //# $Id: PKSMBrecord.h,v 19.8 2006/07/05 04:52:07 mcalabre Exp $ |
---|
| 30 | //#--------------------------------------------------------------------------- |
---|
| 31 | //# The PKSMBrecord class stores an MBFITS single-dish data record. |
---|
| 32 | //# |
---|
| 33 | //# Storage for spectral data may be managed in either of two ways: |
---|
| 34 | //# |
---|
| 35 | //# 1) The allocate() member function may be used to allocate storage that |
---|
| 36 | //# is subsequently managed by the PKSMBrecord class; the assignment |
---|
| 37 | //# operator automatically deletes and reallocates more if insufficient |
---|
| 38 | //# was provided, and the PKSMBrecord destructor deletes it. |
---|
| 39 | //# |
---|
| 40 | //# Allocation of storage for cross-polarization data is optional. |
---|
| 41 | //# |
---|
| 42 | //# 2) In some cases it may be desirable for the user to provide storage via |
---|
| 43 | //# the 'spectra', and 'flagged' (and 'xpol') variables in order to avoid |
---|
| 44 | //# in-core copying. It is assumed that space has been provided for at |
---|
| 45 | //# least nChan*nPol floats for 'spectra', nChan*nPol unsigned chars for |
---|
| 46 | //# 'flagged', and 2*nChan floats for 'xpol'. This storage will not be |
---|
| 47 | //# reassigned by the assignment operator nor deleted by the destructor. |
---|
| 48 | //# |
---|
| 49 | //# The two methods may not be mixed; allocate() checks that either |
---|
| 50 | //# |
---|
| 51 | //# a) the 'spectra', 'flagged', and 'xpol' variables are null pointers, |
---|
| 52 | //# |
---|
| 53 | //# b) storage was previously allocated via allocate(). |
---|
| 54 | //# |
---|
| 55 | //# Original: 2000/08/01 Mark Calabretta, ATNF |
---|
| 56 | //#--------------------------------------------------------------------------- |
---|
| 57 | |
---|
| 58 | #ifndef ATNF_PKSMBRECORD_H |
---|
| 59 | #define ATNF_PKSMBRECORD_H |
---|
| 60 | |
---|
| 61 | // <summary> |
---|
| 62 | // Class to store an MBFITS single-dish data record. |
---|
| 63 | // </summary> |
---|
| 64 | |
---|
| 65 | class PKSMBrecord |
---|
| 66 | { |
---|
| 67 | public: |
---|
| 68 | // Default constructor allocates arrays for the required number of IFs. |
---|
| 69 | PKSMBrecord(int nIF = 0); |
---|
| 70 | |
---|
| 71 | // Destructor; deletes any storage that may have been auto-allocated by |
---|
| 72 | // the assignment operator. |
---|
| 73 | ~PKSMBrecord(); |
---|
| 74 | |
---|
| 75 | // Expand arrays if necessary to accomodate the required number of IFs. |
---|
| 76 | void setNIFs(int nIF); |
---|
| 77 | |
---|
| 78 | // Ensure there is enough storage for the specified number of spectral |
---|
| 79 | // products (channels x polarizations) for IF with array index iif (i.e. |
---|
| 80 | // the actual IF number is IFno[iif]). Expands arrays if necessary but |
---|
| 81 | // never contracts. |
---|
| 82 | void allocate(int iIF, int nprod, int nxpol); |
---|
| 83 | |
---|
| 84 | // Free all allocate()'d storage. |
---|
| 85 | void free(); |
---|
| 86 | |
---|
| 87 | // The assignment operator does a deep copy and will auto-allocate or |
---|
| 88 | // re-allocate data storage if necessary. |
---|
| 89 | PKSMBrecord &operator=(const PKSMBrecord &other); |
---|
| 90 | |
---|
| 91 | // Extract a selected IF from a PKSMBrecord into another. |
---|
| 92 | int extract(const PKSMBrecord &other, int iIF); |
---|
| 93 | |
---|
| 94 | int scanNo; // Scan number. |
---|
| 95 | int cycleNo; // Integration cycle number. |
---|
| 96 | char datobs[11]; // Date of observation YYYY-MM-DD. |
---|
| 97 | double utc; // UTC of the integration, s. |
---|
| 98 | float exposure; // Integration time, s. |
---|
| 99 | char srcName[17]; // Source name. |
---|
| 100 | double srcRA; // Source J2000 right ascension, radian. |
---|
| 101 | double srcDec; // Source J2000 declination, radian. |
---|
| 102 | double restFreq; // Line rest frequency, Hz. |
---|
| 103 | char obsType[16]; // Two-letter observation type codes. |
---|
| 104 | |
---|
| 105 | // Beam-dependent parameters. |
---|
| 106 | short beamNo; // Multibeam beam number. |
---|
| 107 | double ra; // J2000 right ascension, radian. |
---|
| 108 | double dec; // J2000 declination, radian, |
---|
| 109 | float raRate; // Scan rate in right ascension, radian/s. |
---|
| 110 | float decRate; // Scan rate in declination, radian/s. |
---|
| 111 | |
---|
| 112 | // IF-dependent parameters. |
---|
| 113 | short nIF; // Number of IFs. |
---|
| 114 | short *IFno; // IF number. |
---|
| 115 | int *nChan; // Number of channels. |
---|
| 116 | int *nPol; // Number of polarizations. |
---|
| 117 | float *fqRefPix; // Frequency reference pixel. |
---|
| 118 | double *fqRefVal; // Frequency reference value, Hz. |
---|
| 119 | double *fqDelt; // Frequency separation between channels, Hz. |
---|
| 120 | float (*tsys)[2]; // Tsys for each polarization, Jy. |
---|
| 121 | float (*calfctr)[2]; // Calibration factor for each polarization. |
---|
| 122 | float (*xcalfctr)[2]; // Calibration factor for cross-polarizations. |
---|
| 123 | int haveBase; // Are baseline parameters present? |
---|
| 124 | float (*baseLin)[2][2]; // Linear baseline fit for each polarization. |
---|
| 125 | float (*baseSub)[2][9]; // Polynomial baseline subtracted. |
---|
| 126 | int haveSpectra; // Is spectral data present? |
---|
| 127 | float* *spectra; // Spectra for each polarization, Jy. |
---|
| 128 | unsigned char* *flagged; // Channel flagging, 0 = good, else bad. |
---|
| 129 | float* *xpol; // Cross polarization spectra (if any). |
---|
| 130 | |
---|
| 131 | // Only present for Parkes Multibeam or LBA data after 1997/02/02. |
---|
| 132 | float (*tcal)[2]; // Tcal for each polarization. |
---|
| 133 | |
---|
| 134 | // Extra syscal data available for Parkes Multibeam observations only. |
---|
| 135 | int extraSysCal; // Is this extra SysCal data available? |
---|
| 136 | float azimuth; // Azimuth, radian. |
---|
| 137 | float elevation; // Elevation, radian. |
---|
| 138 | float parAngle; // Parallactic angle, radian. |
---|
| 139 | float focusAxi; // Axial focus position, m. |
---|
| 140 | float focusTan; // Focus platform translation, m. |
---|
| 141 | float focusRot; // Focus rotation, radian. |
---|
| 142 | float temp; // Temperature, C. |
---|
| 143 | float pressure; // Pressure, Pa. |
---|
| 144 | float humidity; // Relative humidity, %. |
---|
| 145 | float windSpeed; // Wind speed, m/s. |
---|
| 146 | float windAz; // Wind azimuth, radian. |
---|
| 147 | char tcalTime[17]; // Time of measurement of cal signals. |
---|
| 148 | short refBeam; // Reference beam, in beam-switching (MX) |
---|
| 149 | // mode, added 1999/03/17. |
---|
| 150 | |
---|
| 151 | private: |
---|
| 152 | int cNIF; // Number of IFs allocated. |
---|
| 153 | int* cNProd; // Storage allocated for data. |
---|
| 154 | int* cNXPol; // Storage allocated for xpol. |
---|
| 155 | }; |
---|
| 156 | |
---|
| 157 | #endif |
---|