fslaborg / Deedle

Easy to use .NET library for data and time series manipulation and for scientific programming
http://fslab.org/Deedle/
BSD 2-Clause "Simplified" License
933 stars 195 forks source link

Stats.interpolateLinear uses series values as defaults #211

Open phatcher opened 10 years ago

phatcher commented 10 years ago

When you use Stats.interpolateLinear and the new key list extended earlier or later than the original, then the function uses the low/high value from the original list.

I think this should be extended so that the behaviour is customisable, three obvious choices are...

  1. Current behaviour
  2. Result is undefined
  3. Result is computed with the same linear interpolation as the last computed point, i.e. we continue with the same gradient.

I can have a go at producing a patch if you think this is worthwhile?

tpetricek commented 10 years ago

I think that would be a useful addition, so, please do submit a pull request!

I suppose we do not want to change the current behavior of interpolateLinear, or add additional parameters, but we could have a more flexible function interpolateLinearUsing that takes the extrapolation behavior as an additional argument (or, I thought, we could call it extrapolation, but that does not really makes sense as the function does both).