source: trunk/src/SDMemTable.h @ 21

Last change on this file since 21 was 21, checked in by mmarquar, 20 years ago

Added retrieval functions for SDHeader and SDContainer.

  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
File size: 4.5 KB
RevLine 
[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
43namespace atnf_sd {
44
45class SDContainer;
46class SDHeader;
47class SDFrequencyTable;
48
49
50class SDMemTable {
51public:
[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) {;}
[21]71
72  //get the dat wrapped up in a meta container
73  virtual SDContainer getSDContainer(uInt whichRow=0) const;
74  virtual SDHeader getSDHeader() const;
[2]75 
[19]76  // get spectrum,mask and tsys for the given row, at the selected
[21]77  // cursor - all as stl vectors
78  virtual std::vector<float> getSpectrum(Int whichRow);
[16]79  virtual std::vector<bool> getMask(Int whichRow) const;
[21]80
[19]81  virtual Float getTsys(Int whichRow) const;
[21]82  // get all as aips++ Vectors
83  virtual void getSpectrum(Vector<Float>& spectrum, Int whichRow=0);
84  virtual void getMask(Vector<Bool>& mask,Int whichRow=0) const;
[2]85
[21]86  // get info for current row
[2]87  virtual Double getTime(Int whichRow) const ;
[19]88  virtual std::string getSourceName(Int whichRow) const;
[2]89 
[19]90  // set the current value
[2]91  virtual bool setIF(Int whichIF=0);
92  virtual bool setBeam(Int whichBeam=0);
93  virtual bool setPol(Int whichPol=0);   
[18]94  //sets the user mask
95  virtual bool setMask(const std::vector<int>& whichChans);
96 
[19]97  // return the currently selected values
[2]98  virtual Int getIF() { return IFSel_; }
99  virtual Int getBeam() { return beamSel_; }
100  virtual Int getPol() { return polSel_; }   
[18]101 
[19]102  // print a summary to stdout
[2]103  virtual void summary() const;
104 
[19]105  // the (irrelevant) name
[2]106  std::string name() const;
[19]107
108  // write to disk as aips++ table
[2]109  void makePersistent(const std::string& filename);
[19]110
111  // get a new SDMemTable containg all rows with the same give SCANID
[2]112  SDMemTable getScan(Int scanID);
[18]113
[21]114  const TableRecord& getHeader() const {return table_.keywordSet();}
[19]115  // get a handle to the "raw" aips++ table
[2]116  const Table& table() { return table_; }
117
[19]118  // return the number of values
[18]119  Int nBeam() const;
120  Int nIF() const;
121  Int nPol() const;
122  Int nChan() const;
123
[19]124  // return a row as a Masked array, internally converting uChar flags
125  // to bool mask
126  MaskedArray<Float> rowAsMaskedArray(uInt whichRow,
127                                      Bool useSelection = False);
128
[2]129private:
[19]130  // set up tabel structure
[2]131  void setup();
[19]132  // the current cursor into the array
[2]133  Int IFSel_,beamSel_,polSel_;
[19]134  std::vector<bool> chanMask_; 
[2]135  String name_;
[19]136  // the unerlying memory table
[2]137  Table table_;
138};
139
140}// namespace
141#endif
Note: See TracBrowser for help on using the repository browser.