Module lineardiff, the same value for step_size and window_size. It looked like a normal combination to try but some parts of the result become NaN.
Current joss2.0, python 3.13:
import numpy as np
from pynumdiff.linear_model import lineardiff
t = np.linspace(0, 2*np.pi, 41)
dt = t[1] - t[0]
x = np.sin(t)
for step in [10, 11, 12]:
x_hat, dxdt_hat = lineardiff(
x,
dt,
order=2,
gamma=0.01,
window_size=11,
step_size=step,
solver=“CLARABEL”,
)
print(
step,
np.sum(~np.isfinite(x_hat)),
np.sum(~np.isfinite(dxdt_hat)),
)
—>
There are also invalid value encountered in divide warnings. Some samples aren't covered by any window when the stride gets larger so their weight_sum stays zero and slide_function divides by it at the end.
I didn't see a restriction for step_size in the docstring. Values which leave samples uncovered should be rejected before running instead of returning partially NaN arrays. What do you think Pavel?
Review reference: openjournals/joss-reviews#11172
Module lineardiff, the same value for step_size and window_size. It looked like a normal combination to try but some parts of the result become NaN.
Current joss2.0, python 3.13:
—>
There are also invalid value encountered in divide warnings. Some samples aren't covered by any window when the stride gets larger so their weight_sum stays zero and slide_function divides by it at the end.
I didn't see a restriction for step_size in the docstring. Values which leave samples uncovered should be rejected before running instead of returning partially NaN arrays. What do you think Pavel?
Review reference: openjournals/joss-reviews#11172