Skip to content

Commit 449f6db

Browse files
authored
Fix call numpy.pad function for numpy<=1.16 (#16)
* (#15) fix call numpy.pad function for numpy==1.16 * bump version to 0.10.1
1 parent 0ce7e6b commit 449f6db

3 files changed

Lines changed: 11 additions & 5 deletions

File tree

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## v0.10.1
4+
5+
* Fix call of `numpy.pad` function for numpy <=1.16 [#15](https://github.com/espdev/csaps/issues/15)
6+
37
## v0.10.0
48

59
* Significant performance improvements for make/evaluate splines and memory consumption optimization

csaps/_sspumv.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"""
77

88
import typing as ty
9+
import functools
910
import warnings
1011

1112
import numpy as np
@@ -278,12 +279,13 @@ def _make_spline(self, smooth: ty.Optional[float]) -> ty.Tuple[SplinePPForm, flo
278279

279280
dx = dx[:, np.newaxis]
280281

281-
pad_width = [(1, 1), (0, 0)]
282-
d1 = np.diff(np.pad(u, pad_width), axis=0) / dx
283-
d2 = np.diff(np.pad(d1, pad_width), axis=0)
282+
pad = functools.partial(np.pad, pad_width=[(1, 1), (0, 0)], mode='constant')
283+
284+
d1 = np.diff(pad(u), axis=0) / dx
285+
d2 = np.diff(pad(d1), axis=0)
284286

285287
yi = self._ydata.T - ((6. * (1. - p)) * w) @ d2
286-
c3 = np.pad(p * u, pad_width)
288+
c3 = pad(p * u)
287289
c2 = np.diff(yi, axis=0) / dx - dx * (2. * c3[:-1, :] + c3[1:, :])
288290

289291
coeffs = np.vstack((

csaps/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# -*- coding: utf-8 -*-
22

3-
__version__ = '0.10.0'
3+
__version__ = '0.10.1'

0 commit comments

Comments
 (0)