[2] | 1 | //#--------------------------------------------------------------------------- |
---|
| 2 | //# SDMemTable.h: A MemoryTable container for single dish integrations |
---|
| 3 | //#--------------------------------------------------------------------------- |
---|
| 4 | //# Copyright (C) 2004 |
---|
| 5 | //# Malte Marquarding, ATNF |
---|
| 6 | //# |
---|
| 7 | //# This program is free software; you can redistribute it and/or modify it |
---|
| 8 | //# under the terms of the GNU General Public License as published by the Free |
---|
| 9 | //# Software Foundation; either version 2 of the License, or (at your option) |
---|
| 10 | //# any later version. |
---|
| 11 | //# |
---|
| 12 | //# This program is distributed in the hope that it will be useful, but |
---|
| 13 | //# WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
| 14 | //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General |
---|
| 15 | //# Public License for more details. |
---|
| 16 | //# |
---|
| 17 | //# You should have received a copy of the GNU General Public License along |
---|
| 18 | //# with this program; if not, write to the Free Software Foundation, Inc., |
---|
| 19 | //# 675 Massachusetts Ave, Cambridge, MA 02139, USA. |
---|
| 20 | //# |
---|
| 21 | //# Correspondence concerning this software should be addressed as follows: |
---|
| 22 | //# Internet email: Malte.Marquarding@csiro.au |
---|
| 23 | //# Postal address: Malte Marquarding, |
---|
| 24 | //# Australia Telescope National Facility, |
---|
| 25 | //# P.O. Box 76, |
---|
| 26 | //# Epping, NSW, 2121, |
---|
| 27 | //# AUSTRALIA |
---|
| 28 | //# |
---|
| 29 | //# $Id: |
---|
| 30 | //#--------------------------------------------------------------------------- |
---|
| 31 | #ifndef _SDMEMTABLE_H_ |
---|
| 32 | #define _SDMEMTABLE_H_ |
---|
| 33 | |
---|
| 34 | // STL |
---|
| 35 | #include <string> |
---|
| 36 | #include <vector> |
---|
| 37 | // AIPS++ |
---|
| 38 | #include <aips/aips.h> |
---|
| 39 | #include <aips/Utilities/String.h> |
---|
| 40 | #include <aips/Tables/Table.h> |
---|
| 41 | #include <aips/Arrays/MaskedArray.h> |
---|
| 42 | |
---|
| 43 | namespace atnf_sd { |
---|
| 44 | |
---|
| 45 | class SDContainer; |
---|
| 46 | class SDHeader; |
---|
| 47 | class SDFrequencyTable; |
---|
| 48 | |
---|
| 49 | |
---|
| 50 | class SDMemTable { |
---|
| 51 | public: |
---|
[19] | 52 | // create a new (empty) SDMemTable |
---|
[18] | 53 | SDMemTable(); |
---|
[19] | 54 | // create a SDMemTable from a )aips++) table on disk |
---|
[18] | 55 | SDMemTable(const std::string& name); |
---|
[19] | 56 | |
---|
| 57 | // Copy Construct a SDMemTable, if clear==True only header and |
---|
| 58 | // skeleton are copied, otherwise the whole table is copied. |
---|
[16] | 59 | SDMemTable(const SDMemTable& other, Bool clear=False); |
---|
[2] | 60 | |
---|
[19] | 61 | // Copy Construct a SDMemTable, give a scanid constraint |
---|
| 62 | // see also getScan() |
---|
[2] | 63 | SDMemTable(const Table& tab, Int scanID); |
---|
[19] | 64 | |
---|
[2] | 65 | virtual ~SDMemTable(); |
---|
[19] | 66 | |
---|
| 67 | // put data from meta conatiner into the table |
---|
[2] | 68 | virtual bool putSDContainer(const SDContainer& sdc); |
---|
[18] | 69 | virtual bool putSDHeader(const SDHeader& sdh); |
---|
[2] | 70 | virtual bool putSDFreqTable(const SDFrequencyTable& sdft) {;} |
---|
| 71 | |
---|
[19] | 72 | // get spectrum,mask and tsys for the given row, at the selected |
---|
| 73 | // cursor |
---|
[2] | 74 | virtual std::vector<float> getSpectrum(Int whichRow) const; |
---|
[16] | 75 | virtual std::vector<bool> getMask(Int whichRow) const; |
---|
[19] | 76 | virtual Float getTsys(Int whichRow) const; |
---|
[2] | 77 | |
---|
[19] | 78 | // get info fro current row |
---|
[2] | 79 | virtual Double getTime(Int whichRow) const ; |
---|
[19] | 80 | virtual std::string getSourceName(Int whichRow) const; |
---|
[2] | 81 | |
---|
[19] | 82 | // set the current value |
---|
[2] | 83 | virtual bool setIF(Int whichIF=0); |
---|
| 84 | virtual bool setBeam(Int whichBeam=0); |
---|
| 85 | virtual bool setPol(Int whichPol=0); |
---|
[18] | 86 | //sets the user mask |
---|
| 87 | virtual bool setMask(const std::vector<int>& whichChans); |
---|
| 88 | |
---|
[19] | 89 | // return the currently selected values |
---|
[2] | 90 | virtual Int getIF() { return IFSel_; } |
---|
| 91 | virtual Int getBeam() { return beamSel_; } |
---|
| 92 | virtual Int getPol() { return polSel_; } |
---|
[18] | 93 | |
---|
[19] | 94 | // print a summary to stdout |
---|
[2] | 95 | virtual void summary() const; |
---|
| 96 | |
---|
[19] | 97 | // the (irrelevant) name |
---|
[2] | 98 | std::string name() const; |
---|
[19] | 99 | |
---|
| 100 | // write to disk as aips++ table |
---|
[2] | 101 | void makePersistent(const std::string& filename); |
---|
[19] | 102 | |
---|
| 103 | // get a new SDMemTable containg all rows with the same give SCANID |
---|
[2] | 104 | SDMemTable getScan(Int scanID); |
---|
[18] | 105 | |
---|
| 106 | const TableRecord& getHeader() const {;} |
---|
[19] | 107 | // get a handle to the "raw" aips++ table |
---|
[2] | 108 | const Table& table() { return table_; } |
---|
| 109 | |
---|
[19] | 110 | // return the number of values |
---|
[18] | 111 | Int nBeam() const; |
---|
| 112 | Int nIF() const; |
---|
| 113 | Int nPol() const; |
---|
| 114 | Int nChan() const; |
---|
| 115 | |
---|
[19] | 116 | // return a row as a Masked array, internally converting uChar flags |
---|
| 117 | // to bool mask |
---|
| 118 | MaskedArray<Float> rowAsMaskedArray(uInt whichRow, |
---|
| 119 | Bool useSelection = False); |
---|
| 120 | |
---|
[2] | 121 | private: |
---|
[19] | 122 | // set up tabel structure |
---|
[2] | 123 | void setup(); |
---|
[19] | 124 | // the current cursor into the array |
---|
[2] | 125 | Int IFSel_,beamSel_,polSel_; |
---|
[19] | 126 | std::vector<bool> chanMask_; |
---|
[2] | 127 | String name_; |
---|
[19] | 128 | // the unerlying memory table |
---|
[2] | 129 | Table table_; |
---|
| 130 | }; |
---|
| 131 | |
---|
| 132 | }// namespace |
---|
| 133 | #endif |
---|