diff --git a/src/pyFAI/opencl/azim_csr.py b/src/pyFAI/opencl/azim_csr.py index 49f907adf..5ac301e9b 100644 --- a/src/pyFAI/opencl/azim_csr.py +++ b/src/pyFAI/opencl/azim_csr.py @@ -42,6 +42,7 @@ else: raise ImportError("pyopencl is not installed") from ..containers import Integrate1dtpl, Integrate2dtpl, ErrorModel +from ..utils import EPS32 from . import processing, OpenclProcessing EventDescription = processing.EventDescription BufferDescription = processing.BufferDescription @@ -1220,12 +1221,14 @@ def medfilt(self, data, dark=None, dummy=None, delta_dummy=None, events.append(EventDescription(kernel_correction_name, ev)) kw_int["quant_min"] = numpy.float32(quant_min) - kw_int["quant_max"] = numpy.float32(quant_max) + kw_int["quant_max"] = numpy.float32(quant_max)*EPS32 wg_min = max(self.workgroup_size["csr_medfilt"]) kw_int["shared_int"] = pyopencl.LocalMemory(4 * wg_min) kw_int["shared_float"] = pyopencl.LocalMemory(8 * wg_min) wdim_bins = (wg_min, self.bins) + + integrate = self.kernels.csr_medfilt(self.queue, wdim_bins, (wg_min,1), *kw_int.values()) events.append(EventDescription("medfilt", integrate)) diff --git a/src/pyFAI/opencl/test/test_ocl_azim_csr.py b/src/pyFAI/opencl/test/test_ocl_azim_csr.py index 707416028..cdabfc58f 100644 --- a/src/pyFAI/opencl/test/test_ocl_azim_csr.py +++ b/src/pyFAI/opencl/test/test_ocl_azim_csr.py @@ -119,7 +119,7 @@ def integrate_ng(self, block_size=None, method_called="integrate_ng", extra=None elif method_called=="medfilt": pix = csr[2][1:]-csr[2][:-1] for i,j in zip(pix,res.count): - print(j-i,i,j) + print(i, j, i-j) # Intensities are not that different: delta = ref.intensity - res.intensity @@ -159,7 +159,7 @@ def test_medfilt(self): """ tests the median filtering kernel, default block size """ - self.integrate_ng(None, "medfilt", {"quant_min":0, "quant_max":1}) + self.integrate_ng(None, "medfilt", {"quant_min":0, "quant_max":1.0}) def suite(): diff --git a/src/pyFAI/resources/openCL/medfilt.cl b/src/pyFAI/resources/openCL/medfilt.cl index 00df7a673..11d29520e 100644 --- a/src/pyFAI/resources/openCL/medfilt.cl +++ b/src/pyFAI/resources/openCL/medfilt.cl @@ -202,6 +202,11 @@ csr_medfilt ( const global float4 *data4, acc_var = dw_plus_fp(acc_var, w.s2); acc_nrm = dw_plus_fp(acc_nrm, w.s3); acc_nrm2 = dw_plus_dw(acc_nrm2, fp_times_fp(w.s3, w.s3)); + + } + else{ + printf("bin:%d tid:%d qmin:%6.3f qlast:%6.3f qcur:%6.3f qmax:%6.3f\n", + bin_num, tid, qmin, q_last, w.s0,qmax); } } // Now parallel reductions, one after the other :-/