Add SmoothedConstantInterpolation #367
Conversation
|
Fun feature; if using DataInterpolations
using Plots
using Random
N = 4
Random.seed!(8)
u = rand(N)
t = cumsum(rand(N))
Δt = t[end] - t[1]
t_eval = range(first(t) - Δt, last(t) + Δt, length = 500)
A = SmoothedConstantInterpolation(u, t; extrapolation = ExtrapolationType.Periodic, d_max = 0.2)
plot(t_eval, A.(t_eval))
scatter!(t[1:end-1], u[1:end-1]; label = "data")
scatter!(t[1:end-1] .+ Δt, u[1:end-1]; label = "data one period forward")
scatter!(t[1:end-1] .- Δt, u[1:end-1]; label = "data one period back") |
|
Conflicts? |
|
I don't understand why the derivative tests are failing 🤔 |
|
fixed it 👍 |
|
I think I'm happy. @sathvikbhagavan ? |
sathvikbhagavan
left a comment
There was a problem hiding this comment.
A couple of clarifications
|
A tangentially related gripe regarding periodic extrapolation: calendars are a mess, making it difficult to periodically extrapolate timeseries in a way that does not get out of sync with them |
sathvikbhagavan
left a comment
There was a problem hiding this comment.
Format and then can be merged!
|
@sathvikbhagavan not sure why but formatting locally doesn't make the check pass |
|
It might be the version. Are you using v1 or v2? CI tries to check in v1 |
|
That did it 🥳 Btw, is there a way to set compat bounds on packages in your base env? |
|
SciML/.github#25 let's just get that fixed. |
|
Let's update the formatting in a follow up, seems like it takes time to propagate. |

Fixes #364.
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context