LCOV - code coverage report
Current view: top level - nrao/VLA/test - tVLABuffer.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 3 3 100.0 %
Date: 2024-10-12 00:35:29 Functions: 1 1 100.0 %

          Line data    Source code
       1             : //# tVLABuffer.cc: 
       2             : //# Copyright (C) 1999,2000,2001
       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             : #include <casacore/casa/aips.h>
      29             : #include <casacore/casa/Exceptions/Error.h>
      30             : #include <casacore/casa/Utilities/Assert.h>
      31             : #include <casacore/casa/BasicSL/String.h>
      32             : #include <casacore/casa/iostream.h>
      33             : 
      34             : #include <casacore/casa/Inputs.h>
      35             : #include <casacore/casa/OS/Path.h>
      36             : //#include <nrao/VLA/VLABuffer.h>
      37             : #include <casacore/casa/OS/File.h>
      38             : #include <casacore/casa/OS/Path.h>
      39             : #include <casacore/casa/OS/SymLink.h>
      40             : #include <nrao/VLA/VLADiskInput.h>
      41             : #include <nrao/VLA/VLATapeInput.h>
      42             : 
      43             : #include <casacore/casa/Arrays/Vector.h>
      44             : 
      45             : #include <casacore/casa/namespace.h>
      46             : 
      47           1 : int main(int argc, char* argv[]) {
      48             :   try {
      49             :     /*   VLABuffer buffer; 
      50             :     {
      51             :       Input inputs(1);
      52             :       inputs.Create ("input", "/dev/tape",
      53             :                      "Input archive ie., a file/device name");
      54             :       inputs.Create ("files", "0",
      55             :                      "tape files to read, 0 -> next file");
      56             :       inputs.Create ("project", "",
      57             :                      "project name, blank -> all projects");
      58             :       inputs.ReadArguments (argc, argv);
      59             :       
      60             :       Path fileName(inputs.GetString("input"));
      61             :       String projectName(inputs.GetString("project"));
      62             :       projectName.upcase();
      63             :       AlwaysAssert(fileName.isValid(), AipsError);
      64             :       File file(fileName);
      65             :       AlwaysAssert(file.exists(), AipsError);
      66             :       if (file.isSymLink()) {
      67             :         SymLink link(file);
      68             :         fileName = link.followSymLink();
      69             :         AlwaysAssert(fileName.isValid(), AipsError);
      70             :         file = File(fileName);
      71             :         AlwaysAssert(file.exists(), AipsError);
      72             :         DebugAssert(file.isSymLink() == false, AipsError);
      73             :       }      
      74             :       if (file.isRegular()) {
      75             :         buffer = VLABuffer(new VLADiskInput(fileName), projectName);
      76             :       } else if (file.isCharacterSpecial()) {
      77             :         Block<uInt> files;
      78             :         {
      79             :           Block<Int> f = inputs.GetIntArray("files");
      80             :           files.resize(f.nelements());
      81             :           for (uInt i = 0; i < f.nelements(); i++) {
      82             :             AlwaysAssert(f[i] >= 0, AipsError);
      83             :             files[i] = f[i];
      84             :           }
      85             :         }
      86             :         buffer = VLABuffer(new VLATapeInput(fileName, files), projectName);
      87             :       }
      88             :     }
      89             : 
      90             :     */
      91             :     /*
      92             :     uInt i = 1;
      93             :     uInt nAnt = 0;
      94             :     uInt nSpw = 0;
      95             :     uInt nSrc = 0;
      96             :     while (buffer.isValid()) {
      97             :       const uInt nRows = buffer.main().rows();
      98             :       cout << "Record " << i 
      99             :            << " contains " << nRows << " rows of data" 
     100             :            << " in " << buffer.main().nDataShapes() << " shape(s)" 
     101             :            << endl;
     102             : //       for (uInt r = 0; r < nRows; r++) {
     103             : //      cout << "Row " << r << " has shape " 
     104             : //           << buffer.main().data(r).shape() << endl;
     105             : //       }
     106             :       const uInt newSpw = buffer.spectralWindow().rows();
     107             :       if (nSpw != newSpw) {
     108             :         cout << newSpw - nSpw << " new entries in the spectral window buffer"
     109             :              << endl;
     110             :         for (uInt s = nSpw; s < newSpw; s++) {
     111             :           cout << "Row " << s 
     112             :                << ": nPol: " << buffer.spectralWindow().nCorrelations(s)
     113             :                << " nChan: " << buffer.spectralWindow().nChannels(s)
     114             :                << " Freq: " << buffer.spectralWindow().refFreq(s)
     115             :                << " IF: " << buffer.spectralWindow().IFConversion(s)
     116             :                << endl;
     117             :         }
     118             :         nSpw = newSpw;
     119             :       }
     120             :     */
     121             :     /*
     122             :       const uInt newAnt = buffer.antenna().rows();
     123             :       if (nAnt != newAnt) {
     124             :         cout << newAnt - nAnt << " new entries in the antenna buffer" << endl;
     125             :         for (uInt a = nAnt; a < newAnt; a++) {
     126             :           cout << "Row " << a << ": Antenna: " << buffer.antenna().name(a)
     127             :                << " Pad: " << buffer.antenna().station(a);
     128             :           const uInt id = buffer.antenna().arrayId(a);
     129             :           cout << " Sub-array: " << buffer.array().name(id)
     130             :                << endl;
     131             :         }
     132             :         nAnt = newAnt;
     133             :       }
     134             :       const uInt newSrc = buffer.field().rows();
     135             :       if (nSrc != newSrc) {
     136             :         cout << newSrc - nSrc << " new entries in the field buffer" << endl;
     137             :         for (uInt a = nSrc; a < newSrc; a++) {
     138             :           cout << "Row " << a 
     139             :                << ": Field position: " << buffer.field().refDir(a);
     140             :           Int sourceId = buffer.field().sourceId(a);
     141             :           cout << " Source name: " << buffer.source().name(sourceId)
     142             :                << endl;
     143             :        
     144             :         }
     145             :         nSrc = newSrc;
     146             :       }
     147             : //       const uInt nAnt = 27;
     148             : //       const uInt nChan = numChannels();
     149             : //       cout << "There are " << nAnt << " antennas and " 
     150             : //         << nChan << " channels in CDA " << i << endl;
     151             : //      msc.antenna1().put(row, buffer.main().antenna1(row));
     152             : //      msc.antenna1().putColumn(buffer.main().antenna1());
     153             : //      msc.antenna1().putColumnRange(slicer, buffer.main().antenna1());
     154             : //      msc.antenna1().putColumnCells(RefRow(start,end),
     155             : //                                    buffer.main().antenna1());
     156             : //       } else {
     157             : //      cout << "Record " << i << " is invalid" << endl;
     158             :       i++; buffer++;
     159             :     }
     160             :     */
     161             :   }
     162             :   catch (AipsError x) {
     163             :     cerr << x.getMesg() << endl;
     164             :     cout << "FAIL" << endl;
     165             :     return 1;
     166             :   } 
     167           1 :   cout << "OK" << endl;
     168           1 : }
     169             : 
     170             : // Local Variables: 
     171             : // compile-command: "gmake OPTLIB=1 tVLABuffer"
     172             : // End: 

Generated by: LCOV version 1.16