Skip to content

savgoldiff uses axis 0 length when differentiating another axis #211

Description

@alexzerg

Now it's time for multidimensional input with time on axis 1. Here x has shape (2, 41) and time is on axis 1:

import numpy as np
from pynumdiff.polynomial_fit import savgoldiff
t = np.linspace(0, 2*np.pi, 41)
dt = t[1] - t[0]
x = np.vstack([
np.sin(t),
np.cos(t),
])
x_hat, dxdt_hat = savgoldiff(
x,
dt,
degree=3,
window_size=11,
smoothing_win=5,
axis=1,
)

Oops (joss2.0 python 3.13)...
ValueError: polyorder must be less than window_length

Same data transposed to (41, 2) works with axis=0. Does it take window limits from len(x) so here it sees 2 samples instead of 41? Probably should use the selected axis length.

Review reference: openjournals/joss-reviews#11172

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions