I want to create an interpolation object which uses the Flat() option when extrapolating, but I run into “Flat() not defined” when specifying it so. The Line() option works well.
Eg., the following works
interp1 = LinearInterpolation(1:5, 2:6, extrapolation_bc=Line())
interp1(6.0) returns 7.0
while
interp2 = LinearInterpolation(1:5, 2:6, extrapolation_bc=Flat())
returns ERROR: UndefVarError: Flat not defined
Is this a bug or am I using the option wrong?
works fine for me on Julia v1.6.0 with Interpolations v0.13.1
2 Likes
Ah, updating just Interpolations (still running Julia v1.5.2.) and restarting solved it, thanks!¨
Lesson learned: Update packages before asking.
1 Like
In case this helps anyone else: I was getting this error message too. It turns out that if you have Optim.jl loaded, it also exports Flat(), so you need to specify extrapolation_bc=Interpolations.Flat() to use this extrapolation scheme.
2 Likes