Changeset 447 for trunk/src


Ignore:
Timestamp:
02/15/05 18:39:32 (20 years ago)
Author:
kil064
Message:

remove arg 'useSelection ' from rowAsmAskedArray as it
is never used and doesn't do the right thing and
that wrong thing is avaikable in getSpectrum !

Location:
trunk/src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/SDMemTable.cc

    r441 r447  
    307307}
    308308
    309 std::vector<bool> SDMemTable::getMask(Int whichRow) const {
     309std::vector<bool> SDMemTable::getMask(Int whichRow) const
     310{
     311
    310312  std::vector<bool> mask;
     313//
    311314  Array<uChar> arr;
    312315  flagsCol_.get(whichRow, arr);
     316//
    313317  ArrayAccessor<uChar, Axis<asap::BeamAxis> > aa0(arr);
    314318  aa0.reset(aa0.begin(uInt(beamSel_)));//go to beam
     
    429433  Vector<Float> outV = out.reform(vecShape);
    430434  return convertVector(outV);
    431 }
    432 
    433 std::vector<float> SDMemTable::getFloatSpectrum (const Array<Float>& arr) const
    434 //
    435 // Get spectrum at cursor location
    436 //
    437 {
    438 
    439 // Iterate and extract
    440 
    441   ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(arr);
    442   aa0.reset(aa0.begin(uInt(beamSel_)));//go to beam
    443   ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0);
    444   aa1.reset(aa1.begin(uInt(IFSel_)));// go to IF
    445   ArrayAccessor<Float, Axis<asap::PolAxis> > aa2(aa1);
    446   aa2.reset(aa2.begin(uInt(polSel_)));// go to pol
    447 //
    448   std::vector<float> spectrum;
    449   for (ArrayAccessor<Float, Axis<asap::ChanAxis> > i(aa2); i != i.end(); ++i) {
    450     spectrum.push_back(*i);
    451   }
    452   return spectrum;
    453435}
    454436
     
    638620  }
    639621
     622// Setup accessors
     623
    640624  ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(arr);
    641   aa0.reset(aa0.begin(uInt(beamSel_)));//go to beam
     625  aa0.reset(aa0.begin(uInt(beamSel_)));                   // Beam selection
    642626  ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0);
    643   aa1.reset(aa1.begin(uInt(IFSel_)));// go to IF
     627  aa1.reset(aa1.begin(uInt(IFSel_)));                     // IF selection
    644628  ArrayAccessor<Float, Axis<asap::PolAxis> > aa2(aa1);
    645   aa2.reset(aa2.begin(uInt(polSel_)));// go to pol
     629  aa2.reset(aa2.begin(uInt(polSel_)));                    // Pol selection
     630
     631// Iterate
    646632
    647633  std::vector<float>::iterator it = spectrum.begin();
     
    709695}
    710696*/
    711 MaskedArray<Float> SDMemTable::rowAsMaskedArray(uInt whichRow, Bool useSelection,
    712                                                 Bool toStokes) const
     697
     698MaskedArray<Float> SDMemTable::rowAsMaskedArray(uInt whichRow, Bool toStokes) const
    713699{
    714700
     
    718704  flagsCol_.get(whichRow, farr);
    719705
    720 // Get data and convert mask
     706// Get data and convert mask to Bool
    721707
    722708  Array<Float> arr;
    723709  Array<Bool> mask;
    724   uInt polSel = polSel_;
    725710  if (toStokes) {
    726711     stokesCol_.get(whichRow, arr);
     
    729714     convertArray(tMask, farr);
    730715     mask = SDPolUtil::stokesMask (tMask, True);
    731 //
    732      IPosition shape = arr.shape();
    733      uInt nPol = shape(asap::PolAxis);
    734      if (nPol<=2) polSel = 0;             // XX and XX,YY -> I
    735716  } else {
    736717     specCol_.get(whichRow, arr);
     
    739720  }
    740721//
    741   MaskedArray<Float> marr;
    742   if (useSelection) {
    743     ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(arr);
    744     aa0.reset(aa0.begin(uInt(beamSel_)));//go to beam
    745     ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0);
    746     aa1.reset(aa1.begin(uInt(IFSel_)));// go to IF
    747     ArrayAccessor<Float, Axis<asap::PolAxis> > aa2(aa1);
    748     aa2.reset(aa2.begin(uInt(polSel)));// go to pol
    749 
    750     ArrayAccessor<Bool, Axis<asap::BeamAxis> > baa0(mask);
    751     baa0.reset(baa0.begin(uInt(beamSel_)));//go to beam
    752     ArrayAccessor<Bool, Axis<asap::IFAxis> > baa1(baa0);
    753     baa1.reset(baa1.begin(uInt(IFSel_)));// go to IF
    754     ArrayAccessor<Bool, Axis<asap::PolAxis> > baa2(baa1);
    755     baa2.reset(baa2.begin(uInt(polSel)));// go to pol
    756 
    757     Vector<Float> a(arr.shape()(3));
    758     Vector<Bool> b(mask.shape()(3));
    759     ArrayAccessor<Float, Axis<asap::BeamAxis> > a0(a);
    760     ArrayAccessor<Bool, Axis<asap::BeamAxis> > b0(b);
    761 
    762     ArrayAccessor<Bool, Axis<asap::ChanAxis> > j(baa2);
    763     for (ArrayAccessor<Float, Axis<asap::ChanAxis> > i(aa2);
    764          i != i.end(); ++i) {
    765       (*a0) = (*i);
    766       (*b0) = !(*j);
    767       j++;
    768       a0++;
    769       b0++;
    770     }
    771     marr.setData(a,b);
    772   } else {
    773     marr.setData(arr,!mask);
    774   }
    775   return marr;
     722  return MaskedArray<Float>(arr,!mask);
    776723}
    777724
     
    17081655}
    17091656
     1657
     1658std::vector<float> SDMemTable::getFloatSpectrum (const Array<Float>& arr) const
     1659//
     1660// Get spectrum at cursor location
     1661//
     1662{
     1663
     1664// Setup accessors
     1665
     1666  ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(arr);
     1667  aa0.reset(aa0.begin(uInt(beamSel_)));                    // Beam selection
     1668
     1669  ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0);
     1670  aa1.reset(aa1.begin(uInt(IFSel_)));                      // IF selection
     1671
     1672  ArrayAccessor<Float, Axis<asap::PolAxis> > aa2(aa1);
     1673  aa2.reset(aa2.begin(uInt(polSel_)));                     // Pol selection
     1674//
     1675  std::vector<float> spectrum;
     1676  for (ArrayAccessor<Float, Axis<asap::ChanAxis> > i(aa2); i != i.end(); ++i) {
     1677    spectrum.push_back(*i);
     1678  }
     1679  return spectrum;
     1680}
     1681
  • trunk/src/SDMemTable.h

    r441 r447  
    205205  // return a row as a Masked array, internally converting uChar flags
    206206  // to bool mask
    207   casa::MaskedArray<casa::Float> rowAsMaskedArray(casa::uInt whichRow,
    208                                                   casa::Bool useSelection =
    209                                                   casa::False, casa::Bool
    210                                                   toStokes=casa::False) const;
     207  casa::MaskedArray<casa::Float> rowAsMaskedArray(casa::uInt whichRow,
     208                                                  casa::Bool toStokes=casa::False) const;
    211209
    212210  // Return SC, setting only the basic construction state (i.e.
Note: See TracChangeset for help on using the changeset viewer.