On Thu, Jun 3, 2021 at 4:43 AM Klaus Zimmermann <klaus.zimmermann@smhi.se> wrote:
if you are interested in the 1d problem, you might also consider a
spline fit of order 1, for example with scipy.interpolate, see [1].

hmm, yes, that should work -- I guess it didn't dawn on me because all examples are higher order, but I'll check it out.

-CHB

 
Cheers
Klaus


[1]
https://docs.scipy.org/doc/scipy/reference/tutorial/interpolate.html#spline-interpolation-in-1-d-procedural-interpolate-splxxx

On 03/06/2021 13:12, Mark Bakker wrote:
> My students are using this and seem to like it:
>
> https://jekel.me/piecewise_linear_fit_py/about.html
> <https://jekel.me/piecewise_linear_fit_py/about.html>
>  
>
>     Date: Tue, 1 Jun 2021 17:22:52 -0700
>     From: Chris Barker <chris.barker@noaa.gov
>     <mailto:chris.barker@noaa.gov>>
>     To: Discussion of Numerical Python <numpy-discussion@python.org
>     <mailto:numpy-discussion@python.org>>
>     Subject: [Numpy-discussion] Best fit linear piecewise function?
>     Message-ID:
>            
>     <CALGmxELHB3MUT=i58WZ0dL_292GvntmFRte88ik98h2NqT1YJw@mail.gmail.com
>     <mailto:i58WZ0dL_292GvntmFRte88ik98h2NqT1YJw@mail.gmail.com>>
>     Content-Type: text/plain; charset="utf-8"
>
>     Do any of you know of code for finding an optimum linear piecewise
>     fit to a
>     set of points?
>
>     Somethin like what is described in this article:
>
>     https://www.hindawi.com/journals/mpe/2015/876862/
>     <https://www.hindawi.com/journals/mpe/2015/876862/>
>
>     At a glance, that looked just hard enough to code up that I'm hoping
>     someone has already done it :-)
>
>     -CHB
>
>
>     --
>
>     Christopher Barker, Ph.D.
>     Oceanographer
>
>     Emergency Response Division
>     NOAA/NOS/OR&R            (206) 526-6959   voice
>     7600 Sand Point Way NE   (206) 526-6329   fax
>     Seattle, WA  98115       (206) 526-6317   main reception
>
>     Chris.Barker@noaa.gov <mailto:Chris.Barker@noaa.gov>
>     -------------- next part --------------
>     An HTML attachment was scrubbed...
>     URL:
>     <https://mail.python.org/pipermail/numpy-discussion/attachments/20210601/fa6567d6/attachment-0001.html
>     <https://mail.python.org/pipermail/numpy-discussion/attachments/20210601/fa6567d6/attachment-0001.html>>
>
>
>
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion@python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
_______________________________________________
NumPy-Discussion mailing list
NumPy-Discussion@python.org
https://mail.python.org/mailman/listinfo/numpy-discussion


--

Christopher Barker, Ph.D.
Oceanographer

Emergency Response Division
NOAA/NOS/OR&R            (206) 526-6959   voice
7600 Sand Point Way NE   (206) 526-6329   fax
Seattle, WA  98115       (206) 526-6317   main reception

Chris.Barker@noaa.gov