@@ -32,7 +32,7 @@ Some are defined in the associated header file .pxd
3232
3333__author__ = " Jérôme Kieffer"
3434__contact__ = " Jerome.kieffer@esrf.fr"
35- __date__ = " 18 /11/2025"
35+ __date__ = " 27 /11/2025"
3636__status__ = " stable"
3737__license__ = " MIT"
3838
@@ -512,6 +512,7 @@ def _sp_integrate1d(buffer_t[::1] buffer,
512512 floating stop0 , floating stop1 ):
513513 _integrate1d(buffer , start0, start1, stop0, stop1)
514514
515+
515516cdef inline void _integrate2d(buffer_t[:, ::1 ] box,
516517 floating start0, floating start1,
517518 floating stop0, floating stop1) noexcept nogil:
@@ -545,7 +546,7 @@ cdef inline void _integrate2d(buffer_t[:, ::1] box,
545546 abs_area = fabs(segment_area)
546547 dA = (stop0 - start0) # always positive
547548 h = 0
548- while abs_area > 0 :
549+ while abs_area > 0 and h < box.shape[ 1 ] :
549550 if dA > abs_area:
550551 dA = abs_area
551552 abs_area = - 1
@@ -559,7 +560,7 @@ cdef inline void _integrate2d(buffer_t[:, ::1] box,
559560 abs_area = fabs(segment_area)
560561 h = 0
561562 dA = dP
562- while abs_area > 0 :
563+ while abs_area > 0 and h < box.shape[ 1 ] :
563564 if dA > abs_area:
564565 dA = abs_area
565566 abs_area = - 1
@@ -573,7 +574,7 @@ cdef inline void _integrate2d(buffer_t[:, ::1] box,
573574 abs_area = fabs(segment_area)
574575 h = 0
575576 dA = 1.0
576- while abs_area > 0 :
577+ while abs_area > 0 and h < box.shape[ 1 ] :
577578 if dA > abs_area:
578579 dA = abs_area
579580 abs_area = - 1
@@ -589,7 +590,7 @@ cdef inline void _integrate2d(buffer_t[:, ::1] box,
589590 abs_area = fabs(segment_area)
590591 h = 0
591592 dA = fabs(dP)
592- while abs_area > 0 :
593+ while abs_area > 0 and h < box.shape[ 1 ] :
593594 if dA > abs_area:
594595 dA = abs_area
595596 abs_area = - 1
@@ -605,7 +606,7 @@ cdef inline void _integrate2d(buffer_t[:, ::1] box,
605606 # sign = segment_area / abs_area
606607 dA = (start0 - stop0) # always positive
607608 h = 0
608- while abs_area > 0 :
609+ while abs_area > 0 and h < box.shape[ 1 ] :
609610 if dA > abs_area:
610611 dA = abs_area
611612 abs_area = - 1
@@ -620,7 +621,7 @@ cdef inline void _integrate2d(buffer_t[:, ::1] box,
620621 abs_area = fabs(segment_area)
621622 h = 0
622623 dA = fabs(dP)
623- while abs_area > 0 :
624+ while abs_area > 0 and h < box.shape[ 1 ] :
624625 if dA > abs_area:
625626 dA = abs_area
626627 abs_area = - 1
@@ -634,7 +635,7 @@ cdef inline void _integrate2d(buffer_t[:, ::1] box,
634635 abs_area = fabs(segment_area)
635636 h = 0
636637 dA = 1
637- while abs_area > 0 :
638+ while abs_area > 0 and h < box.shape[ 1 ] :
638639 if dA > abs_area:
639640 dA = abs_area
640641 abs_area = - 1
@@ -650,7 +651,7 @@ cdef inline void _integrate2d(buffer_t[:, ::1] box,
650651 abs_area = fabs(segment_area)
651652 h = 0
652653 dA = fabs(dP)
653- while abs_area > 0 :
654+ while abs_area > 0 and h < box.shape[ 1 ] :
654655 if dA > abs_area:
655656 dA = abs_area
656657 abs_area = - 1
0 commit comments