Skip to content

Commit 5dfa27b

Browse files
committed
Added the performance script I used.
1 parent 843bbdd commit 5dfa27b

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

stratify/_vinterp.pyx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -392,7 +392,6 @@ cdef class _PythonExtrapKernel(ExtrapKernel):
392392
with gil:
393393
self.extrap_kernel(direction, z_src, fz_src, level, fz_target)
394394

395-
396395
cdef class _TestableDirectionExtrapKernel(ExtrapKernel):
397396
@cython.boundscheck(False)
398397
@cython.wraparound(False)

stratify/tests/performance.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
"""
2+
Functions that may be used to measure performance of a component.
3+
4+
"""
5+
import numpy as np
6+
import stratify
7+
8+
9+
def src_data(shape=(400, 500, 100)):
10+
z = np.tile(np.linspace(0, 100, shape[-1]),
11+
np.prod(shape[:2])).reshape(shape)
12+
fz = np.arange(np.prod(shape)).reshape(shape)
13+
return z, fz
14+
15+
16+
def interp_and_extrap(shape,
17+
interp=stratify.INTERPOLATE_LINEAR,
18+
extrap=stratify.EXTRAPOLATE_NEAREST):
19+
z, fz = src_data(shape)
20+
stratify.interpolate(np.linspace(-20, 120, 50), z, fz,
21+
interpolation=interp, extrapolation=extrap)
22+
23+
24+
if __name__ == '__main__':
25+
interp_and_extrap(shape=(500, 600, 100))

0 commit comments

Comments
 (0)