Commits

Neal Schweighart authored 225ab7e1574 Merge
Merge branch 'master' into CAS-13526

casa5/code/synthesis/ImagerObjects/CubeMajorCycleAlgorithm.cc

Modified
483 483 Int endmodchan=(chanEnd+2) < nchannels ? chanEnd+2 : nchannels-1 ;
484 484 //cerr << "START END mod " << startmodchan << " " << endmodchan << endl;
485 485 //Darn has to lock it as writable because overlap in SIMapperCollection code
486 486 //wants that...though we are not really modifying it here
487 487 //Bool writeisneeded=(imSel_p.nelements()!=1 || startmodel_p[imId].nelements() >0);
488 488 //PagedImage<Float> model(modelnames[imId], TableLock::UserNoReadLocking);
489 489 //submodel.reset(SpectralImageUtil::getChannel(model, startmodchan, endmodchan, writeisneeded));
490 490 getSubImage(submodel, startmodchan, endmodchan, modelnames[imId], True);
491 491 //
492 492 if(Table::isReadable(weightNames_p[imId])){
493 - divideModelByWeight(submodel, startmodchan, endmodchan, weightNames_p[imId]);
493 + divideModelByWeight(imSel_p[imId].imageName, submodel, startmodchan, endmodchan, weightNames_p[imId]);
494 494 }
495 495 //ImageInterface<Float>* modim=new PagedImage<Float>(modelnames[imId], TableLock::UserNoReadLocking);
496 496 //submodel.reset(modim);
497 497
498 498 }
499 499
500 500 }
501 501
502 502 }
503 503
504 504 if(Table::isReadable(weightNames_p[imId])){
505 505 //PagedImage<Float> weight(weightnames[imId], TableLock::UserNoReadLocking);
506 506 //subweight.reset(SpectralImageUtil::getChannel(weight, chanBeg, chanEnd, true));
507 507 getSubImage(subweight, chanBeg, chanEnd, weightNames_p[imId], True);
508 508 }
509 509 shared_ptr<ImageInterface<Float> >subsumwt=nullptr;
510 510 // subsumwt.reset(SpectralImageUtil::getChannel(sumwt, chanBeg, chanEnd, true));
511 511 getSubImage(subsumwt, chanBeg, chanEnd, sumwgtname, True);
512 512 bool useweightimage=(subweight) ? true : false;
513 - shared_ptr<SIImageStore> subimstor(new SimpleSIImageStore(submodel, subresid, subpsf, subweight, nullptr, nullptr, subsumwt, nullptr, subpb, nullptr, nullptr, useweightimage));
513 + shared_ptr<SIImageStore> subimstor(new SimpleSIImageStore(imSel_p[imId].imageName, submodel, subresid, subpsf, subweight, nullptr, nullptr, subsumwt, nullptr, subpb, nullptr, nullptr, useweightimage));
514 514 if(polRep_p[imId]< 0)
515 515 throw(AipsError("data polarization type is not defined"));
516 516 StokesImageUtil::PolRep polrep=(StokesImageUtil::PolRep)polRep_p[imId];
517 517 subimstor->setDataPolFrame(polrep);
518 518 if(startmodel_p[imId].nelements() >0){
519 519 LatticeLocker lock1 (*(subimstor->model()), FileLocker::Write);
520 520 subimstor->setModelImage(startmodel_p[imId]);
521 521 }
522 522 //cerr << "subimagestor TYPE" << subimstor->getType() << endl;
523 523 return subimstor;
536 536 }
537 537 nterms=(nterms+1)/2;
538 538 nterms_p[imId]=nterms;
539 539 shared_ptr<SIImageStore> subimstor(new SIImageStoreMultiTerm(imSel_p[imId].imageName, nterms, True));
540 540 if(polRep_p[imId]< 0)
541 541 throw(AipsError("data polarization type is not defined"));
542 542 StokesImageUtil::PolRep polrep=(StokesImageUtil::PolRep)polRep_p[imId];
543 543 subimstor->setDataPolFrame(polrep);
544 544 return subimstor;
545 545 }
546 - void CubeMajorCycleAlgorithm::divideModelByWeight(shared_ptr<ImageInterface<Float> >&submodel, const Int startchan, const Int endchan, const String weightname){
546 + void CubeMajorCycleAlgorithm::divideModelByWeight(casacore::String imageName, shared_ptr<ImageInterface<Float> >&submodel, const Int startchan, const Int endchan, const String weightname){
547 547 if(controlRecord_p.isDefined("dividebyweight") && controlRecord_p.asBool("dividebyweight")){
548 548 if(controlRecord_p.isDefined("normpars")){
549 549 Record normpars=controlRecord_p.asRecord("normpars");
550 550 SynthesisNormalizer norm;
551 551 norm.setupNormalizer(normpars);
552 552 shared_ptr<ImageInterface<Float> > subweight=nullptr;
553 553 getSubImage(subweight, startchan, endchan, weightname, True);
554 554 LatticeLocker lock1(*(subweight), FileLocker::Read);
555 555 LatticeLocker lock2(*(submodel), FileLocker::Read);
556 - std::shared_ptr<SIImageStore> subimstor(new SimpleSIImageStore(submodel, nullptr, nullptr, subweight, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, True));
556 + std::shared_ptr<SIImageStore> subimstor(new SimpleSIImageStore(imageName, submodel, nullptr, nullptr, subweight, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, nullptr, True));
557 557 norm.setImageStore(subimstor);
558 558 norm.divideModelByWeight();
559 559
560 560 }
561 561 }
562 562 }
563 563
564 564
565 565
566 566

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

Add shortcut