Source
1937
1937
}// end of chan loop
1938
1938
1939
1939
if( blankpsfs.length() >0 )
1940
1940
os << LogIO::WARN << "PSF is blank for" << blankpsfs << LogIO::POST;
1941
1941
1942
1942
//// Replace null (and bad) beams with the good one.
1943
1943
////GaussianBeam maxbeam = findGoodBeam(True);
1944
1944
1945
1945
//// Replace null beams by a tiny tiny beam, just to get past the ImageInfo restriction that
1946
1946
//// all planes must have non-null beams.
1947
-
//Quantity majax(1e-06,"arcsec"),minax(1e-06,"arcsec"),pa(0.0,"deg");
1947
+
1948
1948
GaussianBeam defaultbeam=itsPSFBeams.getMaxAreaBeam();
1949
-
//defaultbeam.setMajorMinor(majax,minax);
1950
-
//defaultbeam.setPA(pa);
1949
+
///many of the unittests in tsdimaging seem to depend on having 0 area beams
1950
+
///which throws and exception when it is stored in the image
1951
+
///(so setting them to some small number)!
1952
+
if(defaultbeam.getArea("rad2")==0.0){
1953
+
Quantity majax(1e-06,"arcsec"),minax(1e-06,"arcsec"),pa(0.0,"deg");
1954
+
defaultbeam.setMajorMinor(majax,minax);
1955
+
defaultbeam.setPA(pa);
1956
+
}
1951
1957
for( Int chanid=0; chanid<nchan;chanid++) {
1952
1958
for( Int polid=0; polid<npol; polid++ ) {
1953
1959
if( (itsPSFBeams.getBeam(chanid, polid)).isNull() )
1954
1960
{ itsPSFBeams.setBeam( chanid, polid, defaultbeam );
1955
1961
itsRestoredBeams.setBeam( chanid, polid, defaultbeam );
1956
1962
}
1957
1963
}// end of pol loop
1958
1964
}// end of chan loop
1959
1965
1960
1966
/*
2834
2840
{
2835
2841
LogIO os( LogOrigin("SIImageStore","calcRobustRMS",WHERE) );
2836
2842
Record* regionPtr=0;
2837
2843
String LELmask("");
2838
2844
ArrayLattice<Bool> pbmasklat(residual()->shape());
2839
2845
pbmasklat.set(False);
2840
2846
LatticeExpr<Bool> pbmask(pbmasklat);
2841
2847
if (hasPB()) {
2842
2848
// set bool mask: False = masked
2843
2849
pbmask = LatticeExpr<Bool> (iif(*pb() > pbmasklevel, True, False));
2850
+
os << LogIO::DEBUG1 << "pbmask to be attached===> nfalse(pbmask.getMask())="<<nfalse(pbmask.getMask())<<endl;
2844
2851
}
2845
2852
2846
2853
2847
2854
Record thestats;
2848
2855
if (fastcalc) { // older calculation
2849
-
thestats = SDMaskHandler::calcImageStatistics(*residual(), LELmask, regionPtr, True);
2856
+
// need to apply pbmask if present to be consistent between fastcalc = true and false.
2857
+
//TempImage<Float>* tempRes = new TempImage<Float>(residual()->shape(), residual()->coordinates(), SDMaskHandler::memoryToUse());
2858
+
auto tempRes = std::shared_ptr<TempImage<Float>>(new TempImage<Float>(residual()->shape(), residual()->coordinates(), SDMaskHandler::memoryToUse()));
2859
+
tempRes->copyData(*residual());
2860
+
tempRes->attachMask(pbmask);
2861
+
//thestats = SDMaskHandler::calcImageStatistics(*residual(), LELmask, regionPtr, True);
2862
+
thestats = SDMaskHandler::calcImageStatistics(*tempRes, LELmask, regionPtr, True);
2850
2863
}
2851
2864
else { // older way to calculate
2852
2865
// use the new statistic calculation algorithm
2853
2866
Vector<Bool> dummyvec;
2854
2867
// TT: 2018.08.01 using revised version (the older version of this is renameed to calcRobustImageStatisticsOld)
2855
2868
thestats = SDMaskHandler::calcRobustImageStatistics(*residual(), *mask(), pbmask, LELmask, regionPtr, True, dummyvec);
2856
2869
}
2857
2870
2858
2871
2859
2872
/***