From 4758d63cbb5a12aa7d476e271b28cd18690e58b7 Mon Sep 17 00:00:00 2001 From: Ger van Diepen <diepen@astron.nl> Date: Thu, 6 Oct 2011 14:21:03 +0000 Subject: [PATCH] bug 1684: fixed problem with getting spheroid and pb --- .../include/LofarFT/LofarConvolutionFunction.h | 7 +++++++ CEP/Imager/LofarFT/src/LofarConvolutionFunction.cc | 12 ++++++++++++ CEP/Imager/LofarFT/src/awimager.cc | 12 +++++++----- 3 files changed, 26 insertions(+), 5 deletions(-) diff --git a/CEP/Imager/LofarFT/include/LofarFT/LofarConvolutionFunction.h b/CEP/Imager/LofarFT/include/LofarFT/LofarConvolutionFunction.h index 914086565a1..4bf2c5640ff 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 3e16b4013ca..226fda025de 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 5f97da08d7e..cade697ea08 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; -- GitLab