Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Spline from auto-computed smooth with normalizedsmooth=True doesn't match using that smooth value directly #70

Open
ryan-feeley opened this issue Sep 25, 2023 · 1 comment
Labels

Comments

@ryan-feeley
Copy link

Hi, thanks for this package.

I stumbled across some behavior I didn't expect. In the following code, I'm computing a smoothing factor automatically with normalizedsmooth=True. If I then use the resulting smooth value, keeping normalizedsmooth=True, the smoothed result is different. Any idea why?

import numpy as np
from csaps import csaps

n = 25

x = np.linspace(-5., 5., n)
y = np.exp(-(x/2.5)**2) + (np.random.rand(n) - 0.2) * 0.3
xi = np.linspace(-5., 5., 150)

is_normalized = True

# Smooth data and compute smoothing factor automatically
yi_auto, smooth = csaps(x, y, xi, normalizedsmooth=is_normalized)

# Smooth data with smoothing factor 0.85
yi_explicit = csaps(x, y, xi, smooth=smooth, normalizedsmooth=is_normalized)

print(np.array_equal(yi_auto, yi_explicit))
print(yi_auto[0], yi_explicit[0])
@espdev
Copy link
Owner

espdev commented Sep 27, 2023

Hello @ryan-feeley,

Thanks for the report. I will check the code.

@espdev espdev added the bug label Sep 27, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants