Commits

Sanjay Bhatnagar authored 797442520c2
Set the pbshape to 2x2 pixes for isDryRun=True in fillConvFunction(). This reduces the run time for "blank" CF computations from hours to minutes.

This also required setting the ref. pixel in makeFTCoord() method to be size of the CF buffer. This should not be required, but it is. The code in this method should be refactored and cleaned up soon.

code/synthesis/TransformMachines2/AWConvFunc.cc

Modified
241 241 // uvScale_l(2) = 0.0;
242 242
243 243 // //Hints that only uvScale needs to be updated in PSTerm.
244 244 // IPosition dummy;
245 245 // Vector<Double> dummyoffset;
246 246 // Double pss = -1;
247 247 // //cerr << "############ " << freqValues(inu) << " " << skyIncr << skyNX << " " << uvScale_l << endl;
248 248 // psTerm.reinit(dummy, uvScale_l, dummyoffset,pss);
249 249 // }
250 250
251 - IPosition pbshp(4,nx,ny,1,1);
251 +
252 + IPosition pbshp(4,nx, ny,1,1);
253 + // Set the shape to 2x2 pixel images for dry gridding
254 + if (isDryRun) pbshp[0]=pbshp[1]=2;
255 +
252 256 //
253 257 // Cache the A-Term for this polarization and frequency
254 258 //
255 259 Double conjFreq=SynthesisUtils::conjFreq(freqValues(inu),imRefFreq_p);
256 260 Int conjFreqIndex;
257 261 conjFreq=SynthesisUtils::nearestValue(freqValues, conjFreq, conjFreqIndex);
258 262
259 263 // cout<<"Muller Array = "<<muellerElements(imx)(imy)<<"\n" ;
260 264 // USEFUL DEBUG MESSAGE
261 265 // cerr << "Freq. values: "
368 372
369 373 //Timer tim;
370 374 //tim.mark();
371 375 if (psTerm.isNoOp() || isDryRun)
372 376 cfBufMat = cfWtBufMat = 1.0;
373 377 else
374 378 {
375 379 //psTerm.applySky(cfBufMat, false); // Assign (psScale set in psTerm.init()
376 380 //psTerm.applySky(cfWtBufMat, false); // Assign
377 381 psTerm.applySky(cfBufMat, s, cfBufMat.shape()(0)/s(0)); // Assign (psScale set in psTerm.init()
378 - psTerm.applySky(cfWtBufMat, s, cfWtBufMat.shape()(0)/s(0)); // Assign
382 + psTerm.applySky(cfWtBufMat, s, cfWtBufMat.shape()(0)/s(0)); // Assign
379 383
380 384 cfWtBuf *= cfWtBuf;
381 385 }
382 386 //tim.show("PSTerm*2: ");
383 387
384 388 // WBAWP CODE BEGIN -- make PS*PS for Weights
385 389 // psTerm.applySky(cfWtBufMat, true); // Multiply
386 390 // WBAWP CODE END
387 391
388 392 // psTerm.applySky(cfBufMat, s, inner/2.0);//pbshp(0)/(os));
516 520 //log_l << "CF WT Support: " << xSupport << " (" << xSupportWt << ") " << "pixels" << LogIO::POST;
517 521 //tim.show("Resize:");
518 522
519 523 //tim.mark();
520 524 Vector<Double> ftRef(2);
521 525 // ftRef(0)=cfWtBuf.shape()(0)/2-1;
522 526 // ftRef(1)=cfWtBuf.shape()(1)/2-1;
523 527 ftRef(0)=cfWtBuf.shape()(0)/2.0;
524 528 ftRef(1)=cfWtBuf.shape()(1)/2.0;
525 529 CoordinateSystem ftCoords=cs_l;
526 - SynthesisUtils::makeFTCoordSys(cs_l, cfWtBuf.shape()(0), ftRef, ftCoords);
530 + if (isDryRun)
531 + {
532 + ftRef(0)=nx/2.0;
533 + ftRef(1)=ny/2.0;
534 + SynthesisUtils::makeFTCoordSys(cs_l, nx,ftRef , ftCoords);
535 + }
536 + else
537 + SynthesisUtils::makeFTCoordSys(cs_l, cfWtBuf.shape()(0), ftRef, ftCoords);
538 +
527 539 CountedPtr<CFCell> cfCellPtr;
528 540 cfWtb.setParams(inu,iw,imx,imy,//muellerElements(imx)(imy),
529 541 freqValues(inu), String(""), wValues(iw), muellerElements(imx)(imy),
530 542 ftCoords, samplingWt, xSupportWt, ySupportWt,
531 543 String(""), // Default ==> don't set it in the CFCell
532 544 conjFreq, conjPol[0]);
533 545
534 546 cfCellPtr = cfWtb.getCFCellPtr(freqValues(inu), wValues(iw),
535 547 muellerElements(imx)(imy));
536 548 cfCellPtr->pa_p=Quantity(vbPA,"rad");
584 596 //tim.show("Area*2:");
585 597
586 598 //tim.mark();
587 599 if (cfNorm != Complex(0.0)) cfBuf /= cfNorm;
588 600 if (cfWtNorm != Complex(0.0)) cfWtBuf /= cfWtNorm;
589 601
590 602 //tim.show("cfNorm*2:");
591 603
592 604 //tim.mark();
593 605 ftCoords=cs_l;
594 - SynthesisUtils::makeFTCoordSys(cs_l, cfBuf.shape()(0), ftRef, ftCoords);
606 + if (isDryRun)
607 + {
608 + ftRef(0) = nx/2.0;
609 + ftRef(1) = ny/2.0;
610 + SynthesisUtils::makeFTCoordSys(cs_l, nx, ftRef, ftCoords);
611 + }
612 + else
613 + SynthesisUtils::makeFTCoordSys(cs_l, cfBuf.shape()(0), ftRef, ftCoords);
614 +
595 615 cfb.setParams(inu,iw,imx,imy,//muellerElements(imx)(imy),
596 616 freqValues(inu), String(""), wValues(iw), muellerElements(imx)(imy),
597 617 ftCoords, sampling, xSupport, ySupport,
598 618 String(""), // Default ==> Don't set in the CFCell
599 619 conjFreq, conjPol[0]);
600 620 cfCellPtr=cfb.getCFCellPtr(freqValues(inu), wValues(iw),
601 621 muellerElements(imx)(imy));
602 622 cfCellPtr->pa_p=Quantity(vbPA,"rad");
603 623 cfCellPtr->telescopeName_p = aTerm.getTelescopeName();
604 624 cfCellPtr->isRotationallySymmetric_p = aTerm.isNoOp();

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

Add shortcut