Skip to content
Snippets Groups Projects
Commit 98107e2b authored by Wuttke, Joachim's avatar Wuttke, Joachim
Browse files

use it in convolution

parent e9cd4f47
No related branches found
No related tags found
1 merge request!2025provide Datafield::setVector2D, and use it in convolution
Pipeline #115214 passed
...@@ -92,7 +92,7 @@ void ConvolutionDetectorResolution::apply1dConvolution(Datafield* df) const ...@@ -92,7 +92,7 @@ void ConvolutionDetectorResolution::apply1dConvolution(Datafield* df) const
// Truncate negative values that can arise because of finite precision of Fourier Transform // Truncate negative values that can arise because of finite precision of Fourier Transform
for (double& e : result) for (double& e : result)
e = std::max(0.0, e); e = std::max(0.0, e);
// Populate intensity map with results
df->setVector(result); df->setVector(result);
} }
...@@ -124,17 +124,12 @@ void ConvolutionDetectorResolution::apply2dConvolution(Datafield* df) const ...@@ -124,17 +124,12 @@ void ConvolutionDetectorResolution::apply2dConvolution(Datafield* df) const
} }
kernel[ix] = row_vector; kernel[ix] = row_vector;
} }
// Calculate convolution // Calculate convolution
std::vector<std::vector<double>> result; std::vector<std::vector<double>> result;
Convolve().fftconvolve(df->values2D(), kernel, result); Convolve().fftconvolve(df->values2D(), kernel, result);
// Populate intensity map with results df->setVector2D(result);
ASSERT(nx * ny == df->size());
for (size_t i = 0; i < df->size(); ++i) {
size_t i0 = df->frame().projectedIndex(i, 0);
size_t i1 = df->frame().projectedIndex(i, 1);
(*df)[i] = std::max(0.0, result[i0][i1]);
}
} }
double ConvolutionDetectorResolution::getIntegratedPDF1d(double x, double step) const double ConvolutionDetectorResolution::getIntegratedPDF1d(double x, double step) const
......
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