Skip to content

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

Description

@ryan-feeley

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])

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions