Skip to content

Commit

Permalink
Fix call numpy.pad function for numpy<=1.16 (#16)
Browse files Browse the repository at this point in the history
* (#15) fix call numpy.pad function for numpy==1.16
* bump version to 0.10.1
  • Loading branch information
espdev committed Mar 19, 2020
1 parent 0ce7e6b commit 449f6db
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 5 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changelog

## v0.10.1

* Fix call of `numpy.pad` function for numpy <=1.16 [#15](https://github.com/espdev/csaps/issues/15)

## v0.10.0

* Significant performance improvements for make/evaluate splines and memory consumption optimization
Expand Down
10 changes: 6 additions & 4 deletions csaps/_sspumv.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
"""

import typing as ty
import functools
import warnings

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

dx = dx[:, np.newaxis]

pad_width = [(1, 1), (0, 0)]
d1 = np.diff(np.pad(u, pad_width), axis=0) / dx
d2 = np.diff(np.pad(d1, pad_width), axis=0)
pad = functools.partial(np.pad, pad_width=[(1, 1), (0, 0)], mode='constant')

d1 = np.diff(pad(u), axis=0) / dx
d2 = np.diff(pad(d1), axis=0)

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

coeffs = np.vstack((
Expand Down
2 changes: 1 addition & 1 deletion csaps/_version.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# -*- coding: utf-8 -*-

__version__ = '0.10.0'
__version__ = '0.10.1'

0 comments on commit 449f6db

Please sign in to comment.