LCOV - code coverage report
Current view: top level - msvis/MSVis - FinalTvi2.cc (source / functions) Hit Total Coverage
Test: casacpp_coverage.info Lines: 0 89 0.0 %
Date: 2024-11-06 17:42:47 Functions: 0 20 0.0 %

          Line data    Source code
       1             : #include <casacore/casa/aips.h>
       2             : #include <casacore/casa/Arrays.h>
       3             : #include <stdcasa/UtilJ.h>
       4             : #include <msvis/MSVis/VisibilityIterator2.h>
       5             : #include <msvis/MSVis/FinalTvi2.h>
       6             : #include <casacore/ms/MeasurementSets/MeasurementSet.h>
       7             : #include <casacore/tables/Tables/RefRows.h>
       8             : #include <msvis/MSVis/VisBuffer2.h>
       9             : 
      10             : using namespace casacore;
      11             : using namespace casa::utilj;
      12             : 
      13             : using namespace casacore;
      14             : namespace casa {
      15             : 
      16             : namespace vi {
      17             : 
      18           0 : FinalTvi2::FinalTvi2 (ViImplementation2 * inputVi,
      19           0 :                       MeasurementSet & finalMs, Bool isWritable)
      20             : : TransformingVi2 (inputVi),
      21           0 :   columns_p (),
      22           0 :   columnsAttached_p (false),
      23           0 :   ms_p (finalMs)
      24             : {
      25           0 :     VisBufferOptions options = isWritable ? VbWritable : VbNoOptions;
      26           0 :     setVisBuffer (createAttachedVisBuffer (options));
      27           0 : }
      28             : 
      29           0 : FinalTvi2::~FinalTvi2 ()
      30             : {
      31           0 : }
      32             : 
      33             : //void
      34             : //FinalTvi2::configureNewSubchunk ()
      35             : //{
      36             : //    // Configure the VisBuffer for the new subchunk.  Most information comes from
      37             : //    // the Transforming VI2 superclass which in turn gets it from its VI implementation
      38             : //    // object.  The main addition is the need to provide the name of the MS output and
      39             : //    // the MS index which is always zero since we only support a single output MS.
      40             : //
      41             : //    Vector<Int> channels = getChannels (0, 0); // args are ignored
      42             : //    Int nChannels = channels.nelements();
      43             : //
      44             : //    getVisBuffer()->configureNewSubchunk (0, // always the first MS
      45             : //                                          ms_p.tableName(),
      46             : //                                          false,
      47             : //                                          isNewArrayId (),
      48             : //                                          isNewFieldId (),
      49             : //                                          isNewSpectralWindow (),
      50             : //                                          getSubchunkId (),
      51             : //                                          nRows(),
      52             : //                                          nChannels,
      53             : //                                          getVii()->nPolarizationIds(),
      54             : //                                          getVii()->getCorrelations(),
      55             : //                                          getVii()->getWeightScaling());
      56             : //}
      57             : 
      58             : 
      59             : void
      60           0 : FinalTvi2::origin ()
      61             : {
      62           0 :     TransformingVi2::origin ();
      63             : 
      64           0 :     configureNewSubchunk ();
      65           0 : }
      66             : 
      67             : void
      68           0 : FinalTvi2::next ()
      69             : {
      70           0 :     TransformingVi2::next();
      71             : 
      72           0 :     configureNewSubchunk ();
      73           0 : }
      74             : 
      75             : void
      76           0 : FinalTvi2::writeBackChanges (VisBuffer2 * vb)
      77             : {
      78             :     // Extend the measurement set by the number of rows contained
      79             :     // in the VB
      80             : 
      81           0 :     if (! columnsAttached_p){
      82             : 
      83           0 :         columns_p.attachColumns (ms_p, true);
      84           0 :         columnsAttached_p = true;
      85             :     }
      86             : 
      87             :     // Remember the current fillability state of the VB and then set it
      88             :     // to fillable.
      89             : 
      90           0 :     Bool wasFillable = vb->isFillable();
      91           0 :     vb->setFillable (true);
      92             : 
      93           0 :     Int firstRowAdded = ms_p.nrow();
      94           0 :     ms_p.addRow (vb->nRows());
      95           0 :     RefRows rows (firstRowAdded, ms_p.nrow() - 1);
      96             : 
      97             :     // Write out the data contained in the VB
      98             : 
      99             :     // First the key column values
     100             : 
     101           0 :     writeKeyValues (ms_p, rows);
     102             : 
     103             :     // Next the data column values
     104             : 
     105           0 :     writeDataValues (ms_p, rows);
     106             : 
     107             :     // Finally everything else
     108             : 
     109           0 :     writeMiscellaneousValues (ms_p, rows);
     110             : 
     111             :     // Put the fillability attribute back the way it was.
     112             : 
     113           0 :     vb->setFillable (wasFillable);
     114           0 : }
     115             : 
     116             : void
     117           0 : FinalTvi2::writeDataValues (MeasurementSet & /*ms*/, const RefRows & rows)
     118             : {
     119             :     // For each of the data columns, check to see if the output MS has the columns.
     120             :     // If so, write out to the MS the data in the VB for that column.
     121             :     //------------------------------------------------------------------------------
     122             : 
     123             :     // Write out the visibility data either complex or float
     124             : 
     125           0 :     if (columns_p.isFloatDataPresent()){
     126           0 :         columns_p.floatVis_p.putColumnCells (rows, getVisBuffer()->visCubeFloat());
     127             :     }
     128             :     else{
     129           0 :         columns_p.vis_p.putColumnCells (rows, getVisBuffer()->visCube());
     130             :     }
     131             : 
     132             :     // Write out the corrected and/or model visibilities if they are present
     133             : 
     134           0 :     if (! columns_p.corrVis_p.isNull()){
     135           0 :         columns_p.corrVis_p.putColumnCells (rows, getVisBuffer()->visCubeCorrected());
     136             :     }
     137             : 
     138           0 :     if (! columns_p.modelVis_p.isNull()){
     139           0 :         columns_p.modelVis_p.putColumnCells (rows, getVisBuffer()->visCubeModel());
     140             :     }
     141             : 
     142           0 :     columns_p.flag_p.putColumnCells (rows, getVisBuffer()->flagCube());
     143           0 :     columns_p.flagRow_p.putColumnCells (rows, getVisBuffer()->flagRow());
     144             : 
     145           0 :     columns_p.sigma_p.putColumnCells (rows, getVisBuffer()->sigma());
     146           0 :     columns_p.weight_p.putColumnCells (rows, getVisBuffer()->weight());
     147             : 
     148           0 :     if (! columns_p.weightSpectrum_p.isNull()){
     149           0 :         columns_p.weightSpectrum_p.putColumnCells (rows, getVisBuffer()->weightSpectrum());
     150             :     }
     151           0 : }
     152             : 
     153             : void
     154           0 : FinalTvi2::writeKeyValues (MeasurementSet & /*ms*/, const RefRows & rows)
     155             : {
     156             :     // Write out the values that are the database key for the VB rows.
     157             : 
     158           0 :     columns_p.antenna1_p.putColumnCells (rows, getVisBuffer()->antenna1());
     159             : 
     160           0 :     columns_p.antenna2_p.putColumnCells (rows, getVisBuffer()->antenna2());
     161             : 
     162           0 :     columns_p.feed1_p.putColumnCells (rows, getVisBuffer()->feed1());
     163             : 
     164           0 :     columns_p.feed2_p.putColumnCells (rows, getVisBuffer()->feed2());
     165             : 
     166           0 :     columns_p.dataDescription_p.putColumnCells (rows, getVisBuffer()->dataDescriptionIds());
     167             : 
     168           0 :     columns_p.processor_p.putColumnCells (rows, getVisBuffer()->processorId());
     169             : 
     170           0 :     columns_p.time_p.putColumnCells (rows, getVisBuffer()->time());
     171             : 
     172           0 :     columns_p.field_p.putColumnCells (rows, getVisBuffer()->fieldId());
     173           0 : }
     174             : 
     175             : void
     176           0 : FinalTvi2::writeMiscellaneousValues (MeasurementSet & /*ms*/, const RefRows & rows)
     177             : {
     178             :     // WRite out the non-key values for the rows contained in the VB.
     179             : 
     180           0 :     columns_p.timeInterval_p.putColumnCells (rows, getVisBuffer()->timeInterval());
     181             : 
     182           0 :     columns_p.exposure_p.putColumnCells (rows, getVisBuffer()->exposure());
     183             : 
     184           0 :     columns_p.timeCentroid_p.putColumnCells (rows, getVisBuffer()->timeCentroid());
     185             : 
     186           0 :     columns_p.scan_p.putColumnCells (rows, getVisBuffer()->scan());
     187             : 
     188           0 :     columns_p.array_p.putColumnCells (rows, getVisBuffer()->arrayId ());
     189             : 
     190           0 :     columns_p.observation_p.putColumnCells (rows, getVisBuffer()->observationId());
     191             : 
     192           0 :     columns_p.state_p.putColumnCells (rows, getVisBuffer()->stateId());
     193             : 
     194           0 :     columns_p.uvw_p.putColumnCells (rows, getVisBuffer()->uvw ());
     195           0 : }
     196             : 
     197             : void
     198           0 : FinalTvi2::writeFlag (const Matrix<Bool> & /*flag*/)
     199             : {
     200           0 :     Throw ("Not Implemented");
     201             : }
     202             : 
     203             : void
     204           0 : FinalTvi2::writeFlag (const Cube<Bool> & /*flag*/)
     205             : {
     206           0 :     Throw ("Not Implemented");
     207             : }
     208             : 
     209             : void
     210           0 : FinalTvi2::writeFlagRow (const Vector<Bool> & /*rowflags*/)
     211             : {
     212           0 :     Throw ("Not Implemented");
     213             : }
     214             : 
     215             : void
     216           0 : FinalTvi2::writeFlagCategory(const Array<Bool>& /*fc*/)
     217             : {
     218           0 :     Throw ("Not Implemented");
     219             : }
     220             : 
     221             : 
     222             : void
     223           0 : FinalTvi2::writeVisCorrected (const Cube<Complex> & /*vis*/)
     224             : {
     225           0 :     Throw ("Not Implemented");
     226             : }
     227             : void
     228           0 : FinalTvi2::writeVisModel (const Cube<Complex> & /*vis*/)
     229             : {
     230           0 :     Throw ("Not Implemented");
     231             : }
     232             : void
     233           0 : FinalTvi2::writeVisObserved (const Cube<Complex> & /*vis*/)
     234             : {
     235           0 :     Throw ("Not Implemented");
     236             : }
     237             : 
     238             : void
     239           0 : FinalTvi2::writeWeight (const Matrix<Float> & /*wt*/)
     240             : {
     241           0 :     Throw ("Not Implemented");
     242             : }
     243             : 
     244             : void
     245           0 : FinalTvi2::writeWeightSpectrum (const Cube<Float> & /*wtsp*/)
     246             : {
     247           0 :     Throw ("Not Implemented");
     248             : }
     249             : 
     250             : void
     251           0 : FinalTvi2::writeSigma (const Matrix<Float> & /*sig*/)
     252             : {
     253           0 :     Throw ("Not Implemented");
     254             : }
     255             : 
     256             : void
     257           0 : FinalTvi2::writeModel(const RecordInterface& /*rec*/, Bool /*iscomponentlist*/,
     258             :                       Bool /*incremental*/)
     259             : {
     260           0 :     Throw ("Not Implemented");
     261             : }
     262             : 
     263             : } // end namespace vi
     264             : 
     265             : } //# NAMESPACE CASA - END
     266             : 
     267             : 
     268             : 

Generated by: LCOV version 1.16