Skip to content

Commit

Permalink
ENH: changed SINDyDerivative to recent derivative changes
Browse files Browse the repository at this point in the history
  • Loading branch information
yb6599 committed Jun 4, 2024
1 parent 62163be commit 30188e9
Showing 1 changed file with 3 additions and 11 deletions.
14 changes: 3 additions & 11 deletions pysindy/differentiation/sindy_derivative.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
Some default values used here may differ from those used in :doc:`derivative:index`.
"""
import numpy as np
from derivative import methods
from numpy import arange

Expand Down Expand Up @@ -78,16 +77,9 @@ def _differentiate(self, x, t=1):
differentiator = methods[self.kwargs["kind"]](
**{k: v for k, v in self.kwargs.items() if k != "kind"}
)
x = np.moveaxis(x, self.axis, 0)
x_shape = x.shape
flat_x = x.reshape((t.size, int(x.size / t.size)))
flat_x_dot = differentiator.d(flat_x, t, axis=0)
x_dot = differentiator.d(x, t, axis=self.axis)
if self.save_smooth:
smoothed_x_ = differentiator.x(flat_x, t, axis=0)
self.smoothed_x_ = differentiator.x(x, t, axis=self.axis)
else:
smoothed_x_ = flat_x
x_dot = flat_x_dot.reshape(x_shape)
smoothed_x_ = smoothed_x_.reshape(x_shape)
x_dot = np.moveaxis(x_dot, 0, self.axis)
self.smoothed_x_ = np.moveaxis(smoothed_x_, 0, self.axis)
self.smoothed_x_ = x
return x_dot

0 comments on commit 30188e9

Please sign in to comment.