Commits

Kumar Golap authored c185f869f9a
Fixed an issue with interpolated channels gaps in frequency

casatools/src/code/synthesis/TransformMachines2/AWConvFuncHolder.cc

Modified
339 339
340 340 return convSupport_p;
341 341 }
342 342
343 343 /////////////////////
344 344 void AWConvFuncHolder::getConvFuncs(Vector<Int> &polMap, Vector<Int> &chanMap,
345 345 Vector<Int> &rowMap,
346 346 Array<Complex> &convFunc,
347 347 Array<Complex> &wgtConvFunc,
348 348 const vi::VisBuffer2 &vb,
349 - const Matrix<Double> &rotuvw) {
349 + const Matrix<Double> &rotuvw,
350 + const Vector<Double> & interpFreqs) {
350 351
351 352 Vector<Int> cmap;
352 353 Vector<Int> pmap;
353 354 Vector<Int> rmap;
354 - getConvIndices(pmap, cmap, rmap, vb, rotuvw);
355 + getConvIndices(pmap, cmap, rmap, vb, rotuvw, interpFreqs);
355 356 //cerr << "pmap "<< pmap << endl;
356 357 //cerr << "MIN Max rmap" << min(rmap) << " " << max(rmap) << endl;
357 358 std::vector<Int> pmapused = pmap.tovector();
358 359 {
359 360 std::sort(pmapused.begin(), pmapused.end());
360 361 auto last = std::unique(pmapused.begin(), pmapused.end());
361 362 pmapused.erase(last, pmapused.end());
362 363 }
363 364 std::vector<Int> cmapused = cmap.tovector();
364 365 {
442 443 : conj(convFunc_p(inblc, intrc));
443 444 wgtConvFunc(outblc, outtrc) = wgtConvFunc_p(inblc, intrc);
444 445 }
445 446 }
446 447 }
447 448 }
448 449 //////////////////////
449 450
450 451
451 452 //////////////////////
452 -void AWConvFuncHolder::getConvIndices(Vector<Int>& polMap, Vector<Int>& chanMap, Vector<Int>& rowMap, const vi::VisBuffer2& vb, const Matrix<Double>& rotuvw) {
453 +void AWConvFuncHolder::getConvIndices(Vector<Int>& polMap, Vector<Int>& chanMap, Vector<Int>& rowMap, const vi::VisBuffer2& vb, const Matrix<Double>& rotuvw, const Vector<Double>& interpFreqs) {
453 454 // Lets do the polmap
454 455 Vector<Stokes::StokesTypes> visPolMap(vb.getCorrelationTypesSelected());
455 456 polMap.resize(visPolMap.nelements());
456 457 polMap.set(-1);
457 458 if (!dosquint_p)
458 459 polMap.set(0);
459 460 else{
460 461 for (uint k = 0; k < polMap.nelements(); ++k) {
461 462 for (uint j = 0; j < polVals_p.nelements(); ++j) {
462 463 if (visPolMap[k] == polVals_p[j])
463 464 polMap[k] = j;
464 465 }
465 466 }
466 467 }
467 468 // Lets do chanMap
468 - chanMap.resize(vb.nChannels());
469 + chanMap.resize(interpFreqs.nelements());
469 470 chanMap.set(-1);
470 - Vector<Double>visFreq = vb.getFrequencies(0);
471 + Vector<Double>visFreq = interpFreqs;
471 472 for (uint k = 0; k < chanMap.nelements(); ++k) {
472 473 Double minDiff = 1e40;
473 474 Int indexF = -1;
474 475 for (uint j = 0; j < freqVals_p.nelements(); ++j) {
475 476 if (fabs(freqVals_p[j] -visFreq[k]) < minDiff) {
476 477 minDiff = fabs(freqVals_p[j] -visFreq[k]);
477 478 indexF = j;
478 479 }
479 480 }
480 481 chanMap[k] = indexF;

Everything looks good. We'll let you know here if there's anything you should know about.

Add shortcut