Commits
253 253 | std::vector<Vector<Double> > const &correctionFactorList, |
254 254 | std::vector<Int> const &indexForCorrection, |
255 255 | Cube<T> &inout, |
256 256 | int const numThreads |
257 257 | ) { |
258 258 | IPosition const shape = inout.shape(); |
259 259 | assert(shape[2] == static_cast<Int>(indexForCorrection.size())); |
260 260 | Bool b1; |
261 261 | T *p = inout.getStorage(b1); |
262 262 | // TODO: optimize condition for multi-threading |
263 - | |
263 + | |
264 264 | for (ssize_t ir = 0; ir < shape[2]; ++ir) { |
265 265 | Int const index = indexForCorrection[ir]; |
266 266 | if (index >= 0) { |
267 267 | Vector<Double> const &correctionFactor = correctionFactorList[index]; |
268 268 | Bool b2; |
269 269 | Double const *cp = correctionFactor.getStorage(b2); |
270 270 | ssize_t const offset = shape[0] * shape[1] * ir; |
271 271 | for (ssize_t ic = 0; ic < shape[1]; ++ic) { |
272 272 | ssize_t idx = offset + shape[0] * ic; |
273 273 | for (ssize_t ip = 0; ip < shape[0]; ++ip) { |
789 789 | os << LogIO::DEBUGGING << "disabling thresholds end " << LogIO::POST; |
790 790 | |
791 791 | std::map<SpwId, Vector<Double> > channelFreqsPerSpw; |
792 792 | std::map<SpwId, Vector<Double> > channelWidthsPerSpw; |
793 793 | for (auto i = processSpwList_.begin(); i != processSpwList_.end(); ++i) { |
794 794 | SpwId const spw = *i; |
795 795 | channelFreqsPerSpw[spw] = spectralWindowSubtablecols().chanFreq().get(spw); |
796 796 | channelWidthsPerSpw[spw] = spectralWindowSubtablecols().chanWidth().get(spw); |
797 797 | } |
798 798 | |
799 - | |
799 + | int const numThreads = min(numThreads_, static_cast<int>(processSpwList_.size())); |
800 + | |
800 801 | for (unsigned int i = 0; i < processSpwList_.size(); ++i) { |
801 802 | SpwId const spw = processSpwList_[i]; |
802 803 | |
803 804 | { |
804 805 | os << "creating SkyStatus for spw " << spw << LogIO::POST; |
805 806 | } |
806 807 | Vector<Double> cf = channelFreqsPerSpw[spw]; |
807 808 | Vector<Double> cw = channelWidthsPerSpw[spw]; |
808 809 | unsigned int nchan = cf.nelements(); |
809 810 | |