Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into 2315_medfilt_ng_cython
Browse files Browse the repository at this point in the history
  • Loading branch information
kif committed Nov 19, 2024
2 parents e15a3e4 + 34d3213 commit a909264
Show file tree
Hide file tree
Showing 12 changed files with 411 additions and 220 deletions.
3 changes: 2 additions & 1 deletion README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ References
* The philosophy of pyFAI is described in the proceedings of SRI2012: https://doi.org/10.1088/1742-6596/425/20/202012
* Implementation in parallel is described in the proceedings of EPDIC13: https://doi.org/10.1017/S0885715613000924
* Benchmarks and optimization procedure is described in the proceedings of EuroSciPy2014: https://doi.org/10.48550/arXiv.1412.6367
* Calibration procedures are described in J. Synch. Radiation 2020: https://doi.org/10.1107/S1600577520000776
* Calibration procedures are described in J. Synch. Radiation (2020): https://doi.org/10.1107/S1600577520000776
* Application of signal separation to diffraction image compression and serial crystallography. Accepted in J. Appl. Cryst. (2024): https://doi.org/10.48550/arXiv.2411.09515

Installation
------------
Expand Down
36 changes: 21 additions & 15 deletions doc/source/publications.rst
Original file line number Diff line number Diff line change
Expand Up @@ -6,33 +6,39 @@
Publications about pyFAI
========================

* *PyFAI, a versatile library for azimuthal regrouping*,
J Kieffer & D Karkoulis;
* *PyFAI, a versatile library for azimuthal regrouping*;
J Kieffer and D Karkoulis;
**Journal of Physics: Conference Series** (2013) 425 (20), pp202012
Initial publication where the usage of GPU is envisaged to overcome
the speed limitation of azimuthal integration.

* *PyFAI: a Python library for high performance azimuthal integration on GPU*
J Kieffer & J.P. Wright;
**Powder Diffraction** (2013) 28 (S2), pp339-350
Introduces the concept of look-up table to register the pixel distribution
* *PyFAI: a Python library for high performance azimuthal integration on GPU*;
J Kieffer and J.P. Wright;
**Powder Diffraction** (2013) 28 (S2), pp339-350;
Introduces the concept of look-up table to register the pixel distribution.

* *PyFAI: a Python library for high performance azimuthal integration on GPU*;
Jérôme Kieffer, Giannis Ashiotis
**PROC. OF THE 7th EUR. CONF. ON PYTHON IN SCIENCE** (EUROSCIPY 2014)
Presents the usage of sparse matrices to store the look-up table
Jérôme Kieffer and Giannis Ashiotis;
**PROC. OF THE 7th EUR. CONF. ON PYTHON IN SCIENCE** (EUROSCIPY 2014);
Presents the usage of sparse matrices to store the look-up table.

* *The fast azimuthal integration Python library: pyFAI*;
G. Ashiotis, A. Deschildre, Z. Nawaz, J. P. Wright, D. Karkoulis, F. E. Picca and J. Kieffer
**Journal of Applied Crystallography** (2015) 48 (2), 510-519
This publication provides a nice overview of the features introduced in version
0.11 and further developed in v0.12, v0.13 & v0.14.
G. Ashiotis, A. Deschildre, Z. Nawaz, J. P. Wright, D. Karkoulis, F. E. Picca and J. Kieffer;
**Journal of Applied Crystallography** (2015) 48 (2), 510-519;
This publication provides a nice overview of the features introduced in version 0.11 and further developed in v0.12, v0.13 & v0.14.

* *New tools for calibrating diffraction setups*;
J. Kieffer, V. Valls, N. Blanc and C. Hennig;
**Journal of Synchrotron Radiation** (2020) 27 (2), 558-566;
Describes the new integration scheme, the new user interface and the calibration of goniometers.

* *Application of signal separation to diffraction image compression and serial crystallography*;
Jérôme Kieffer, Julien Orlans, Nicolas Coquelle, Samuel Debionne, Shibom Basu, Alejandro Homs, Gianluca Santonia and Daniele De Sanctis;
`Accepted <https://doi.org/10.48550/arXiv.2411.09515>`_ in **J. Applied Crystallography** (2024);
In depth explainaion of sigma-clipping background assessment and error models.

The latest paper should be the cited in publications using pyFAI.
There are already 450 publications referring to pyFAI, some of them in the most
prestigious scientific journals (Nature, PNAS, ...).
There are already 1400 publications referring to pyFAI, some of them in the most
prestigious scientific journals (Nature, PNAS, ...) and
40 other `applications <https://github.com/silx-kit/pyFAI/network/dependents?dependent_type=PACKAGE>`_
using pyFAI as a library.
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
Loading

0 comments on commit a909264

Please sign in to comment.