- Timestamp:
- 02/15/05 18:39:32 (20 years ago)
- Location:
- trunk/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/SDMemTable.cc
r441 r447 307 307 } 308 308 309 std::vector<bool> SDMemTable::getMask(Int whichRow) const { 309 std::vector<bool> SDMemTable::getMask(Int whichRow) const 310 { 311 310 312 std::vector<bool> mask; 313 // 311 314 Array<uChar> arr; 312 315 flagsCol_.get(whichRow, arr); 316 // 313 317 ArrayAccessor<uChar, Axis<asap::BeamAxis> > aa0(arr); 314 318 aa0.reset(aa0.begin(uInt(beamSel_)));//go to beam … … 429 433 Vector<Float> outV = out.reform(vecShape); 430 434 return convertVector(outV); 431 }432 433 std::vector<float> SDMemTable::getFloatSpectrum (const Array<Float>& arr) const434 //435 // Get spectrum at cursor location436 //437 {438 439 // Iterate and extract440 441 ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(arr);442 aa0.reset(aa0.begin(uInt(beamSel_)));//go to beam443 ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0);444 aa1.reset(aa1.begin(uInt(IFSel_)));// go to IF445 ArrayAccessor<Float, Axis<asap::PolAxis> > aa2(aa1);446 aa2.reset(aa2.begin(uInt(polSel_)));// go to pol447 //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;453 435 } 454 436 … … 638 620 } 639 621 622 // Setup accessors 623 640 624 ArrayAccessor<Float, Axis<asap::BeamAxis> > aa0(arr); 641 aa0.reset(aa0.begin(uInt(beamSel_))); //go to beam625 aa0.reset(aa0.begin(uInt(beamSel_))); // Beam selection 642 626 ArrayAccessor<Float, Axis<asap::IFAxis> > aa1(aa0); 643 aa1.reset(aa1.begin(uInt(IFSel_))); // go to IF627 aa1.reset(aa1.begin(uInt(IFSel_))); // IF selection 644 628 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 646 632 647 633 std::vector<float>::iterator it = spectrum.begin(); … … 709 695 } 710 696 */ 711 MaskedArray<Float> SDMemTable::rowAsMaskedArray(uInt whichRow, Bool useSelection, 712 697 698 MaskedArray<Float> SDMemTable::rowAsMaskedArray(uInt whichRow, Bool toStokes) const 713 699 { 714 700 … … 718 704 flagsCol_.get(whichRow, farr); 719 705 720 // Get data and convert mask 706 // Get data and convert mask to Bool 721 707 722 708 Array<Float> arr; 723 709 Array<Bool> mask; 724 uInt polSel = polSel_;725 710 if (toStokes) { 726 711 stokesCol_.get(whichRow, arr); … … 729 714 convertArray(tMask, farr); 730 715 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 -> I735 716 } else { 736 717 specCol_.get(whichRow, arr); … … 739 720 } 740 721 // 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); 776 723 } 777 724 … … 1708 1655 } 1709 1656 1657 1658 std::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 205 205 // return a row as a Masked array, internally converting uChar flags 206 206 // 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; 211 209 212 210 // Return SC, setting only the basic construction state (i.e.
Note:
See TracChangeset
for help on using the changeset viewer.