Skip to content

Commit

Permalink
Fix upper limit noise
Browse files Browse the repository at this point in the history
  • Loading branch information
kif committed Dec 5, 2024
1 parent df29436 commit 7b6300f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
5 changes: 4 additions & 1 deletion src/pyFAI/opencl/azim_csr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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))

Expand Down
4 changes: 2 additions & 2 deletions src/pyFAI/opencl/test/test_ocl_azim_csr.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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():
Expand Down
5 changes: 5 additions & 0 deletions src/pyFAI/resources/openCL/medfilt.cl
Original file line number Diff line number Diff line change
Expand Up @@ -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 :-/
Expand Down

0 comments on commit 7b6300f

Please sign in to comment.