LCOV - code coverage report
Current view: top level - synthesis/CalTables - CalTable.h (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 14 0.0 %
Date: 2024-10-28 15:53:10 Functions: 0 11 0.0 %

          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_CALTABLE_H
      30             : #define CALIBRATION_CALTABLE_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/tables/Tables/TableRecord.h>
      36             : #include <casacore/casa/Containers/Record.h>
      37             : #include <casacore/casa/Utilities/Sort.h>
      38             : #include <synthesis/CalTables/CalTableDesc.h>
      39             : #include <synthesis/CalTables/CalMainRecord.h>
      40             : #include <synthesis/CalTables/CalDescRecord.h>
      41             : #include <synthesis/CalTables/CalHistRecord.h>
      42             : 
      43             : namespace casa { //# NAMESPACE CASA - BEGIN
      44             : 
      45             : // <summary> 
      46             : // CalTable: Calibration table access and creation
      47             : // </summary>
      48             : 
      49             : // <use visibility=export>
      50             : 
      51             : // <reviewed reviewer="" date="" tests="" demos="">
      52             : 
      53             : // <prerequisite>
      54             : //   <li> <linkto class="CalTableDesc">CalTableDesc</linkto> module
      55             : // </prerequisite>
      56             : //
      57             : // <etymology>
      58             : // From "calibration" and "table".
      59             : // </etymology>
      60             : //
      61             : // <synopsis>
      62             : // The CalTable classes provide basic access to calibration tables. This 
      63             : // includes the creation of calibration tables, sorting and selection
      64             : // capabilities, and basic data access. Specializations for baseline-based,
      65             : // time-variable and solvable VisJones types, and sub-types, are provided 
      66             : // through inheritance.
      67             : // </etymology>
      68             : //
      69             : // <example>
      70             : // <srcblock>
      71             : // </srcblock>
      72             : // </example>
      73             : //
      74             : // <motivation>
      75             : // This class is used by other calibration table accessors and iterators.
      76             : // </motivation>
      77             : //
      78             : // <todo asof="98/01/01">
      79             : // (i) Generic synthesis selection
      80             : // </todo>
      81             : 
      82             : class CalTable
      83             : {
      84             :  public:
      85             :    // Default null constructor, and destructor
      86             :    CalTable();
      87             :    virtual ~CalTable();
      88             : 
      89             :    // Construct from a specified table name, calibration table descriptor 
      90             :    // and table access option. Used for creating new tables.
      91             :    CalTable (const casacore::String& tableName, CalTableDesc& ctableDesc,
      92             :              casacore::Table::TableOption access = casacore::Table::New);
      93             : 
      94             :    // Construct from a specified table name, and access option. Used
      95             :    // for accessing existing tables.
      96             :    CalTable (const casacore::String& tableName, casacore::Table::TableOption access = casacore::Table::Old);
      97             : 
      98             :    // Construct from an existing table object
      99             :    CalTable (const casacore::Table& table);
     100             : 
     101             :    // Copy constructor
     102             :    CalTable (const CalTable& other);
     103             : 
     104             :    // Assignment operator
     105             :    CalTable& operator= (const CalTable& other);
     106             : 
     107             :    // casacore::Sort (cal_main)
     108             :    CalTable sort (const casacore::Block <casacore::String>& columnNames, 
     109             :                   casacore::Sort::Order order = casacore::Sort::Ascending,
     110             :                   casacore::Sort::Option option = casacore::Sort::HeapSort); 
     111             : 
     112             :    // casacore::Sort (cal_main) IN PLACE
     113             :    void sort2 (const casacore::Block <casacore::String>& columnNames, 
     114             :               casacore::Sort::Order order = casacore::Sort::Ascending,
     115             :               casacore::Sort::Option option = casacore::Sort::HeapSort); 
     116             : 
     117             :    // Apply selection to the calibration table 
     118             :    CalTable select (const casacore::String& calSelect);
     119             : 
     120             :    // Apply selection to the calibration table  IN PLACE
     121             :    void select2 (const casacore::String& calSelect);
     122             : 
     123             :    // Return number of rows in cal_main, cal_desc or cal_history
     124             :    casacore::Int nRowMain() const;
     125             :    casacore::Int nRowDesc() const;
     126             :    casacore::Int nRowHistory() const;
     127             :    casacore::Int nRowObservation() 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           0 :    void addRowHistory (casacore::uInt nrrow = 1, casacore::Bool initialize = false)
     135           0 :      {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             :    casacore::Record getRowObservation (const casacore::Int& jrow);
     142             : 
     143             :    // Put a row to cal_main, cal_desc or cal_history
     144             :    void putRowMain (const casacore::Int& jrow, CalMainRecord& tableRec);
     145             :    void putRowDesc (const casacore::Int& jrow, CalDescRecord& tableRec);
     146             :    void putRowHistory (const casacore::Int& jrow, CalHistoryRecord& tableRec);
     147             : 
     148             :    // Return the maximum antenna number in the table
     149             :    virtual casacore::Int maxAntenna();
     150             : 
     151             :    // Return the number of unique time slots in the table
     152             :    casacore::Int numberTimeSlots (const casacore::Double& fracError);
     153             : 
     154             :    // Return the number of rows per CalDescId
     155             :    void rowsPerCalDescId(casacore::Vector<casacore::Int>& rowspercdi);
     156             : 
     157           0 :    const casacore::String tableName() { return calMainAsTable().tableName(); }
     158             : 
     159           0 :    const casacore::String type() { return calMainAsTable().tableInfo().subType(); }
     160             : 
     161             :  protected:
     162             :    // Create a new table
     163             :    void createCalTable (const casacore::String& tableName, CalTableDesc& ctableDesc,
     164             :                         casacore::Table::TableOption access = casacore::Table::New);
     165             : 
     166             :    // Open an existing table
     167             :    void openCalTable (const casacore::String& tableName, 
     168             :                       casacore::Table::TableOption access = casacore::Table::Old);
     169             : 
     170             :    // Return cal_main and sub-tables as casacore::Table references
     171           0 :    casacore::Table& calMainAsTable() {return *itsMainTable;};
     172           0 :    casacore::Table& calDescAsTable() {return *itsDescTable;};
     173           0 :    casacore::Table& calHistoryAsTable() {return *itsHistoryTable;};
     174             :    casacore::Table& calObservationAsTable() {return *itsObservationTable;};
     175           0 :    const casacore::Table& calMainAsTable() const {return *itsMainTable;};
     176           0 :    const casacore::Table& calDescAsTable() const {return *itsDescTable;};
     177           0 :    const casacore::Table& calHistoryAsTable() const {return *itsHistoryTable;};
     178             :    const casacore::Table& calObservationAsTable() const {return *itsObservationTable;};
     179             : 
     180             :    // Friend class access from the ROCalMainColumns, ROCalDescColumns
     181             :    // and ROCalHistoryColumns class hierarchies
     182             :    friend class ROCalMainColumns;
     183             :    friend class CalMainColumns;
     184             :    friend class ROCalDescColumns;
     185             :    friend class CalDescColumns;
     186             :    friend class ROCalHistoryColumns;
     187             :    friend class CalHistoryColumns;
     188             : 
     189             :  private:
     190             :    // Pointer to underlying cal_main casacore::Table object
     191             :    casacore::Table* itsMainTable;
     192             : 
     193             :    // Pointers to the cal_desc and cal_history sub-tables
     194             :    casacore::Table* itsDescTable;
     195             :    casacore::Table* itsHistoryTable;
     196             :    casacore::Table* itsObservationTable;
     197             : 
     198             :    // Check if has optional OBSERVATION Table
     199           0 :    bool hasObsTable() const { 
     200           0 :      return (itsMainTable->keywordSet().fieldNumber("OBSERVATION") != -1); }
     201             :  };
     202             : 
     203             : 
     204             : } //# NAMESPACE CASA - END
     205             : 
     206             : #endif
     207             :    

Generated by: LCOV version 1.16