forked from astropy/astropy
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path_convolve.pyx
More file actions
37 lines (31 loc) · 1.13 KB
/
_convolve.pyx
File metadata and controls
37 lines (31 loc) · 1.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# cython: language_level=3
cimport numpy as np
from libcpp cimport bool
np.import_array()
cdef extern from "src/convolve.h":
void convolveNd_c(np.float64_t * const result,
const np.float64_t * const f,
const unsigned n_dim,
const size_t * const image_shape,
const np.float64_t * const g,
const size_t * const kernel_shape,
const bool nan_interpolate,
const bool embed_result_within_padded_region,
const unsigned n_threads) nogil
def _convolveNd_c(np.ndarray result,
np.ndarray array_to_convolve,
np.ndarray kernel,
bool nan_interpolate,
bool embed_result_within_padded_region,
int n_threads):
convolveNd_c(
<np.float64_t*>np.PyArray_DATA(result),
<np.float64_t*>np.PyArray_DATA(array_to_convolve),
array_to_convolve.ndim,
<size_t*>array_to_convolve.shape,
<np.float64_t*>np.PyArray_DATA(kernel),
<size_t*>kernel.shape,
nan_interpolate,
embed_result_within_padded_region,
n_threads,
)