Skip to content
Snippets Groups Projects
Commit 4758d63c authored by Ger van Diepen's avatar Ger van Diepen
Browse files

bug 1684: fixed problem with getting spheroid and pb

parent 5405bffe
No related branches found
No related tags found
No related merge requests found
...@@ -94,6 +94,13 @@ namespace LOFAR ...@@ -94,6 +94,13 @@ namespace LOFAR
// Get the spheroidal cut. // Get the spheroidal cut.
const Matrix<Float>& getSpheroidCut(); 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, // 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. // and append it to a map object with a (double time) key.
void computeAterm(Double time); void computeAterm(Double time);
......
...@@ -828,6 +828,18 @@ namespace LOFAR ...@@ -828,6 +828,18 @@ namespace LOFAR
return Spheroid_cut_im; 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 // 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. // coordinates and shape. The resolution is assumed to be the same on both direction axes.
......
...@@ -163,6 +163,7 @@ void applyFactors (PagedImage<Float>& image, const Array<Float>& factors) ...@@ -163,6 +163,7 @@ void applyFactors (PagedImage<Float>& image, const Array<Float>& factors)
{ {
Array<Float> data; Array<Float> data;
image.get (data); image.get (data);
/// cout << "apply factor to " << data.data()[0] << ' ' << factors.data()[0]<<endl;
// Loop over channels // Loop over channels
for (ArrayIterator<Float> iter1(data, 3); !iter1.pastEnd(); iter1.next()) { for (ArrayIterator<Float> iter1(data, 3); !iter1.pastEnd(); iter1.next()) {
// Loop over Stokes. // Loop over Stokes.
...@@ -173,10 +174,11 @@ void applyFactors (PagedImage<Float>& image, const Array<Float>& factors) ...@@ -173,10 +174,11 @@ void applyFactors (PagedImage<Float>& image, const Array<Float>& factors)
} }
} }
image.put (data); image.put (data);
/// cout << "applied factor to " << data.data()[0] << ' ' << factors.data()[0]<<endl;
} }
void correctImages (const String& restoName, const String& modelName, void correctImages (const String& restoName, const String& modelName,
const String& residName, const String& residName, const String& imgName,
LOFAR::LofarImager& imager) LOFAR::LofarImager& imager)
{ {
// Copy the images to .corr ones. // Copy the images to .corr ones.
...@@ -196,8 +198,8 @@ void correctImages (const String& restoName, const String& modelName, ...@@ -196,8 +198,8 @@ void correctImages (const String& restoName, const String& modelName,
restoredImage.shape() == modelImage.shape(), SynthesisError); restoredImage.shape() == modelImage.shape(), SynthesisError);
// Get average primary beam and spheroidal. // Get average primary beam and spheroidal.
const Matrix<Float>& avgPB = imager.getAveragePB(); Matrix<Float> avgPB = LOFAR::LofarConvolutionFunction::getAveragePB(imgName);
const Matrix<Float>& spheroidCut = imager.getSpheroidCut(); Matrix<Float> spheroidCut = LOFAR::LofarConvolutionFunction::getSpheroidCut(imgName);
// String nameii(imgName + ".spheroid_cut_im"); // String nameii(imgName + ".spheroid_cut_im");
//ostringstream nameiii(nameii); //ostringstream nameiii(nameii);
//PagedImage<Float> restoredImageiii(nameiii.str().c_str()); //PagedImage<Float> restoredImageiii(nameiii.str().c_str());
...@@ -723,10 +725,10 @@ int main (Int argc, char** argv) ...@@ -723,10 +725,10 @@ int main (Int argc, char** argv)
Vector<String>(1, psfName)); // psf Vector<String>(1, psfName)); // psf
} }
// Do the final correction for primary beam and spheroidal. // Do the final correction for primary beam and spheroidal.
correctImages (restoName, modelName, residName, imager); correctImages (restoName, modelName, residName, imgName, imager);
precTimer.stop(); precTimer.stop();
timer.show ("clean"); timer.show ("clean");
imager.showTimings (cout, precTimer.getReal()); /// imager.showTimings (cout, precTimer.getReal());
// Convert result to fits if needed. // Convert result to fits if needed.
if (! fitsName.empty()) { if (! fitsName.empty()) {
String error; String error;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment