| 27 | |
| 28 | @numba.jit(nopython=True) |
| 29 | def integrate_gradient_field( |
| 30 | gradient_field: np.ndarray, axis: int, mask: np.ndarray |
| 31 | ) -> np.ndarray: |
| 32 | heights = np.zeros(gradient_field.shape) |
| 33 | |
| 34 | for d1 in numba.prange(heights.shape[1 - axis]): |
| 35 | sum_value = 0 |
| 36 | for d2 in range(heights.shape[axis]): |
| 37 | coordinates = (d1, d2) if axis == 1 else (d2, d1) |
| 38 | |
| 39 | if mask[coordinates] != 0: |
| 40 | sum_value = sum_value + gradient_field[coordinates] |
| 41 | heights[coordinates] = sum_value |
| 42 | else: |
| 43 | sum_value = 0 |
| 44 | |
| 45 | return heights |
| 46 | |
| 47 | |
| 48 | def calculate_heights( |