LCOV - code coverage report
Current view: top level - synthesis/TransformMachines - CFCell.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 81 0.0 %
Date: 2024-10-28 15:53:10 Functions: 0 5 0.0 %

          Line data    Source code
       1             : // -*- C++ -*-
       2             : //# CFCell.cc: Implementation of the CFCell class
       3             : //# Copyright (C) 1997,1998,1999,2000,2001,2002,2003
       4             : //# Associated Universities, Inc. Washington DC, USA.
       5             : //#
       6             : //# This library is free software; you can redistribute it and/or modify it
       7             : //# under the terms of the GNU Library General Public License as published by
       8             : //# the Free Software Foundation; either version 2 of the License, or (at your
       9             : //# option) any later version.
      10             : //#
      11             : //# This library is distributed in the hope that it will be useful, but WITHOUT
      12             : //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      13             : //# FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Library General Public
      14             : //# License for more details.
      15             : //#
      16             : //# You should have received a copy of the GNU Library General Public License
      17             : //# along with this library; if not, write to the Free Software Foundation,
      18             : //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
      19             : //#
      20             : //# Correspondence concerning AIPS++ should be addressed as follows:
      21             : //#        Internet email: casa-feedback@nrao.edu.
      22             : //#        Postal address: AIPS++ Project Office
      23             : //#                        National Radio Astronomy Observatory
      24             : //#                        520 Edgemont Road
      25             : //#                        Charlottesville, VA 22903-2475 USA
      26             : //#
      27             : //# $Id$
      28             : #include <synthesis/TransformMachines/CFCell.h>
      29             : #include <synthesis/TransformMachines/Utils.h>
      30             : #include <casacore/casa/Utilities/BinarySearch.h>
      31             : #include <casacore/images/Images/PagedImage.h>
      32             : using namespace casacore;
      33             : namespace casa{
      34             : 
      35             :   
      36           0 :   CountedPtr<CFCell> CFCell::clone()
      37             :   {
      38           0 :     CountedPtr<CFCell> clone=new CFCell();
      39           0 :     clone->setParams(*this);
      40           0 :     clone->storage_p = new Array<TT>(*storage_p);
      41           0 :     return clone;
      42           0 :   }
      43             : 
      44           0 :   void CFCell::setParams(const CFCell& other)
      45             :   {
      46           0 :     shape_p=other.storage_p->shape();
      47           0 :     shape_p = other.shape_p;
      48           0 :     coordSys_p=other.coordSys_p;
      49           0 :     sampling_p=other.sampling_p;
      50           0 :     xSupport_p=other.xSupport_p;
      51           0 :     ySupport_p=other.ySupport_p;
      52           0 :     wValue_p = other.wValue_p;
      53           0 :     wIncr_p=other.wIncr_p;
      54           0 :     fileName_p=other.fileName_p;
      55           0 :     freqValue_p = other.freqValue_p;
      56           0 :     freqIncr_p = other.freqIncr_p;
      57           0 :     muellerElement_p = other.muellerElement_p;
      58           0 :     pa_p = other.pa_p;
      59             :     //cfShape_p=other.storage_p->shape().asVector();
      60           0 :     cfShape_p.resize();
      61           0 :     cfShape_p.assign(other.cfShape_p);
      62           0 :     conjFreq_p = other.conjFreq_p;
      63           0 :     conjPoln_p = other.conjPoln_p;
      64           0 :     telescopeName_p=other.telescopeName_p;
      65           0 :     bandName_p=other.bandName_p;
      66           0 :     diameter_p=other.diameter_p;
      67           0 :     isRotationallySymmetric_p=other.isRotationallySymmetric_p;
      68           0 :   }
      69             : 
      70           0 :   void CFCell::show(const char *Mesg,ostream &os)
      71             :   {
      72           0 :     LogIO log_l(LogOrigin("CFCell","show[R&D]"));
      73             :       //       << "CoordSys: " << coordSys_p << endl
      74           0 :     if (Mesg) os << Mesg;
      75           0 :     os << "Sampling: "           << sampling_p  << endl
      76           0 :        << "xSupport, ySupport: " << xSupport_p  << " " << ySupport_p << endl
      77           0 :        << "wValues: "            << wValue_p    << endl
      78           0 :        << "wIncr: "            << wIncr_p    << endl
      79           0 :        << "FreqValues: "         << freqValue_p << endl
      80           0 :        << "ConjFreq: "           << conjFreq_p  << endl
      81           0 :        << "ConjPoln: "           << conjPoln_p  << endl
      82           0 :        << "MuellerElements: "    << muellerElement_p << endl
      83           0 :        << "Data shape: "         << storage_p->shape() << " " << cfShape_p << endl
      84           0 :        << "Parallactic Angle(d): "  << pa_p.getValue("deg")
      85           0 :        << endl;
      86           0 :     IPosition dummy;
      87           0 :     Vector<String> csList;
      88             :     // os << "CoordSys: ";
      89             :     // csList = coordSys_p.list(log_l,MDoppler::RADIO,dummy,dummy);
      90             :     // os << csList << endl;
      91           0 :   }
      92             : 
      93           0 :   void CFCell::makePersistent(const char *dir, const char* cfName)
      94             :   {
      95           0 :     LogIO log_l(LogOrigin("CFCell","makePersistent[R&D]"));
      96           0 :     String name(dir);
      97           0 :     if (cfShape_p.nelements() == 0)
      98             :       {
      99             :         //log_l << "Skipping making " << name << "/" << cfName << " persistent." << LogIO::WARN << LogIO::POST;
     100           0 :         return;
     101             :       }
     102             : 
     103             :     // if (fileName_p != "" )name = "test.cf/"+fileName_p;
     104           0 :     String tt=fileName_p;
     105             : 
     106           0 :     if (fileName_p == "") fileName_p = String(cfName);
     107           0 :     name = String(dir) + "/" + fileName_p;
     108             :     // log_l << "Making " << name << " persistent. Was " << tt << LogIO::WARN << LogIO::POST;
     109             :     //    storeArrayAsImage(name, coordSys_p, *storage_p);
     110             : 
     111             :     //    PagedImage<Complex> thisCF(storage_p->shape(),coordSys_p, name);
     112             : 
     113           0 :     IPosition tmpShape;
     114           0 :     tmpShape=shape_p;
     115             :     // Zero storage buffer is a hint that this may be an "empty CFs"
     116             :     // being made persistent.  So make a 2x2 pixel image (since I
     117             :     // don't know how to make a 0x0 pixel image to just save the CS
     118             :     // and miscInfo information to the disk).
     119           0 :     if ((storage_p->shape()).product()==0) tmpShape[0]=tmpShape[1]=2;
     120             : 
     121           0 :     PagedImage<Complex> thisCF(tmpShape,coordSys_p, name);
     122             :     //cerr << "thisCF.shape() = " << thisCF.shape() << " " << tmpShape << " " << storage_p->shape() << endl;
     123             : 
     124             :     //    cerr << "Ref pixel = " << coordSys_p.referencePixel() << endl;
     125             :     //    show(NULL,cerr);
     126             :     //cerr << storage_p->shape() << endl;
     127             : 
     128           0 :     if ((storage_p->shape()).nelements()>0) thisCF.put(*storage_p);
     129             :     //cerr << "INPERS " << bandName_p << " tel " << telescopeName_p << endl;
     130             :     //If there is no telescope name it barfs later especially in parallel continuum
     131             :     //So assuming it has to be EVLA
     132           0 :     if(telescopeName_p.size() <2) telescopeName_p="EVLA";
     133           0 :     Record miscinfo;
     134           0 :     miscinfo.define("Xsupport", xSupport_p);
     135           0 :     miscinfo.define("Ysupport", ySupport_p);
     136           0 :     miscinfo.define("Sampling", sampling_p);
     137           0 :     miscinfo.define("ParallacticAngle",pa_p.getValue("deg"));
     138           0 :     miscinfo.define("MuellerElement", muellerElement_p);
     139           0 :     miscinfo.define("WValue", wValue_p);
     140           0 :     miscinfo.define("WIncr", wIncr_p);
     141           0 :     miscinfo.define("Name", fileName_p);
     142           0 :     miscinfo.define("ConjFreq", conjFreq_p);
     143           0 :     miscinfo.define("ConjPoln", conjPoln_p);
     144           0 :     miscinfo.define("TelescopeName", telescopeName_p);
     145           0 :     miscinfo.define("BandName", bandName_p);
     146           0 :     miscinfo.define("Diameter", diameter_p);
     147           0 :     miscinfo.define("OpCode",isRotationallySymmetric_p);
     148           0 :     thisCF.setMiscInfo(miscinfo);
     149             : 
     150             :     //show("thisCell: ", cout);
     151           0 :   }
     152             : 
     153           0 :   void CFCell::clear()
     154             :   {
     155           0 :     getStorage()->resize();
     156           0 :     cfShape_p.resize(0);
     157           0 :   }
     158             : 
     159             : } // end casa namespace
     160             : 
     161             : 
     162             : 

Generated by: LCOV version 1.16