Skip to content

Commit c577a6e

Browse files
committed
Merge branch 'wonly_cfc_fix' into 'main'
Fixes for W-only calications in coyote. See merge request ardg/libra!110
2 parents cf7cec9 + d1ea897 commit c577a6e

File tree

10 files changed

+131
-501
lines changed

10 files changed

+131
-501
lines changed

apps/src/Coyote/coyote.cc

Lines changed: 16 additions & 74 deletions
Original file line numberDiff line numberDiff line change
@@ -123,16 +123,11 @@ CountedPtr<refim::PolOuterProduct> setPOP(vi::VisBuffer2 &vb2,
123123
PolMapType polMat, polIndexMat, conjPolMat, conjPolIndexMat;
124124
Vector<Int> visPol(vb2.correlationTypes());
125125
polMat = pop_l->makePolMat(visPol,polMap);
126-
//cerr << visPol << " " << polMap << endl;
127126
polIndexMat = pop_l->makePol2CFMat(visPol,polMap);
128127

129128
conjPolMat = pop_l->makeConjPolMat(visPol,polMap);
130129
conjPolIndexMat = pop_l->makeConjPol2CFMat(visPol,polMap);
131130

132-
// cerr << "polMap: "; cerr << polMap << endl;
133-
// cerr << "visPolMap: "; cerr << visPolMap << endl;
134-
//------------------------a mess----------------------------------------------------
135-
136131
return pop_l;
137132
}
138133
//
@@ -216,28 +211,16 @@ void Coyote(//bool &restartUI, int &argc, char **argv,
216211
gethostname(hostname, HOST_NAME_MAX);
217212
string imageName=cfCacheName + "/uvgrid.im_" +
218213
to_string(getppid()) + "_"+string(hostname);
219-
bool wTerm = (nW > 1)? true : false;
214+
bool wTerm = (nW > 1);
220215

221216
//-------------------------------------------------------------------------------------------------
222217
// Instantiate AWCF object for making the CFs later.
223218
//
224-
CountedPtr<refim::PSTerm> PSTerm_l = new PSTerm();
225-
226-
CountedPtr<refim::ATerm> ATerm_l = AWProjectFT::createTelescopeATerm(telescopeName, aTerm);
227-
CountedPtr<refim::WTerm> WTerm_l = new WTerm();
228-
229-
ATerm_l->setConvSize(cfBufferSize);
230-
ATerm_l->setConvOversampling(cfOversampling);
231-
232-
if (nW==1) WTerm_l->setOpCode(CFTerms::NOOP);
233-
if (aTerm == false) ATerm_l->setOpCode(CFTerms::NOOP);
234-
if (psTerm == false) PSTerm_l->setOpCode(CFTerms::NOOP);
235-
236-
cerr << "coyote: " << conjBeams << endl;
237-
CountedPtr<refim::ConvolutionFunction> awcf_l
238-
= new AWConvFunc(ATerm_l, PSTerm_l ,WTerm_l ,WBAwp, conjBeams);
239-
240-
//AWProjectFT::makeCFObject(telescopeName, ATerm_l, PSTerm_l, WTerm_l, true, WBAwp, conjBeams);
219+
CountedPtr<refim::ConvolutionFunction> awcf_l =
220+
AWProjectFT::makeCFObject(telescopeName,
221+
aTerm, psTerm, wTerm, true,
222+
WBAwp, conjBeams,
223+
cfBufferSize,cfOversampling);
241224
//-------------------------------------------------------------------------------------------------
242225

243226
//-------------------------------------------------------------------------------------------------
@@ -261,15 +244,12 @@ void Coyote(//bool &restartUI, int &argc, char **argv,
261244
// or not.
262245
//
263246
cfCacheObj_l->setLazyFill(refim::SynthesisUtils::getenv("CFCache.LAZYFILL",1)==1);
264-
// cfCacheObj_l->setWtImagePrefix(imageNamePrefix.c_str());
265247
try
266248
{
267249
cfCacheObj_l->initCache2(false, dpa, -1.0,
268-
//casacore::String(imageNamePrefix)+casacore::String("CFS*")); // This would load CFs based on imageNamePrefix
269-
casacore::String("CFS*")); // This would load CFs based on imageNamePrefix
250+
casacore::String("CFS*")); // This would load CFs
270251
cfCacheObj_l->initCache2(false, dpa, -1.0,
271-
//casacore::String(imageNamePrefix)+casacore::String("WTCFS*")); // This would load WTCFs based on imageNamePrefix
272-
casacore::String("WTCFS*")); // This would load WTCFs based on imageNamePrefix
252+
casacore::String("WTCFS*")); // This would load WTCFs
273253
}
274254
catch (CFCIsEmpty& e)
275255
{
@@ -374,18 +354,6 @@ void Coyote(//bool &restartUI, int &argc, char **argv,
374354
// String targetName=String(cfCacheName);
375355
ImageInformation<Complex> imInfo(cgrid,casacore::String(cfCacheName));
376356
imInfo.save();
377-
// {
378-
// String csysFileName=cfCacheName+"/uvgrid_csys.rec";
379-
// String csysKey="uvgrid.csys";
380-
// IPosition imShape = cgrid.shape();
381-
// SynthesisUtils::saveAsRecord(cgrid.coordinates(),
382-
// imShape,
383-
// csysFileName, csysKey);
384-
// // Just a test for now to read the coorsys back into memory.
385-
// CoordinateSystem tt;
386-
// SynthesisUtils::readFromRecord(tt,imShape,csysFileName, csysKey);
387-
// cerr << "Imshape = " << imShape << endl;
388-
// }
389357
cgrid.table().markForDelete();
390358

391359
//-------------------------------------------------------------------------------------------------
@@ -420,26 +388,6 @@ void Coyote(//bool &restartUI, int &argc, char **argv,
420388
mssFreqSel.assign(filterByFirstColumn(mssFreqSel,db.spwidList.tovector()));
421389
awcf_l->setSpwFreqSelection(mssFreqSel);
422390

423-
// cerr << mssFreqSel << endl << "++++++++++++++++++++++++++++++" << endl;
424-
// cerr << db.spwidList << endl << "++++++++++++++++++++++++++++++" << endl;
425-
// std::vector<int> vec=db.spwidList.tovector();
426-
// std::vector<std::vector<double>> tt=filterByFirstColumn(mssFreqSel,vec);
427-
// // for(auto r:tt)
428-
// // {
429-
// // for(auto c : r)
430-
// // cerr << c << " ";
431-
// // cerr << endl;
432-
// // }
433-
// Matrix<double> mssFreqSelVB;
434-
// mssFreqSelVB.resize(tt.size(),4);
435-
// for(int i=0;i<tt.size();i++)
436-
// {
437-
// mssFreqSelVB.row(i)=casacore::Vector<double>(tt[i]);
438-
// }
439-
// cerr << mssFreqSelVB << endl;
440-
441-
//-------------------------------------------------------------------------------------------------
442-
// cerr << "CF Oversampling inside AWCF is : " << awcf_l->getOversampling() <<endl;
443391
// Get the PA from the MS/VB if UI setting is outside the valid
444392
// range for PA [-180, +180].
445393
if (abs(pa) > 180.0) pa=getPA(*(db.vb_l));
@@ -466,7 +414,7 @@ void Coyote(//bool &restartUI, int &argc, char **argv,
466414
// CFStore on the disk.
467415
//
468416
// [07Jan2024] In the dryrun mode, only the meta info is
469-
// written as casacore::Records conerted to
417+
// written as casacore::Records converted to
470418
// casacore::Tables. Writing these with multi-threadings
471419
// seems to be work. The bool parameter is therefore set to
472420
// true (it is false in the default interface).
@@ -480,24 +428,18 @@ void Coyote(//bool &restartUI, int &argc, char **argv,
480428
//
481429
// mode="fillcf" case. The list of CFs in the CFC are
482430
// expected to be "blank CFs" with all the necessary meta
483-
// information to fill them. Nothing else other than the CFC
484-
// is necessary.
431+
// information to fill them. Nothing else other than the
432+
// CFC and the list of CFs is necessary. An already filled
433+
// CF (the IsFilled=1 entry in CFS*/miscInfo.rec) will be
434+
// left untouched.
485435
//
486436
Vector<Double> dummyUVScale;
487437
Matrix<Double> dummyvbFreqSel;
488438
AWConvFunc::makeConvFunction2(cfCacheName,
489-
dummyUVScale,
490-
uvOffset,
491-
dummyvbFreqSel,
492-
*cfs2_l,
493-
*cfswt2_l,
494-
psTerm,
495-
aTerm,
496-
conjBeams);
439+
dummyUVScale, uvOffset, dummyvbFreqSel,
440+
*cfs2_l,*cfswt2_l,
441+
psTerm, aTerm, conjBeams);
497442
}
498-
// cerr << "CFS shapes: " << cfs2_l->getStorage()[0,0].shape() << " " << cfswt2_l->getStorage()[0,0].shape() << endl;
499-
// cfs2_l->show("CFStore",cerr,true);
500-
501443

502444
// Report some stats.
503445
Double memUsed=cfs2_l->memUsage();

src/synthesis/TransformMachines2/ATerm.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -138,10 +138,6 @@ namespace casa{
138138
virtual void getPolMap(casacore::Vector<casacore::Int>& polMap) {polMap.resize(0); polMap = polMap_p_base;};
139139
virtual casacore::Vector<casacore::Int> getAntTypeList() {casacore::Vector<casacore::Int> tt(1);tt(0)=0;return tt;};
140140

141-
virtual void setConvSize(const int convSize) {cachedConvSize_p=convSize;}
142-
virtual void setConvOversampling(const int os) {cachedOverSampling_p=os;}
143-
virtual casacore::Int getConvSize() {setConvSizeAndOversampling(cachedConvSize_p, cachedOverSampling_p);return cachedConvSize_p;};
144-
virtual casacore::Int getOversampling() {setConvSizeAndOversampling(cachedConvSize_p, cachedOverSampling_p);return cachedOverSampling_p;}
145141

146142
virtual casacore::Float getConvWeightSizeFactor() {return CONVWTSIZEFACTOR;};
147143
virtual casacore::Float getSupportThreshold() {return THRESHOLD;};

0 commit comments

Comments
 (0)