Line data Source code
1 : //# CalTable.h: Calibration table access and creation 2 : //# Copyright (C) 1996,1997,1998,1999,2001,2002,2003 3 : //# Associated Universities, Inc. Washington DC, USA. 4 : //# 5 : //# This library is free software; you can redistribute it and/or modify it 6 : //# under the terms of the GNU Library General Public License as published by 7 : //# the Free Software Foundation; either version 2 of the License, or (at your 8 : //# option) any later version. 9 : //# 10 : //# This library is distributed in the hope that it will be useful, but WITHOUT 11 : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 12 : //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public 13 : //# License for more details. 14 : //# 15 : //# You should have received a copy of the GNU Library General Public License 16 : //# along with this library; if not, write to the Free Software Foundation, 17 : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA. 18 : //# 19 : //# Correspondence concerning AIPS++ should be adressed as follows: 20 : //# Internet email: casa-feedback@nrao.edu. 21 : //# Postal address: AIPS++ Project Office 22 : //# National Radio Astronomy Observatory 23 : //# 520 Edgemont Road 24 : //# Charlottesville, VA 22903-2475 USA 25 : //# 26 : //# 27 : //# $Id$ 28 : 29 : #ifndef CALIBRATION_CALTABLE2_H 30 : #define CALIBRATION_CALTABLE2_H 31 : 32 : #include <casacore/casa/aips.h> 33 : #include <casacore/tables/Tables/Table.h> 34 : #include <casacore/tables/TaQL/ExprNode.h> 35 : #include <casacore/casa/Containers/Record.h> 36 : #include <casacore/casa/Utilities/Sort.h> 37 : #include <synthesis/CalTables/CalTableDesc2.h> 38 : #include <synthesis/CalTables/CalMainRecord.h> 39 : #include <synthesis/CalTables/CalDescRecord.h> 40 : #include <synthesis/CalTables/CalHistRecord.h> 41 : 42 : namespace casa { //# NAMESPACE CASA - BEGIN 43 : 44 : // <summary> 45 : // CalTable: Calibration table access and creation 46 : // </summary> 47 : 48 : // <use visibility=export> 49 : 50 : // <reviewed reviewer="" date="" tests="" demos=""> 51 : 52 : // <prerequisite> 53 : // <li> <linkto class="CalTableDesc">CalTableDesc</linkto> module 54 : // </prerequisite> 55 : // 56 : // <etymology> 57 : // From "calibration" and "table". 58 : // </etymology> 59 : // 60 : // <synopsis> 61 : // The CalTable classes provide basic access to calibration tables. This 62 : // includes the creation of calibration tables, sorting and selection 63 : // capabilities, and basic data access. Specializations for baseline-based, 64 : // time-variable and solvable VisJones types, and sub-types, are provided 65 : // through inheritance. 66 : // </etymology> 67 : // 68 : // <example> 69 : // <srcblock> 70 : // </srcblock> 71 : // </example> 72 : // 73 : // <motivation> 74 : // This class is used by other calibration table accessors and iterators. 75 : // </motivation> 76 : // 77 : // <todo asof="98/01/01"> 78 : // (i) Generic synthesis selection 79 : // </todo> 80 : 81 : class CalTable2 82 : { 83 : public: 84 : // Default null constructor, and destructor 85 : CalTable2(); 86 : virtual ~CalTable2(); 87 : 88 : // Construct from a specified table name, calibration table descriptor 89 : // and table access option. Used for creating new tables. 90 : CalTable2(const casacore::String& tableName, CalTableDesc2& ctableDesc, 91 : casacore::Table::TableOption access = casacore::Table::New); 92 : 93 : // Construct from a specified table name, and access option. Used 94 : // for accessing existing tables. 95 : CalTable2(const casacore::String& tableName, casacore::Table::TableOption access = casacore::Table::Old); 96 : 97 : // Construct from an existing table object 98 : CalTable2(const casacore::Table& table); 99 : 100 : // Copy constructor 101 : CalTable2(const CalTable2& other); 102 : 103 : // 104 : casacore::Int parType() {return parType_;}; 105 : // Assignment operator 106 : CalTable2& operator= (const CalTable2& other); 107 : 108 : // casacore::Sort (cal_main) 109 : CalTable2 sort (const casacore::Block <casacore::String>& columnNames, 110 : casacore::Sort::Order order = casacore::Sort::Ascending, 111 : casacore::Sort::Option option = casacore::Sort::HeapSort); 112 : 113 : // casacore::Sort (cal_main) IN PLACE 114 : void sort2 (const casacore::Block <casacore::String>& columnNames, 115 : casacore::Sort::Order order = casacore::Sort::Ascending, 116 : casacore::Sort::Option option = casacore::Sort::HeapSort); 117 : 118 : // Apply selection to the calibration table 119 : CalTable2 select (const casacore::String& calSelect); 120 : 121 : // Apply selection to the calibration table IN PLACE 122 : void select2 (const casacore::String& calSelect); 123 : 124 : // Return number of rows in cal_main, cal_desc or cal_history 125 : casacore::Int nRowMain() const; 126 : casacore::Int nRowDesc() const; 127 : casacore::Int nRowHistory() const; 128 : 129 : // Add rows to cal_main, cal_desc or cal_history 130 0 : void addRowMain (casacore::uInt nrrow = 1, casacore::Bool initialize = false) 131 0 : {itsMainTable->addRow(nrrow, initialize);}; 132 : void addRowDesc (casacore::uInt nrrow = 1, casacore::Bool initialize = false) 133 : {itsDescTable->addRow(nrrow, initialize);}; 134 : void addRowHistory (casacore::uInt nrrow = 1, casacore::Bool initialize = false) 135 : {itsHistoryTable->addRow(nrrow, initialize);}; 136 : 137 : // Get a row from cal_main, cal_desc or cal_history 138 : casacore::Record getRowMain (const casacore::Int& jrow); 139 : casacore::Record getRowDesc (const casacore::Int& jrow); 140 : casacore::Record getRowHistory (const casacore::Int& jrow); 141 : 142 : // Put a row to cal_main, cal_desc or cal_history 143 : void putRowMain (const casacore::Int& jrow, CalMainRecord& tableRec); 144 : void putRowDesc (const casacore::Int& jrow, CalDescRecord& tableRec); 145 : void putRowHistory (const casacore::Int& jrow, CalHistoryRecord& tableRec); 146 : 147 : // Return the maximum antenna number in the table 148 : virtual casacore::Int maxAntenna(); 149 : 150 : // Return the number of unique time slots in the table 151 : casacore::Int numberTimeSlots (const casacore::Double& fracError); 152 : 153 : // Create a new table 154 : void createCalTable(const casacore::String& tableName, CalTableDesc2& ctableDesc, 155 : casacore::Table::TableOption access = casacore::Table::New); 156 : 157 : // Open an existing table 158 : void openCalTable(const casacore::String& tableName, 159 : casacore::Table::TableOption access = casacore::Table::Old); 160 : 161 : // Return cal_main and sub-tables as casacore::Table references 162 0 : casacore::Table& calMainAsTable() {return *itsMainTable;}; 163 0 : casacore::Table& calDescAsTable() {return *itsDescTable;}; 164 : casacore::Table& calHistoryAsTable() {return *itsHistoryTable;}; 165 0 : const casacore::Table& calMainAsTable() const {return *itsMainTable;}; 166 0 : const casacore::Table& calDescAsTable() const {return *itsDescTable;}; 167 : const casacore::Table& calHistoryAsTable() const {return *itsHistoryTable;}; 168 : protected: 169 : 170 : // Friend class access from the ROCalMainColumns, ROCalDescColumns 171 : // and ROCalHistoryColumns class hierarchies 172 : // friend class ROCalMainColumns2; 173 : // friend class CalMainColumns2; 174 : // friend class ROCalDescColumns2; 175 : // friend class CalDescColumns2; 176 : friend class ROCalHistoryColumns; 177 : friend class CalHistoryColumns; 178 : 179 : private: 180 : // Pointer to underlying cal_main casacore::Table object 181 : casacore::Table* itsMainTable; 182 : 183 : // Pointers to the cal_desc and cal_history sub-tables 184 : casacore::Table* itsDescTable; 185 : casacore::Table* itsHistoryTable; 186 : casacore::Int parType_; 187 : }; 188 : 189 : } //# NAMESPACE CASA - END 190 : 191 : #endif 192 :