LCOV - code coverage report
Current view: top level - synthesis/CalTables - BJonesMBuf.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 207 0.0 %
Date: 2024-11-06 17:42:47 Functions: 0 21 0.0 %

          Line data    Source code
       1             : //# BJonesMBuf.cc: Implementation of BJonesMBuf.h
       2             : //# Copyright (C) 1996,1997,1998,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 addressed 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             : //# $Id$
      27             : //----------------------------------------------------------------------------
      28             : 
      29             : #include <synthesis/CalTables/BJonesMBuf.h>
      30             : #include <casacore/casa/Arrays/ArrayMath.h>
      31             : #include <casacore/tables/Tables/RefRows.h>
      32             : 
      33             : using namespace casacore;
      34             : namespace casa { //# NAMESPACE CASA - BEGIN
      35             : 
      36             : //----------------------------------------------------------------------------
      37             : 
      38           0 : BJonesMBuf::BJonesMBuf() : SolvableVisJonesMBuf()
      39             : {
      40             : // Null constructor
      41           0 : };
      42             : 
      43             : //----------------------------------------------------------------------------
      44             : 
      45           0 : BJonesMBuf::BJonesMBuf (const Vector<Int>& calIndices,
      46           0 :                         const Block<Vector<Int> >& indexValues) : 
      47           0 :   SolvableVisJonesMBuf (calIndices, indexValues)
      48             : {
      49             : // Construct from a set of cal buffer indices and specified index values
      50             : // Output to private data:
      51             : //    SolvableVisJonesMBuf   SolvableVisJonesMBuf    Parent class cal main 
      52             : //                                                   table buffer
      53           0 : };
      54             : 
      55             : //----------------------------------------------------------------------------
      56             : 
      57           0 : BJonesMBuf::BJonesMBuf (CalIterBase& calIter) 
      58           0 :   : SolvableVisJonesMBuf (calIter)
      59             : {
      60             : // Construct from a calibration table iterator
      61             : // Input:
      62             : //    calIter            CalIterBase&         Calibration table iterator
      63           0 : };
      64             : 
      65             : //----------------------------------------------------------------------------
      66             : 
      67           0 : BJonesPolyMBuf::BJonesPolyMBuf() : BJonesMBuf()
      68             : {
      69             : // Null constructor
      70             : // Output to private data:
      71             : //    BJonesMBuf          BJonesMBuf         BJones cal main buffer
      72             : //    polyType_p          Vector<String>     Polynomial type
      73             : //    polyMode_p          Vector<String>     Polynomial mode (e.g. A&P)
      74             : //    scaleFactor_p       Vector<Complex>    Polynomial scale factor
      75             : //    validDomain_p       Array<Double>      Valid domain [x_0, x_1]
      76             : //    nPolyAmp_p          Vector<Int>        Polynomial degree (amplitude)
      77             : //    nPolyPhase_p        Vector<Int>        Polynomial degree (phase)
      78             : //    polyCoeffAmp_p      Array<Double>      Polynomial coeff. (amplitude)
      79             : //    polyCoeffPhase_p    Array<Double>      Polynomial coeff. (phase)
      80             : //    phaseUnits_p        Vector<String>     Phase units
      81             : //    sideBandRef_p       Vector<Complex>    Sideband reference
      82             : //    polyTypeOK_p        Bool               Polynomial type cache ok
      83             : //    polyModeOK_p        Bool               Polynomial mode cache ok
      84             : //    scaleFactorOK_p     Bool               Scale factor cache ok
      85             : //    validDomainOK_p     Bool               Valid domain cache ok
      86             : //    nPolyAmpOK_p        Bool               Poly. degree (amp) cache ok
      87             : //    nPolyPhaseOK_p      Bool               Poly. degree (phase) cache ok
      88             : //    polyCoeffAmpOK_p    Bool               Poly. coeff. (amp) cache ok
      89             : //    polyCoeffPhaseOK_p  Bool               Poly. coeff. (phase) cache ok
      90             : //    phaseUnitsOK_p      Bool               Phase units cache ok
      91             : //    sideBandRefOK_p     Bool               Sideband ref. cache ok
      92             : //
      93             :   // Invalidate cache
      94           0 :   invalidate();
      95           0 : };
      96             : 
      97             : //----------------------------------------------------------------------------
      98             : 
      99           0 : BJonesPolyMBuf::BJonesPolyMBuf (const Vector<Int>& calIndices,
     100           0 :                                 const Block<Vector<Int> >& indexValues) : 
     101           0 :   BJonesMBuf (calIndices, indexValues)
     102             : {
     103             : // Construct from a set of cal buffer indices and specified index values
     104             : // Output to private data:
     105             : //    BJonesMBuf       BJonesMBuf         Parent class cal main table buffer
     106             : //
     107             :   // Set the local non-index columns to default values
     108           0 :   fillAttributes (calIndices);
     109           0 : };
     110             : 
     111             : //----------------------------------------------------------------------------
     112             : 
     113           0 : BJonesPolyMBuf::BJonesPolyMBuf (CalIterBase& calIter) : BJonesMBuf (calIter)
     114             : {
     115             : // Construct from a calibration table iterator
     116             : // Input:
     117             : //    calIter             CalIterBase&       Calibration table iterator
     118             : // Output to private data:
     119             : //    BJonesMBuf          BJonesMBuf         BJones cal main buffer
     120             : //    polyType_p          Vector<String>     Polynomial type
     121             : //    polyMode_p          Vector<String>     Polynomial mode (e.g. A&P)
     122             : //    scaleFactor_p       Vector<Complex>    Polynomial scale factor
     123             : //    validDomain_p       Array<Double>      Valid domain [x_0, x_1]
     124             : //    nPolyAmp_p          Vector<Int>        Polynomial degree (amplitude)
     125             : //    nPolyPhase_p        Vector<Int>        Polynomial degree (phase)
     126             : //    polyCoeffAmp_p      Array<Double>      Polynomial coeff. (amplitude)
     127             : //    polyCoeffPhase_p    Array<Double>      Polynomial coeff. (phase)
     128             : //    phaseUnits_p        Vector<String>     Phase units
     129             : //    sideBandRef_p       Vector<Complex>    Sideband reference
     130             : //    polyTypeOK_p        Bool               Polynomial type cache ok
     131             : //    polyModeOK_p        Bool               Polynomial mode cache ok
     132             : //    scaleFactorOK_p     Bool               Scale factor cache ok
     133             : //    validDomainOK_p     Bool               Valid domain cache ok
     134             : //    nPolyAmpOK_p        Bool               Poly. degree (amp) cache ok
     135             : //    nPolyPhaseOK_p      Bool               Poly. degree (phase) cache ok
     136             : //    polyCoeffAmpOK_p    Bool               Poly. coeff. (amp) cache ok
     137             : //    polyCoeffPhaseOK_p  Bool               Poly. coeff. (phase) cache ok
     138             : //    phaseUnitsOK_p      Bool               Phase units cache ok
     139             : //    sideBandRefOK_p     Bool               Sideband ref. cache ok
     140             : //
     141             :   // Invalidate cache
     142           0 :   invalidate();
     143           0 : };
     144             : 
     145             : //----------------------------------------------------------------------------
     146             : 
     147           0 : Int BJonesPolyMBuf::append (CalTable& calTable)
     148             : {
     149             : // Append the current calibration buffer to a calibration table
     150             : // Input:
     151             : //    calTable            CalTable&          Calibration table
     152             : //
     153             :   // Extend the inherited parent class method
     154           0 :   Int nAdded = SolvableVisJonesMBuf::append(calTable);
     155             : 
     156             :   // Compute the row numbers already added by the parent class
     157           0 :   uInt endRow = calTable.nRowMain() - 1;
     158           0 :   uInt startRow = endRow - nAdded + 1;
     159             : 
     160             :   // Attach a calibration table columns accessor
     161           0 :   BJonesPolyMCol bjpMainCol(dynamic_cast<BJonesPolyTable&>(calTable));
     162             : 
     163             :   // Append the current cal buffer main columns
     164           0 :   RefRows refRows(startRow, endRow);
     165           0 :   bjpMainCol.polyType().putColumnCells(refRows, polyType());
     166           0 :   bjpMainCol.polyMode().putColumnCells(refRows, polyMode());
     167           0 :   bjpMainCol.scaleFactor().putColumnCells(refRows, scaleFactor());
     168           0 :   bjpMainCol.validDomain().putColumnCells(refRows, validDomain());
     169           0 :   bjpMainCol.nPolyAmp().putColumnCells(refRows, nPolyAmp());
     170           0 :   bjpMainCol.nPolyPhase().putColumnCells(refRows, nPolyPhase());
     171           0 :   bjpMainCol.polyCoeffAmp().putColumnCells(refRows, polyCoeffAmp());
     172           0 :   bjpMainCol.polyCoeffPhase().putColumnCells(refRows, polyCoeffPhase());
     173           0 :   bjpMainCol.phaseUnits().putColumnCells(refRows, phaseUnits());
     174           0 :   bjpMainCol.sideBandRef().putColumnCells(refRows, sideBandRef());
     175             : 
     176           0 :   return nAdded;
     177           0 : };
     178             : 
     179             : //----------------------------------------------------------------------------
     180             : 
     181           0 : Int BJonesPolyMBuf::nRow()
     182             : {
     183             : // Return the maximum number of rows in the calibration buffer
     184             : // Input from private data:
     185             : //    polyTypeOK_p        Bool               Polynomial type cache ok
     186             : //    polyModeOK_p        Bool               Polynomial mode cache ok
     187             : //    scaleFactorOK_p     Bool               Scale factor cache ok
     188             : //    validDomainOK_p     Bool               Valid domain cache ok
     189             : //    nPolyAmpOK_p        Bool               Poly. degree (amp) cache ok
     190             : //    nPolyPhaseOK_p      Bool               Poly. degree (phase) cache ok
     191             : //    polyCoeffAmpOK_p    Bool               Poly. coeff. (amp) cache ok
     192             : //    polyCoeffPhaseOK_p  Bool               Poly. coeff. (phase) cache ok
     193             : //    phaseUnitsOK_p      Bool               Phase units cache ok
     194             : //    sideBandRefOK_p     Bool               Sideband ref. cache ok
     195             : // Output:
     196             : //    nRow                Int                Maximum number of rows
     197             : //
     198             :   // Extend the inherited parent class method
     199           0 :   Int nRowParent = SolvableVisJonesMBuf::nRow();
     200             : 
     201             :   // Process each local column individually
     202           0 :   Vector<Int> colLength(11);
     203           0 :   Int n = 0;
     204           0 :   colLength(n++) = nRowParent;
     205           0 :   colLength(n++) = polyType().nelements();
     206           0 :   colLength(n++) = polyMode().nelements();
     207           0 :   colLength(n++) = scaleFactor().nelements();
     208           0 :   colLength(n++) = validDomain().shape().nelements() > 0 ?
     209           0 :     validDomain().shape().getLast(1)(0) : 0;
     210           0 :   colLength(n++) = nPolyAmp().nelements();
     211           0 :   colLength(n++) = nPolyPhase().nelements();
     212           0 :   colLength(n++) = polyCoeffAmp().shape().nelements() > 0 ?
     213           0 :     polyCoeffAmp().shape().getLast(1)(0) : 0;
     214           0 :   colLength(n++) = polyCoeffPhase().shape().nelements() > 0 ?
     215           0 :     polyCoeffPhase().shape().getLast(1)(0) : 0;
     216           0 :   colLength(n++) = phaseUnits().nelements();
     217           0 :   colLength(n++) = sideBandRef().nelements();
     218             : 
     219           0 :   return max(colLength);
     220           0 : };
     221             : 
     222             : //----------------------------------------------------------------------------
     223             : 
     224           0 : Bool BJonesPolyMBuf::putAntGain (const Int& antennaId, 
     225             :                                  const String& sFreqGrpName,
     226             :                                  const String& sPolyType, 
     227             :                                  const Complex& sScaleFactor,
     228             :                                  const Vector<Double>& sValidDomain,
     229             :                                  const Int& sNPolyAmp, const Int& sNPolyPhase, 
     230             :                                  const Vector<Double>& sPolyCoeffAmp,
     231             :                                  const Vector<Double>& sPolyCoeffPhase,
     232             :                                  const String& sPhaseUnits,
     233             :                                  const Complex& sSideBandRef, 
     234             :                                  const MFrequency& sRefFreq,
     235             :                                  const Int& sRefAnt)
     236             : {
     237             : // Update the parametrized solution for a given antenna id.
     238             : // Input:
     239             : //    antennaId           const Int&             Antenna id. to use as key;
     240             : //                                               all subsequent parameters are
     241             : //                                               solution attributes
     242             : //    sFreqGrpName        const String&          Freq. group name 
     243             : //    sPolyType           const String&          Polynomial type
     244             : //    sScaleFactor        const Complex&         Polynomial scale factor
     245             : //    sValidDomain        const Vector<Double>&  Valid range [x_0, x_1]
     246             : //    sNPolyAmp           const Int&             Poly. degree (amp)
     247             : //    sNPolyPhase         const Int&             Poly. degree (phase)
     248             : //    sPolyCoeffAmp       const Vector<Double>&  Poly. coeff. (amp)
     249             : //    sPolyCoeffPhase     const Vector<Double>&  Poly. coeff. (phase)
     250             : //    sPhaseUnits         const String&          Phase units
     251             : //    sSideBandRef        const Complex&         Sideband reference factor
     252             : //    sRefFreq            const MFrequency&      Reference frequency
     253             : //    sRefAnt             const Int &            Reference antenna id.
     254             : //
     255             :   // Initialization
     256           0 :   Bool retval = false;
     257             : 
     258             :   // Find all calibration buffer rows for the antenna 1 id.
     259           0 :   Vector<Int> matchingRows = matchAntenna1(antennaId);
     260           0 :   Int nMatch = matchingRows.nelements();
     261             : 
     262           0 :   if (nMatch > 0) {
     263           0 :     retval = true;
     264             :     // Update each matched row
     265           0 :     for (Int i=0; i < nMatch; i++) {
     266           0 :       uInt row = matchingRows(i);
     267           0 :       freqGrpName()(row) = sFreqGrpName;
     268           0 :       polyType()(row) = sPolyType;
     269           0 :       polyMode()(row) = "A&P";
     270           0 :       scaleFactor()(row) = sScaleFactor;
     271           0 :       for (uInt pos=0; pos < 2; pos++) {
     272           0 :         IPosition domainPos(2, pos, row);
     273           0 :         validDomain()(domainPos) = sValidDomain(pos);
     274           0 :       };
     275           0 :       nPolyAmp()(row) = sNPolyAmp;
     276           0 :       nPolyPhase()(row) = sNPolyPhase;
     277             : 
     278             :       // Resize the coefficient arrays
     279           0 :       IPosition ampCoeffShape = polyCoeffAmp().shape();
     280           0 :       if (ampCoeffShape(3) != 2*sNPolyAmp) {
     281           0 :         ampCoeffShape(3) = 2*sNPolyAmp;
     282           0 :         polyCoeffAmp().resize(ampCoeffShape);
     283             :       };
     284           0 :       IPosition phaseCoeffShape = polyCoeffPhase().shape();
     285           0 :       if (phaseCoeffShape(3) != 2*sNPolyPhase) {
     286           0 :         phaseCoeffShape(3) = 2*sNPolyPhase;
     287           0 :         polyCoeffPhase().resize(phaseCoeffShape);
     288             :       };
     289             : 
     290             :       // Update all array elements
     291           0 :       for (Int recep=0; recep < ampCoeffShape(0); recep++) {
     292           0 :         for (Int spw=0; spw < ampCoeffShape(1); spw++) {
     293           0 :           for (Int chan=0; chan < ampCoeffShape(2); chan++) {
     294           0 :             IPosition ipos4(4, recep, spw, chan, row);
     295             :             // Reference frequency and antenna
     296           0 :             refFreqMeas()(ipos4) = sRefFreq;
     297           0 :             refAnt()(ipos4) = sRefAnt;
     298             : 
     299             :             // Amplitude polynomial coefficients
     300           0 :             for (Int coeff=0; coeff < 2*sNPolyAmp; coeff++) {
     301           0 :               IPosition ipos5(5, recep, spw, chan, coeff, row);
     302           0 :               polyCoeffAmp()(ipos5) = sPolyCoeffAmp(coeff);
     303           0 :             };
     304             : 
     305             :             // Phase polynomial coefficients
     306           0 :             for (Int coeff=0; coeff < 2*sNPolyPhase; coeff++) {
     307           0 :               IPosition ipos5(5, recep, spw, chan, coeff, row);
     308           0 :               polyCoeffPhase()(ipos5) = sPolyCoeffPhase(coeff);
     309           0 :             };
     310           0 :           };
     311             :         };
     312             :       };
     313             : 
     314             :       // Phase units
     315           0 :       phaseUnits()(row) = sPhaseUnits;
     316             : 
     317             :       // Sideband reference
     318           0 :       sideBandRef()(row) = sSideBandRef;
     319           0 :     };
     320             :   };
     321           0 :   return retval;
     322           0 : };
     323             : 
     324             : //----------------------------------------------------------------------------
     325             : 
     326           0 : Vector<String>& BJonesPolyMBuf::polyType()
     327             : {
     328             : // POLY_TYPE data field accessor
     329             : // Input from private data:
     330             : //    polyType_p          Vector<String>     Polynomial type
     331             : //    polyTypeOK_p        Bool               Polynomial type cache ok
     332             : //
     333             :   // Fill local cache for this column if cache not valid
     334           0 :   if (connectedToIter()) {
     335           0 :     if (!polyTypeOK_p) {
     336           0 :       calMainCol()->polyType().getColumn (polyType_p);
     337           0 :       polyTypeOK_p = true;
     338             :     };
     339             :   };
     340           0 :   return polyType_p;
     341             : };
     342             : 
     343             : //----------------------------------------------------------------------------
     344             : 
     345           0 : Vector<String>& BJonesPolyMBuf::polyMode()
     346             : {
     347             : // POLY_MODE data field accessor
     348             : // Input from private data:
     349             : //    polyMode_p          Vector<String>     Polynomial mode (e.g. A&P)
     350             : //    polyModeOK_p        Bool               Polynomial mode cache ok
     351             : //
     352             :   // Fill local cache for this column if cache not valid
     353           0 :   if (connectedToIter()) {
     354           0 :     if (!polyModeOK_p) {
     355           0 :       calMainCol()->polyMode().getColumn (polyMode_p);
     356           0 :       polyModeOK_p = true;
     357             :     };
     358             :   };
     359           0 :   return polyMode_p;
     360             : };
     361             : 
     362             : //----------------------------------------------------------------------------
     363             : 
     364           0 : Vector<Complex>& BJonesPolyMBuf::scaleFactor()
     365             : {
     366             : // SCALE_FACTOR data field accessor
     367             : // Input from private data:
     368             : //    scaleFactor_p       Vector<Complex>    Polynomial scale factor
     369             : //    scaleFactorOK_p     Bool               Polynomial scale factor cache ok
     370             : //
     371             :   // Fill local cache for this column if cache not valid
     372           0 :   if (connectedToIter()) {
     373           0 :     if (!scaleFactorOK_p) {
     374           0 :       calMainCol()->scaleFactor().getColumn (scaleFactor_p);
     375           0 :       scaleFactorOK_p = true;
     376             :     };
     377             :   };
     378           0 :   return scaleFactor_p;
     379             : };
     380             : 
     381             : //----------------------------------------------------------------------------
     382             : 
     383           0 : Array<Double>& BJonesPolyMBuf::validDomain()
     384             : {
     385             : // VALID_DOMAIN data field accessor
     386             : // Input from private data:
     387             : //    validDomain_p      Array<Double>      Valid domain [x_0, x_1]
     388             : //    validDomainOK_p    Bool               Valid domain cache ok
     389             : //
     390             :   // Fill local cache for this column if cache not valid
     391           0 :   if (connectedToIter()) {
     392           0 :     if (!validDomainOK_p) {
     393           0 :       calMainCol()->validDomain().getColumn (validDomain_p);
     394           0 :       validDomainOK_p = true;
     395             :     };
     396             :   };
     397           0 :   return validDomain_p;
     398             : };
     399             : 
     400             : //----------------------------------------------------------------------------
     401             : 
     402           0 : Vector<Int>& BJonesPolyMBuf::nPolyAmp()
     403             : {
     404             : // N_POLY_AMP data field accessor
     405             : // Input from private data:
     406             : //    nPolyAmp_p          Vector<Int>        Polynomial degree (amplitude)
     407             : //    nPolyAmpOK_p        Bool               Poly. degree (amp) cache ok
     408             : //
     409             :   // Fill local cache for this column if cache not valid
     410           0 :   if (connectedToIter()) {
     411           0 :     if (!nPolyAmpOK_p) {
     412           0 :       calMainCol()->nPolyAmp().getColumn (nPolyAmp_p);
     413           0 :       nPolyAmpOK_p = true;
     414             :     };
     415             :   };
     416           0 :   return nPolyAmp_p;
     417             : };
     418             : 
     419             : //----------------------------------------------------------------------------
     420             : 
     421           0 : Vector<Int>& BJonesPolyMBuf::nPolyPhase()
     422             : {
     423             : // N_POLY_PHASE data field accessor
     424             : // Input from private data:
     425             : //    nPolyPhase_p          Vector<Int>        Polynomial degree (phase)
     426             : //    nPolyPhaseOK_p        Bool               Poly. degree (phase) cache ok
     427             : //
     428             :   // Fill local cache for this column if cache not valid
     429           0 :   if (connectedToIter()) {
     430           0 :     if (!nPolyPhaseOK_p) {
     431           0 :       calMainCol()->nPolyPhase().getColumn (nPolyPhase_p);
     432           0 :       nPolyPhaseOK_p = true;
     433             :     };
     434             :   };
     435           0 :   return nPolyPhase_p;
     436             : };
     437             : 
     438             : //----------------------------------------------------------------------------
     439             : 
     440           0 : Array<Double>& BJonesPolyMBuf::polyCoeffAmp()
     441             : {
     442             : // POLY_COEFF_AMP data field accessor
     443             : // Input from private data:
     444             : //    polyCoeffAmp_p      Array<Double>      Polynomial coeff. (amplitude)
     445             : //    polyCoeffAmpOK_p    Bool               Poly. coeff. (amp) cache ok
     446             : //
     447             :   // Fill local cache for this column if cache not valid
     448           0 :   if (connectedToIter()) {
     449           0 :     if (!polyCoeffAmpOK_p) {
     450           0 :       calMainCol()->polyCoeffAmp().getColumn (polyCoeffAmp_p);
     451           0 :       polyCoeffAmpOK_p = true;
     452             :     };
     453             :   };
     454           0 :   return polyCoeffAmp_p;
     455             : };
     456             : 
     457             : //----------------------------------------------------------------------------
     458             : 
     459           0 : Array<Double>& BJonesPolyMBuf::polyCoeffPhase()
     460             : {
     461             : // POLY_COEFF_PHASE data field accessor
     462             : // Input from private data:
     463             : //    polyCoeffPhase_p      Array<Double>      Polynomial coeff. (phase)
     464             : //    polyCoeffPhaseOK_p    Bool               Poly. coeff. (phase) cache ok
     465             : //
     466             :   // Fill local cache for this column if cache not valid
     467           0 :   if (connectedToIter()) {
     468           0 :     if (!polyCoeffPhaseOK_p) {
     469           0 :       calMainCol()->polyCoeffPhase().getColumn (polyCoeffPhase_p);
     470           0 :       polyCoeffPhaseOK_p = true;
     471             :     };
     472             :   };
     473           0 :   return polyCoeffPhase_p;
     474             : };
     475             : 
     476             : //----------------------------------------------------------------------------
     477             : 
     478           0 : Vector<String>& BJonesPolyMBuf::phaseUnits()
     479             : {
     480             : // PHASE_UNITS data field accessor
     481             : // Input from private data:
     482             : //    phaseUnits_p        Vector<String>     Phase units
     483             : //    phaseUnitsOK_p      Bool               Phase units cache ok
     484             : //
     485             :   // Fill local cache for this column if cache not valid
     486           0 :   if (connectedToIter()) {
     487           0 :     if (!phaseUnitsOK_p) {
     488           0 :       calMainCol()->phaseUnits().getColumn (phaseUnits_p);
     489           0 :       phaseUnitsOK_p = true;
     490             :     };
     491             :   };
     492           0 :   return phaseUnits_p;
     493             : };
     494             : 
     495             : //----------------------------------------------------------------------------
     496             : 
     497           0 : Vector<Complex>& BJonesPolyMBuf::sideBandRef()
     498             : {
     499             : // SIDEBAND_REF data field accessor
     500             : // Input from private data:
     501             : //    sideBandRef_p       Vector<Complex>    Sideband reference
     502             : //    sideBandRefOK_p     Bool               Sideband ref. cache ok
     503             : //
     504             :   // Fill local cache for this column if cache not valid
     505           0 :   if (connectedToIter()) {
     506           0 :     if (!sideBandRefOK_p) {
     507           0 :       calMainCol()->sideBandRef().getColumn (sideBandRef_p);
     508           0 :       sideBandRefOK_p = true;
     509             :     };
     510             :   };
     511           0 :   return sideBandRef_p;
     512             : };
     513             : 
     514             : //----------------------------------------------------------------------------
     515             : 
     516           0 : void BJonesPolyMBuf::invalidate()
     517             : {
     518             : // Invalidate the current cache
     519             : // Output to private data:
     520             : //    polyTypeOK_p        Bool               Polynomial type cache ok
     521             : //    polyModeOK_p        Bool               Polynomial mode cache ok
     522             : //    scaleFactorOK_p     Bool               Scale factor cache ok
     523             : //    validDomainOK_p     Bool               Valid domain cache ok
     524             : //    nPolyAmpOK_p        Bool               Poly. degree (amp) cache ok
     525             : //    nPolyPhaseOK_p      Bool               Poly. degree (phase) cache ok
     526             : //    polyCoeffAmpOK_p    Bool               Poly. coeff. (amp) cache ok
     527             : //    polyCoeffPhaseOK_p  Bool               Poly. coeff. (phase) cache ok
     528             : //    phaseUnitsOK_p      Bool               Phase units cache ok
     529             : //    sideBandRefOK_p     Bool               Sideband ref. cache ok
     530             : //
     531             :   // Invalidate parent class cache
     532           0 :   BJonesMBuf::invalidate();
     533             : 
     534             :   // Set all cache flags to false
     535           0 :   polyTypeOK_p = false;
     536           0 :   polyModeOK_p = false;
     537           0 :   scaleFactorOK_p = false;
     538           0 :   validDomainOK_p = false;
     539           0 :   nPolyAmpOK_p = false;
     540           0 :   nPolyPhaseOK_p = false;
     541           0 :   polyCoeffAmpOK_p = false;
     542           0 :   polyCoeffPhaseOK_p = false;
     543           0 :   phaseUnitsOK_p = false;
     544           0 :   sideBandRefOK_p = false;
     545           0 : };
     546             : 
     547             : //----------------------------------------------------------------------------
     548             : 
     549           0 :   void BJonesPolyMBuf::fillAttributes (const Vector<Int>& /*calIndices*/)
     550             : {
     551             : // Resize all BJonesPoly attribute columns and set to their default values
     552             : // Input:
     553             : //    calIndices         const Vector<Int>&   Vector of cal indices, specified
     554             : //                                            as enums from class MSCalEnums,
     555             : //                                            to exclude
     556             : // Output to private data:
     557             : //    polyType_p          Vector<String>     Polynomial type
     558             : //    polyMode_p          Vector<String>     Polynomial mode (e.g. A&P)
     559             : //    scaleFactor_p       Vector<Complex>    Polynomial scale factor
     560             : //    validDomain_p       Array<Double>      Valid range [x_0, x_1]
     561             : //    nPolyAmp_p          Vector<Int>        Polynomial degree (amplitude)
     562             : //    nPolyPhase_p        Vector<Int>        Polynomial degree (phase)
     563             : //    polyCoeffAmp_p      Array<Double>      Polynomial coeff. (amplitude)
     564             : //    polyCoeffPhase_p    Array<Double>      Polynomial coeff. (phase)
     565             : //    phaseUnits_p        Vector<String>     Phase units
     566             : //    sideBandRef_p       Vector<Complex>    Sideband reference
     567             : //
     568             :   // Process each BJonesPoly cal buffer column separately
     569             :   //
     570             :   // Use the maximum number of rows currently defined in the cal buffer
     571           0 :   uInt nrow = nRow();
     572             : 
     573             :   // POLY_TYPE
     574           0 :   polyType().resize(nrow);
     575           0 :   polyType() = "";
     576             : 
     577             :   // POLY_MODE
     578           0 :   polyMode().resize(nrow);
     579           0 :   polyMode() = "";
     580             : 
     581             :   // SCALE_FACTOR
     582           0 :   scaleFactor().resize(nrow);
     583           0 :   scaleFactor() = Complex(1,0);
     584             : 
     585             :   // VALID_DOMAIN
     586           0 :   IPosition domainSize(2, 2, nrow);
     587           0 :   validDomain().resize(domainSize);
     588           0 :   validDomain() = 0;
     589             : 
     590             :   // N_POLY_AMP
     591           0 :   nPolyAmp().resize(nrow);
     592           0 :   nPolyAmp() = 0;
     593             : 
     594             :   // NPOLY_PHASE
     595           0 :   nPolyPhase().resize(nrow);
     596           0 :   nPolyPhase() = 0;
     597             : 
     598             :   // Array-based columns POLY_COEFF_AMP and POLY_COEFF_PHASE (set 
     599             :   // to default unit length in each dimension)
     600           0 :   uInt numSpw = 1;
     601           0 :   uInt numChan = 1;
     602           0 :   uInt numReceptors = 1;
     603           0 :   uInt numCoeff = 1;
     604           0 :   IPosition coeffSize(5, numReceptors, numSpw, numChan, numCoeff, nrow);
     605             : 
     606           0 :   polyCoeffAmp().resize(coeffSize);
     607           0 :   polyCoeffAmp() = 0;
     608           0 :   polyCoeffPhase().resize(coeffSize);
     609           0 :   polyCoeffPhase() = 0;
     610             : 
     611             :   // PHASE_UNITS
     612           0 :   phaseUnits().resize(nrow);
     613           0 :   phaseUnits() = "";
     614             : 
     615             :   // SIDEBAND_REF
     616           0 :   sideBandRef().resize(nrow);
     617           0 :   sideBandRef() = Complex(1.0, 0.0);
     618             : 
     619           0 :   return;
     620           0 : };
     621             : 
     622             : //----------------------------------------------------------------------------
     623             : 
     624             : 
     625             : 
     626             : } //# NAMESPACE CASA - END
     627             : 

Generated by: LCOV version 1.16