Line data Source code
1 : //# CASA - Common Astronomy Software Applications (http://casa.nrao.edu/) 2 : //# Copyright (C) Associated Universities, Inc. Washington DC, USA 2011, All rights reserved. 3 : //# Copyright (C) European Southern Observatory, 2011, All rights reserved. 4 : //# 5 : //# This library is free software; you can redistribute it and/or 6 : //# modify it under the terms of the GNU Lesser General Public 7 : //# License as published by the Free software Foundation; either 8 : //# version 2.1 of the License, or (at your option) any later version. 9 : //# 10 : //# This library is distributed in the hope that it will be useful, 11 : //# but WITHOUT ANY WARRANTY, without even the implied warranty of 12 : //# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 : //# Lesser General Public License for more details. 14 : //# 15 : //# You should have received a copy of the GNU Lesser General Public 16 : //# License along with this library; if not, write to the Free Software 17 : //# Foundation, Inc., 59 Temple Place, Suite 330, Boston, 18 : //# MA 02111-1307 USA 19 : 20 : #ifndef STATWTTYPES_H_ 21 : #define STATWTTYPES_H_ 22 : 23 : namespace casa { 24 : 25 : namespace vi { 26 : 27 : // Only StatWt needs to use this; developers should not use this code directly. 28 : // Shared types among StatWt classes. 29 : 30 : class StatWtTypes { 31 : 32 : public: 33 : 34 : using Baseline = std::pair<casacore::uInt, casacore::uInt>; 35 : 36 : struct ChanBin { 37 : casacore::uInt start = 0; 38 : casacore::uInt end = 0; 39 : 40 3001731 : bool operator<(const ChanBin& other) const { 41 3001731 : if (start < other.start) { 42 887934 : return true; 43 : } 44 2113797 : if (start == other.start && end < other.end) { 45 0 : return true; 46 : } 47 2113797 : return false; 48 : } 49 : }; 50 : 51 : enum Column { 52 : // column(s) to use 53 : // DATA 54 : DATA, 55 : // CORRECTED_DATA 56 : CORRECTED, 57 : // CORRECTED_DATA - MODEL_DATA 58 : RESIDUAL, 59 : // DATA - MODEL_DATA 60 : RESIDUAL_DATA 61 : }; 62 : 63 46 : static casacore::String asString(Column col) { 64 46 : switch (col) { 65 1 : case DATA: 66 1 : return "DATA"; 67 37 : case CORRECTED: 68 37 : return "CORRECTED_DATA"; 69 2 : case RESIDUAL: 70 2 : return "CORRECTED_DATA - MODEL_DATA"; 71 6 : case RESIDUAL_DATA: 72 6 : return "DATA - MODEL_DATA"; 73 0 : default: 74 0 : ThrowCc("Unhandled column"); 75 : } 76 : } 77 : 78 : struct BaselineChanBin { 79 : Baseline baseline = std::make_pair(0, 0); 80 : casacore::uInt spw = 0; 81 : vi::StatWtTypes::ChanBin chanBin; 82 5375662 : bool operator<(const BaselineChanBin& other) const { 83 5375662 : if (baseline < other.baseline) { 84 1731099 : return true; 85 : } 86 3644563 : if (baseline == other.baseline && spw < other.spw) { 87 0 : return true; 88 : } 89 6646294 : return baseline == other.baseline && spw == other.spw 90 6646294 : && chanBin < other.chanBin; 91 : }; 92 : }; 93 : 94 : }; 95 : 96 : } 97 : 98 : } 99 : 100 : #endif 101 :