Commits
Sandra Castro authored df593485e74 Merge
674 674 | |
675 675 | void DelayRateFFT::removeAntennasCorrelation(Int icor, std::set< Int > s) { |
676 676 | std::set< Int > & as = activeAntennas_.find(icor)->second; |
677 677 | for (std::set< Int >::iterator it=s.begin(); it!=s.end(); it++) { |
678 678 | as.erase(*it); |
679 679 | } |
680 680 | } |
681 681 | |
682 682 | |
683 683 | // Start of GSL compliant solver |
684 - | // This function is supposed to evaluate the vector for xi-squared vector |
685 684 | |
686 685 | class AuxParamBundle { |
687 686 | public: |
688 687 | SDBList &sdbs; |
689 688 | size_t nCalls; |
690 689 | private: |
691 690 | // We make sure there are no copy or default constructors to |
692 691 | // preserve the integrity of our reference member. |
693 692 | AuxParamBundle(); |
694 693 | AuxParamBundle(AuxParamBundle const&); |
771 770 | } |
772 771 | return *(activeAntennas.find(activeCorr)->second.rbegin()); |
773 772 | } |
774 773 | // Sometimes there is Int, sometimes size_t; the following ones are casacore::Int. |
775 774 | Int |
776 775 | get_num_data_points() { |
777 776 | Int nTotalRows = 0; |
778 777 | for (Int i = 0; i != sdbs.nSDB(); i++) { |
779 778 | nTotalRows += sdbs(i).nRows(); |
780 779 | } |
781 - | return 2 * nTotalRows * nCorrelations * sdbs.nChannels(); |
780 + | return nTotalRows * sdbs.nChannels(); |
781 + | } |
782 + | Int |
783 + | get_actual_num_data_points() { |
784 + | Int nTotalRows = 0; |
785 + | for (Int i = 0; i != sdbs.nSDB(); i++) { |
786 + | SolveDataBuffer& s (sdbs(i)); |
787 + | for (Int irow=0; irow!=s.nRows(); irow++) { |
788 + | if (s.flagRow()(irow)) continue; |
789 + | nTotalRows++; |
790 + | } |
791 + | } |
792 + | return nTotalRows * sdbs.nChannels(); |
782 793 | } |
783 794 | size_t |
784 795 | get_data_corr_index(size_t icorr) { |
785 796 | if (icorr > nCorrelations) { |
786 797 | throw(AipsError("Correlation out of range.")); |
787 798 | } |
788 799 | size_t dcorr = icorr * corrStep; |
789 800 | return dcorr; |
790 801 | } |
791 802 | bool |
1653 1664 | continue; |
1654 1665 | } |
1655 1666 | if (bundle.get_num_antennas() == 1) { |
1656 1667 | logSink << "No baselines for correlation " << icor << "; not running least-squares solver." << LogIO::POST; |
1657 1668 | continue; |
1658 1669 | } |
1659 1670 | // Four parameters for every antenna, with dispersion |
1660 1671 | size_t p = bundle.nParameters() * (bundle.get_num_antennas() - 1); |
1661 1672 | // We need to store complex visibilities in a real matrix so we |
1662 1673 | // just store real and imaginary components separately. |
1663 - | size_t n = 2 * bundle.get_num_data_points(); |
1674 + | size_t n = 2 * bundle.get_actual_num_data_points(); |
1664 1675 | |
1665 1676 | if (DEVDEBUG) { |
1666 1677 | cerr << "bundle.nParameters() " << bundle.nParameters() |
1667 1678 | << " bundle.get_num_antennas() " <<bundle.get_num_antennas() << endl; |
1668 1679 | cerr << "p " << p << " n " << n << endl; |
1669 1680 | } |
1670 1681 | // Parameters for the least-squares solver. |
1671 1682 | // param_tol sets roughly the number of decimal places accuracy you want in the answer; |
1672 1683 | // I feel that 3 is probably plenty for fringe fitting. |
1673 1684 | // param_tol is not used |