Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Limit number of warning emited by MSVC #2329

Merged
merged 8 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 6 additions & 9 deletions src/pyFAI/ext/bilinear.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -117,15 +117,12 @@ cdef class Bilinear:

cdef:
int i0, i1, j0, j1
float x0, x1, y0, y1, res
if d0 < 0:
d0 = 0
elif d1 < 0:
d1 = 0
elif d0 > (self.height - 1):
d0 = self.height - 1
elif d1 > self.width - 1:
d1 = self.width - 1
float x0, x1, y0, y1, res,
floating d0max, d1max
d0max = self.height - 1.0
d1max = self.width - 1.0
d0 = max(min(d0, d0max), 0.0)
d1 = max(min(d1, d1max), 0.0)
x0 = floor(d0)
x1 = ceil(d0)
y0 = floor(d1)
Expand Down
6 changes: 3 additions & 3 deletions src/pyFAI/ext/inpainting.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
Cython module for doing inpaining of images.
"""
__author__ = "Jérôme Kieffer"
__date__ = "09/03/2023"
__date__ = "12/11/2024"
__contact__ = "[email protected]"
__license__ = "MIT"

Expand Down Expand Up @@ -139,10 +139,10 @@ def polar_inpaint(floating[:, :] img not None,
:return: image with missing values interpolated from neighbors.
"""
cdef:
int row, col, npt_radial, npt_azim, idx_col, idx_row, tar_row, radius
int row, col, npt_radial, npt_azim, idx_col, idx_row, tar_row, radius, dist
float[:, ::1] res
bint do_dummy = empty is not None
float value, dummy, dist
float value, dummy
double sum, cnt, weight
list values

Expand Down
10 changes: 3 additions & 7 deletions src/pyFAI/ext/reconstruct.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,14 @@ image (masked) to be able to use more common algorithms.

__author__ = "Jerome Kieffer"
__contact__ = "[email protected]"
__date__ = "03/03/2023"
__date__ = "12/11/2024"
__status__ = "stable"
__license__ = "MIT"


import cython
import numpy
from libc.math cimport sqrt, fabs, NAN
from libc.math cimport sqrtf, fabs, NAN
from cython.parallel import prange
from libc.stdint cimport int8_t, uint8_t, int16_t, uint16_t, \
int32_t, uint32_t, int64_t, uint64_t
Expand All @@ -55,11 +55,7 @@ cdef inline float invert_distance(Py_ssize_t i0, Py_ssize_t i1, Py_ssize_t p0, P
cdef Py_ssize_t d0, d1
d0 = (i0 - p0)
d1 = (i1 - p1)
return 1. / sqrt(d0*d0 + d1*d1)
# if d0*d1:
# else:
# return NAN

return (<float> 1.0) / sqrtf(<float> (d0*d0 + d1*d1))

cdef inline float processPoint(float[:, ::1] data,
int8_t[:, ::1] mask,
Expand Down
14 changes: 7 additions & 7 deletions src/pyFAI/ext/regrid_common.pxi
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Some are defined in the associated header file .pxd

__author__ = "Jérôme Kieffer"
__contact__ = "[email protected]"
__date__ = "24/04/2024"
__date__ = "12/11/2024"
__status__ = "stable"
__license__ = "MIT"

Expand Down Expand Up @@ -490,14 +490,14 @@ cdef inline void _integrate1d(buffer_t[::1] buffer,
if 0 <= start0 < buffer_size:
buffer[istart0] += _calc_area(start0, floor(start0 + 1), slope, intercept)
for i in range(max(istart0 + 1, 0), min(istop0, buffer_size)):
buffer[i] += _calc_area(i, i + 1, slope, intercept)
buffer[i] += _calc_area(<floating>i, <floating>(i + 1), slope, intercept)
if buffer_size > stop0 >= 0:
buffer[istop0] += _calc_area(istop0, stop0, slope, intercept)
buffer[istop0] += _calc_area(<floating> istop0, stop0, slope, intercept)
else:
if 0 <= start0 < buffer_size:
buffer[istart0] += _calc_area(start0, istart0, slope, intercept)
buffer[istart0] += _calc_area(start0, <floating> istart0, slope, intercept)
for i in range(min(istart0, buffer_size) - 1, max(<Py_ssize_t> floor(stop0), -1), -1):
buffer[i] += _calc_area(i + 1, i, slope, intercept)
buffer[i] += _calc_area(<floating>(i + 1), <floating>i, slope, intercept)
if buffer_size > stop0 >= 0:
buffer[istop0] += _calc_area(floor(stop0 + 1), stop0, slope, intercept)

Expand Down Expand Up @@ -562,7 +562,7 @@ cdef inline void _integrate2d(buffer_t[:, ::1] box,
h += 1
# subsection P1->Pn
for i in range((<Py_ssize_t> floor(P)), (<Py_ssize_t> floor(stop0))):
segment_area = _calc_area(i, i + 1, slope, intercept)
segment_area = _calc_area(<floating> i, <floating> (i + 1), slope, intercept)
if segment_area != 0:
abs_area = fabs(segment_area)
h = 0
Expand Down Expand Up @@ -623,7 +623,7 @@ cdef inline void _integrate2d(buffer_t[:, ::1] box,
h += 1
# subsection P1->Pn
for i in range((<Py_ssize_t> start0), (<Py_ssize_t> ceil(stop0)), -1):
segment_area = _calc_area(i, i - 1, slope, intercept)
segment_area = _calc_area(<floating> i, <floating> (i - 1), slope, intercept)
if segment_area != 0:
abs_area = fabs(segment_area)
h = 0
Expand Down