diff --git a/CEP/Imager/LofarFT/include/LofarFT/LofarConvolutionFunction.h b/CEP/Imager/LofarFT/include/LofarFT/LofarConvolutionFunction.h index 914086565a126a9f26be8ea7fea3ba1d95df2d5e..4bf2c5640ffcf674b4865a73fe015b9d38e0fdf9 100644 --- a/CEP/Imager/LofarFT/include/LofarFT/LofarConvolutionFunction.h +++ b/CEP/Imager/LofarFT/include/LofarFT/LofarConvolutionFunction.h @@ -94,6 +94,13 @@ namespace LOFAR // Get the spheroidal cut. const Matrix<Float>& getSpheroidCut(); + // Get the spheroidal cut from the file. + static Matrix<Float> getSpheroidCut (const String& imgName); + + // Get the average PB from the file. + static Matrix<Float> getAveragePB (const String& imgName); + + // Compute the fft of the beam at the minimal resolution for all antennas, // and append it to a map object with a (double time) key. void computeAterm(Double time); diff --git a/CEP/Imager/LofarFT/src/LofarConvolutionFunction.cc b/CEP/Imager/LofarFT/src/LofarConvolutionFunction.cc index 3e16b4013caef8801aa39083a036ebb7640b6021..226fda025dea172629ae5f81ec81636f5b1a5259 100644 --- a/CEP/Imager/LofarFT/src/LofarConvolutionFunction.cc +++ b/CEP/Imager/LofarFT/src/LofarConvolutionFunction.cc @@ -828,6 +828,18 @@ namespace LOFAR return Spheroid_cut_im; } + Matrix<Float> LofarConvolutionFunction::getSpheroidCut (const String& imgName) + { + PagedImage<Float> im(imgName+".spheroid_cut_im"); + return im.get (True); + } + + Matrix<Float> LofarConvolutionFunction::getAveragePB (const String& imgName) + { + PagedImage<Float> im(imgName+".avgpb"); + return im.get (True); + } + //================================================= // Return the angular resolution required for making the image of the angular size determined by // coordinates and shape. The resolution is assumed to be the same on both direction axes. diff --git a/CEP/Imager/LofarFT/src/awimager.cc b/CEP/Imager/LofarFT/src/awimager.cc index 5f97da08d7e23524b82c1d0c1132c91516475f2f..cade697ea0836d0a9564786bc8a27d9ad6bf99dd 100644 --- a/CEP/Imager/LofarFT/src/awimager.cc +++ b/CEP/Imager/LofarFT/src/awimager.cc @@ -163,6 +163,7 @@ void applyFactors (PagedImage<Float>& image, const Array<Float>& factors) { Array<Float> data; image.get (data); + /// cout << "apply factor to " << data.data()[0] << ' ' << factors.data()[0]<<endl; // Loop over channels for (ArrayIterator<Float> iter1(data, 3); !iter1.pastEnd(); iter1.next()) { // Loop over Stokes. @@ -173,10 +174,11 @@ void applyFactors (PagedImage<Float>& image, const Array<Float>& factors) } } image.put (data); + /// cout << "applied factor to " << data.data()[0] << ' ' << factors.data()[0]<<endl; } void correctImages (const String& restoName, const String& modelName, - const String& residName, + const String& residName, const String& imgName, LOFAR::LofarImager& imager) { // Copy the images to .corr ones. @@ -196,8 +198,8 @@ void correctImages (const String& restoName, const String& modelName, restoredImage.shape() == modelImage.shape(), SynthesisError); // Get average primary beam and spheroidal. - const Matrix<Float>& avgPB = imager.getAveragePB(); - const Matrix<Float>& spheroidCut = imager.getSpheroidCut(); + Matrix<Float> avgPB = LOFAR::LofarConvolutionFunction::getAveragePB(imgName); + Matrix<Float> spheroidCut = LOFAR::LofarConvolutionFunction::getSpheroidCut(imgName); // String nameii(imgName + ".spheroid_cut_im"); //ostringstream nameiii(nameii); //PagedImage<Float> restoredImageiii(nameiii.str().c_str()); @@ -723,10 +725,10 @@ int main (Int argc, char** argv) Vector<String>(1, psfName)); // psf } // Do the final correction for primary beam and spheroidal. - correctImages (restoName, modelName, residName, imager); + correctImages (restoName, modelName, residName, imgName, imager); precTimer.stop(); timer.show ("clean"); - imager.showTimings (cout, precTimer.getReal()); + /// imager.showTimings (cout, precTimer.getReal()); // Convert result to fits if needed. if (! fitsName.empty()) { String error;