Fwd: Re: GSoC 2017: BSpline support
Resent my answer to the new address. ============ Forwarded message ============
From : Nikolay Mayorov <nikolay.mayorov@zoho.com>
To : "SciPy Developers List"<scipy-dev@scipy.org> Date : Fri, 24 Mar 2017 01:07:10 +0500 Subject : Re: [SciPy-Dev] GSoC 2017: BSpline support ============ Forwarded message ============ De Boor, "Practical guide to splines", Chapter IX should be the place for your. Likely you will need to thoroughly study several chapters in it, it's not an easy book to quickly pick up a recipe from it. Nikolay. ---- On Thu, 23 Mar 2017 19:31:32 +0500 Aman Pratik <amanpratik10@gmail.com> wrote ---- Hello, I need some help with "Convert a CubicSpline/PPoly object to a BSpline". I am unable to find suitable literature for it, or maybe I am overlooking something. I would be really grateful if you could guide me to some reading material or code samples. Thank You On 20 March 2017 at 03:38, Nikolay Mayorov <nikolay.mayorov@zoho.com> wrote: _______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org https://mail.scipy.org/mailman/listinfo/scipy-dev For future I suggest to put your proposal in markdown format somewhere on github (scipy wiki is a good place). I don't know what is the correct and productive way to review such proposal, so these are some thoughts on some of your points. > Rework the tutorial for scipy.interpolate: The 1D interpolation section prominently recommends interp1d. We likely want to tone it down and recommend instead CubicSpline, Akima1DInterpolator, BSpline etc. This can be done after reading some basics about these algorithms and making the changes as required. Honestly I don't think it is that easy, you definitely need to have a certain taste and interest to rewrite this tutorial. My guess is that you will be able to do it better after you finished the main algorithmic and coding work. > Come up with better names for make_interp_spline/make_lsq_spline routines. This too can be handled after some discussion. I don't think it is necessary to put things like that in the proposal, you'll figure it out (with Evgeni) as the work progresses. > Add string aliases to the bc_type keyword of make_interp_spline to match what CubicSpline allows. I.e. bc_type="natural" should be equivalent to bc_type=((2, 0), (2, 0)) This requires mainly imitating whats there in CubicSpline so wont be very difficult. This can be indeed your first small objective. The documentation for bc_type in make_interp_spline reads "Each of these must be an iterable of pairs (order, value) which gives the values of derivatives of specified orders at the given edge of the interpolation interval." So BSpline is quite general and allows specifying conditions for several derivatives at one end (as opposed to CubicSpline). Maybe it will need some special considerations, just something I noticed. > Convert a CubicSpline object to a BSpline This could be done by assigning the __class__ attribute to the instance. However, since this is not preferred, we may construct a new method which will create a new BSpline object using a CubicSpline object by assigning the corresponding attribute values. (I need your suggestion, which approach to follow?) I believe ideally there should be a factory method like `BSpline.from_ppoly(...)`, as a compromise something like `BSpline.from_cubic_spline`, but I'm not sure whether it will be that valuable in that form. The problem might be not that simple, do some research on now to make conversion between polynomial and B-spline basis. > Knot insertion: BSpline class should grow a method insert_knot (or insert_knots). This can either wrap fitpack.insert directly, or reuse parts of it (e.g. retain the buffer swapping plumbing from _fitpack and reimplement the Fortran routine fitpack/fpinst.f in C or Cython). Since fitpack.insert is already implemented for BSplines, wrapping around it would be the simplest solution as I perceive. As I see there is already a public function insert (implemented in fitpack.py). So just moving it in as a method pretty much does the job. However is the final aim is to move away from FITPACK, then reimplementing insertion algorithm in Cython is useful. Additionally it can be an entry into more serious problems to follow and doing things in Cython. (Btw, I'm not sure what Evgeni meant by "e.g. retain the buffer swapping plumbing".) > Root-finding: At a minimum, sproot should be wrapped into a method of BSpline class. Better still, it should be generalized to allow non-cubic splines. The interface should mirror PPoly.solve and PPoly.roots. This too can be done by imitating PPoly.roots and PPoly.solve. Writing a new implementation for arbitrary spline orders looks like an interesting and challenging problem. Consider doing it instead of just minimal wrapper. All in all the two previous problems, if done in full capacity, don't seem easy and can occupy you for the good part of the GSoC. BSpline Variations:- > Cardinal BSplines (BSplines with equidistant knots). We need representation, evaluation and construction. scipy.signal has some. The task here is to have an interface which is both compatible with regular b-splines and piecewise polynomials and is useful for the signal processing folks. For implementing this feature I will have to read some material to get a good understanding of Cardinal BSplines and its implementation These are two of the places (for now) I would start my study from. The implementation in scipy.signal can be of help. https://en.wikipedia.org/wiki/B-spline#Cardinal_B-spline http://dx.doi.org/10.1016/j.aml.2010.06.029 This task could take a long time, maybe 3 weeks or more. > Spline fitting to data. ATM there's only FITPACK, and we want a more controllable alternative. A first exploratory shot could be to implement de Boors's newknot routine and see how it behaves in real life. This too requires reading of some literature to understand the math and also looking at the FITPACK code for guidance. The following literature can be helpful. https://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/de-Boor.h... https://en.wikipedia.org/wiki/De_Boor%27s_algorithm Both these tasks would take over a month for complete implementation. Generally I suggest to pick (at least for now) one subject most interesting to you and think it through in more details. Now it's unclear what exactly you want to program (which classes, functions, etc.) and time estimates don't look reliable. For "Spline fitting to data" I'm somewhat confused, because make_lsq_spline and make_interp_spline seem to already solve fitting problems without relying on FITPACK. Evgeni, what is the situation here? For now that's all from me. To sum up: focus on fewer things with more details, you don't necessary need to go into the most advanced things. If I'm not mistaken, the whole project can be organized as "get rid of some things from fitpack" and it can be good. I think Evgeni will clarify/comment on things. Nikolay. After looking at the issue tracker #6730 I have made my first proposal for the GSoC project "Improve support for B-splines". This is in continuation with my first mail regarding the same matter. This is a long list of what I think could be done as part of the project. I don't have much knowledge of Splines or B-Splines hence the work plan is not very detailed. Please have a look. Minor changes:- ::: Documentation: > Rework the tutorial for scipy.interpolate: The 1D interpolation section prominently recommends interp1d. We likely want to tone it down and recommend instead CubicSpline, Akima1DInterpolator, BSpline etc. This can be done after reading some basics about these algorithms and making the changes as required. > Come up with better names for make_interp_spline/make_lsq_spline routines. This too can be handled after some discussion. Both these documentation changes can be done within a few days time, 3 to 4 days should be enough. ::: Enhancements: > Add string aliases to the bc_type keyword of make_interp_spline to match what CubicSpline allows. I.e. bc_type="natural" should be equivalent to bc_type=((2, 0), (2, 0)) This requires mainly imitating whats there in CubicSpline so wont be very difficult. > Convert a CubicSpline object to a BSpline This could be done by assigning the __class__ attribute to the instance. However, since this is not preferred, we may construct a new method which will create a new BSpline object using a CubicSpline object by assigning the corresponding attribute values. (I need your suggestion, which approach to follow?) Both these tasks should not take more than 6 to 7 days, including all the documentation and unit tests. Major Enhancements:- > Knot insertion: BSpline class should grow a method insert_knot (or insert_knots). This can either wrap fitpack.insert directly, or reuse parts of it (e.g. retain the buffer swapping plumbing from _fitpack and reimplement the Fortran routine fitpack/fpinst.f in C or Cython). Since fitpack.insert is already implemented for BSplines, wrapping around it would be the simplest solution as I perceive. > Root-finding: At a minimum, sproot should be wrapped into a method of BSpline class. Better still, it should be generalized to allow non-cubic splines. The interface should mirror PPoly.solve and PPoly.roots. This too can be done by imitating PPoly.roots and PPoly.solve. Both these tasks can be completed within 10 days time including all the documentation and tests. BSpline Variations:- > Cardinal BSplines (BSplines with equidistant knots). We need representation, evaluation and construction. scipy.signal has some. The task here is to have an interface which is both compatible with regular b-splines and piecewise polynomials and is useful for the signal processing folks. For implementing this feature I will have to read some material to get a good understanding of Cardinal BSplines and its implementation These are two of the places (for now) I would start my study from. The implementation in scipy.signal can be of help. https://en.wikipedia.org/wiki/B-spline#Cardinal_B-spline http://dx.doi.org/10.1016/j.aml.2010.06.029 This task could take a long time, maybe 3 weeks or more. > Spline fitting to data. ATM there's only FITPACK, and we want a more controllable alternative. A first exploratory shot could be to implement de Boors's newknot routine and see how it behaves in real life. This too requires reading of some literature to understand the math and also looking at the FITPACK code for guidance. The following literature can be helpful. https://www.cs.mtu.edu/~shene/COURSES/cs3621/NOTES/spline/B-spline/de-Boor.h... https://en.wikipedia.org/wiki/De_Boor%27s_algorithm Both these tasks would take over a month for complete implementation. optional: I am not sure about the scope of these additions. Also, if we decide to implement these, I am not quite sure they can be completed within the span of GSoC. Probably, we can just take up one of these tasks. > PSpline: The term P-spline stands for "penalized B-spline". It refers to using the B-spline representation where the coefficients are determined partly by the data to be fitted, and partly by an additional penalty function that aims to impose smoothness to avoid overfitting. Adequate literature can be found here, https://projecteuclid.org/download/pdf_1/euclid.ss/1038425655 SAS have already implemented it, https://support.sas.com/documentation/cdl/en/statug/63033/HTML/default/viewe... This feature could take up a lot of time, including documentation,tests,examples etc. > Non-Uniform Rational B-splines (NURBS): Unlike simple B-splines, the control points each have a weight. The following literature can be helpful, https://en.wikipedia.org/wiki/Non-uniform_rational_B-spline https://www.rhino3d.com/nurbs The following articles can help with the implementation. https://www.codeproject.com/Articles/996281/NURBS-curve-made-easy http://www.nar-associates.com/nurbs/c_code.html#chapter4 This feature too can take up lots of time for full completion. > Constructing periodic splines. Fitpack does it. With full matrices it's straightforward, a naive implementation with banded matrices has issues with numerical stability. We can definitely look into the banded matrix issue if time permits. I am not sure what we may find so cant say anything about the time required. Final Assessment:- After these tasks have been completed. All the new features,methods would undergo rigorous tests and doctests. Benchmark tests could also be added wherever necessary. Features having scope for work could be reported on GitHub. I plan on reading as much as I can related to Cardinal BSplines,De Boor's newknot routine,Penalized BSplines,NURBS etc. before the start of GSoC. This will help me in saving time finding literature related to all these new additions. Looking forward to feedback and corrections. On 16 March 2017 at 20:03, Evgeni Burovski <evgeny.burovskiy@gmail.com> wrote: _______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org https://mail.scipy.org/mailman/listinfo/scipy-dev On Thu, Mar 16, 2017 at 11:06 AM, Aman Pratik <amanpratik10@gmail.com> wrote: Hello Developers, This is Aman Pratik. I am currently pursuing my B.Tech from Indian Institute of Technology, Varanasi. I am a keen software developer and not very new to the open source community. I am interested in your project "Improve support for B-splines" for GSoC 2017. I have been working in Python for the past 2 years and have good idea about Mathematical Methods and Techniques. I am quite familiar with scipy mainly as a user and also as a developer. I also have some experience with Cython. These are the PRs I have worked/working on for the past month. ENH: Add evaluation of periodic splines #6730 DOC: Bad documentation of k in sparse.linalg.eigs See #6990 (Merged) ENH: scipy.linalg.eigsh cannot get all eigenvalues #7004 My GitHub Profile: https://www.github.com/amanp10 I am interested in Mathematical models and functions and therefore willing to work on splines. Also, I am familiar with Benchmark tests, Unit tests and other technical knowledge I would require for this project. I have started my study for the subject and am looking forward to guidance from the potential mentors or other developers. Thank You Hi Aman, and welcome! I see that you already started with https://github.com/scipy/scipy/pull/7185, great! We'll also need a proposal. Since writing a good proposal typically takes several iterations, I encourage you to start working on it, too. When you have a draft, please send it to the list. All the best, Evgeni _______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org https://mail.scipy.org/mailman/listinfo/scipy-dev _______________________________________________ SciPy-Dev mailing list SciPy-Dev@scipy.org https://mail.scipy.org/mailman/listinfo/scipy-dev
On Fri, Mar 24, 2017 at 2:15 PM, Nikolay Mayorov <nikolay.mayorov@zoho.com> wrote:
Resent my answer to the new address.
============ Forwarded message ============ From : Nikolay Mayorov <nikolay.mayorov@zoho.com> To : "SciPy Developers List"<scipy-dev@scipy.org> Date : Fri, 24 Mar 2017 01:07:10 +0500 Subject : Re: [SciPy-Dev] GSoC 2017: BSpline support ============ Forwarded message ============
De Boor, "Practical guide to splines", Chapter IX should be the place for your. Likely you will need to thoroughly study several chapters in it, it's not an easy book to quickly pick up a recipe from it.
Nikolay.
---- On Thu, 23 Mar 2017 19:31:32 +0500 *Aman Pratik <amanpratik10@gmail.com <amanpratik10@gmail.com>>* wrote ----
Hello, I need some help with *"**Convert a CubicSpline/PPoly object to a BSpline". *I am unable to find suitable literature for it, or maybe I am overlooking something. I would be really grateful if you could guide me to some reading material or code samples.
Lyche and Morken, http://www.uio.no/studier/emner/matnat/ifi/INF-MAT5340/v05/undervisningsmate... can be an easier first read than de Boor (which is, indeed, *the* reference). (Hat tip to Pauli who suggested this to me a while ago). Cheers, Evgeni
Hello, This is my second Draft, Proposal : Second Draft <https://github.com/amanp10/scipy/wiki/GSoC-2017-:-Improve-support-for-B-spli...> This is somewhat incomplete in detailing. It will take me some time to make it more clear and obvious as to what I am going to do. I am facing a problem though, in getting my hands on the book "A Practical Guide to Splines" by Carl R de Boor. Also, I need some more time to get the algorithms clear in my head. So, please bear with me. Looking forward to your feedback. Thank You On 24 March 2017 at 23:12, Evgeni Burovski <evgeny.burovskiy@gmail.com> wrote:
On Fri, Mar 24, 2017 at 2:15 PM, Nikolay Mayorov <nikolay.mayorov@zoho.com
wrote:
Resent my answer to the new address.
============ Forwarded message ============ From : Nikolay Mayorov <nikolay.mayorov@zoho.com> To : "SciPy Developers List"<scipy-dev@scipy.org> Date : Fri, 24 Mar 2017 01:07:10 +0500 Subject : Re: [SciPy-Dev] GSoC 2017: BSpline support ============ Forwarded message ============
De Boor, "Practical guide to splines", Chapter IX should be the place for your. Likely you will need to thoroughly study several chapters in it, it's not an easy book to quickly pick up a recipe from it.
Nikolay.
---- On Thu, 23 Mar 2017 19:31:32 +0500 *Aman Pratik <amanpratik10@gmail.com <amanpratik10@gmail.com>>* wrote ----
Hello, I need some help with *"**Convert a CubicSpline/PPoly object to a BSpline". *I am unable to find suitable literature for it, or maybe I am overlooking something. I would be really grateful if you could guide me to some reading material or code samples.
Lyche and Morken, http://www.uio.no/studier/emner/matnat/ifi/INF-MAT5340/ v05/undervisningsmateriale/ can be an easier first read than de Boor (which is, indeed, *the* reference).
(Hat tip to Pauli who suggested this to me a while ago).
Cheers,
Evgeni
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
On Fri, Mar 24, 2017, at 12:19, Aman Pratik wrote:
Hello,
This is my second Draft, Proposal : Second Draft[1]
Would this be a good opportunity to add subdivision splines to SciPy? Their implementation (at least in 1D) is simple, and they give good locality around nodes (i.e., yield predictable curves, useful for spline design). An example is given here: https://gist.github.com/stefanv/a28d61694fe8f3ef2325b23cbc51312a Stéfan Links: 1. https://github.com/amanp10/scipy/wiki/GSoC-2017-:-Improve-support-for-B-spli...
Seems interesting. Though adding this would require doing away with some of the other part(s) of the project. I will do some research on it. Meanwhile, lets wait for feedback from the mentors. On 25 March 2017 at 04:43, Stefan van der Walt <stefanv@berkeley.edu> wrote:
On Fri, Mar 24, 2017, at 12:19, Aman Pratik wrote:
Hello, This is my second Draft, Proposal : Second Draft <https://github.com/amanp10/scipy/wiki/GSoC-2017-:-Improve-support-for-B-spli...>
Would this be a good opportunity to add subdivision splines to SciPy? Their implementation (at least in 1D) is simple, and they give good locality around nodes (i.e., yield predictable curves, useful for spline design).
An example is given here:
https://gist.github.com/stefanv/a28d61694fe8f3ef2325b23cbc51312a
Stéfan
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
Dear everyone, While we are talking about splining, I would like to add a request if possible. I am a heavy user of the splprep and co routines, and many times I need to get the local polynomial coefficients to compute the derivatives, and found the analitical zeros. I had found a recipe on stackoverlord years ago, on how to get back to local coefficient from the spline description. Maybe a method, or an option, returning the local polynomial coefficients (and the interval?) could be implemented? it's my 2 cents as a user thanks for considering it and please, discard if you think it's not fit. All the best Xavier 2017-03-25 15:29 GMT+11:00 Aman Pratik <amanpratik10@gmail.com>:
Seems interesting. Though adding this would require doing away with some of the other part(s) of the project. I will do some research on it. Meanwhile, lets wait for feedback from the mentors.
On 25 March 2017 at 04:43, Stefan van der Walt <stefanv@berkeley.edu> wrote:
On Fri, Mar 24, 2017, at 12:19, Aman Pratik wrote:
Hello, This is my second Draft, Proposal : Second Draft <https://github.com/amanp10/scipy/wiki/GSoC-2017-:-Improve-support-for-B-spli...>
Would this be a good opportunity to add subdivision splines to SciPy? Their implementation (at least in 1D) is simple, and they give good locality around nodes (i.e., yield predictable curves, useful for spline design).
An example is given here:
https://gist.github.com/stefanv/a28d61694fe8f3ef2325b23cbc51312a
Stéfan
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
-- « Quand le gouvernement viole les droits du peuple, l'insurrection est, pour le peuple et pour chaque portion du peuple, le plus sacré des droits et le plus indispensable des devoirs » Déclaration des droits de l'homme et du citoyen, article 35, 1793
This seems like a nice option, though I am not sure of its importance for computing derivatives. I mean you can use any one of the provided methods to compute the derivative. Please correct me if I am missing something. On 25 March 2017 at 11:53, Xavier Barthelemy <xabart@gmail.com> wrote:
Dear everyone,
While we are talking about splining, I would like to add a request if possible. I am a heavy user of the splprep and co routines, and many times I need to get the local polynomial coefficients to compute the derivatives, and found the analitical zeros. I had found a recipe on stackoverlord years ago, on how to get back to local coefficient from the spline description.
Maybe a method, or an option, returning the local polynomial coefficients (and the interval?) could be implemented? it's my 2 cents as a user
thanks for considering it and please, discard if you think it's not fit.
All the best Xavier
2017-03-25 15:29 GMT+11:00 Aman Pratik <amanpratik10@gmail.com>:
Seems interesting. Though adding this would require doing away with some of the other part(s) of the project. I will do some research on it. Meanwhile, lets wait for feedback from the mentors.
On 25 March 2017 at 04:43, Stefan van der Walt <stefanv@berkeley.edu> wrote:
On Fri, Mar 24, 2017, at 12:19, Aman Pratik wrote:
Hello, This is my second Draft, Proposal : Second Draft <https://github.com/amanp10/scipy/wiki/GSoC-2017-:-Improve-support-for-B-spli...>
Would this be a good opportunity to add subdivision splines to SciPy? Their implementation (at least in 1D) is simple, and they give good locality around nodes (i.e., yield predictable curves, useful for spline design).
An example is given here:
https://gist.github.com/stefanv/a28d61694fe8f3ef2325b23cbc51312a
Stéfan
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
-- « Quand le gouvernement viole les droits du peuple, l'insurrection est, pour le peuple et pour chaque portion du peuple, le plus sacré des droits et le plus indispensable des devoirs »
Déclaration des droits de l'homme et du citoyen, article 35, 1793
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
On Sat, Mar 25, 2017 at 9:23 AM, Xavier Barthelemy <xabart@gmail.com> wrote:
Dear everyone,
While we are talking about splining, I would like to add a request if possible. I am a heavy user of the splprep and co routines, and many times I need to get the local polynomial coefficients to compute the derivatives, and found the analitical zeros. I had found a recipe on stackoverlord years ago, on how to get back to local coefficient from the spline description.
Maybe a method, or an option, returning the local polynomial coefficients (and the interval?) could be implemented? it's my 2 cents as a user
You can convert to piecewise polynomials via
tck = splrep(x, y) p = PPoly.from_spline(tck)
thanks for considering it and please, discard if you think it's not fit.
All the best Xavier
2017-03-25 15:29 GMT+11:00 Aman Pratik <amanpratik10@gmail.com>:
Seems interesting. Though adding this would require doing away with some of the other part(s) of the project. I will do some research on it. Meanwhile, lets wait for feedback from the mentors.
On 25 March 2017 at 04:43, Stefan van der Walt <stefanv@berkeley.edu> wrote:
On Fri, Mar 24, 2017, at 12:19, Aman Pratik wrote:
Hello, This is my second Draft, Proposal : Second Draft <https://github.com/amanp10/scipy/wiki/GSoC-2017-:-Improve-support-for-B-spli...>
Would this be a good opportunity to add subdivision splines to SciPy? Their implementation (at least in 1D) is simple, and they give good locality around nodes (i.e., yield predictable curves, useful for spline design).
An example is given here:
https://gist.github.com/stefanv/a28d61694fe8f3ef2325b23cbc51312a
Stéfan
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
-- « Quand le gouvernement viole les droits du peuple, l'insurrection est, pour le peuple et pour chaque portion du peuple, le plus sacré des droits et le plus indispensable des devoirs »
Déclaration des droits de l'homme et du citoyen, article 35, 1793
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
Thanks!! I didn't know this trick! Is it a recent one? All the best Xavier 2017-03-25 19:30 GMT+11:00 Evgeni Burovski <evgeny.burovskiy@gmail.com>:
On Sat, Mar 25, 2017 at 9:23 AM, Xavier Barthelemy <xabart@gmail.com> wrote:
Dear everyone,
While we are talking about splining, I would like to add a request if possible. I am a heavy user of the splprep and co routines, and many times I need to get the local polynomial coefficients to compute the derivatives, and found the analitical zeros. I had found a recipe on stackoverlord years ago, on how to get back to local coefficient from the spline description.
Maybe a method, or an option, returning the local polynomial coefficients (and the interval?) could be implemented? it's my 2 cents as a user
You can convert to piecewise polynomials via
tck = splrep(x, y) p = PPoly.from_spline(tck)
thanks for considering it and please, discard if you think it's not fit.
All the best Xavier
2017-03-25 15:29 GMT+11:00 Aman Pratik <amanpratik10@gmail.com>:
Seems interesting. Though adding this would require doing away with some of the other part(s) of the project. I will do some research on it. Meanwhile, lets wait for feedback from the mentors.
On 25 March 2017 at 04:43, Stefan van der Walt <stefanv@berkeley.edu> wrote:
On Fri, Mar 24, 2017, at 12:19, Aman Pratik wrote:
Hello, This is my second Draft, Proposal : Second Draft <https://github.com/amanp10/scipy/wiki/GSoC-2017-:-Improve-support-for-B-spli...>
Would this be a good opportunity to add subdivision splines to SciPy? Their implementation (at least in 1D) is simple, and they give good locality around nodes (i.e., yield predictable curves, useful for spline design).
An example is given here:
https://gist.github.com/stefanv/a28d61694fe8f3ef2325b23cbc51312a
Stéfan
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
-- « Quand le gouvernement viole les droits du peuple, l'insurrection est, pour le peuple et pour chaque portion du peuple, le plus sacré des droits et le plus indispensable des devoirs »
Déclaration des droits de l'homme et du citoyen, article 35, 1793
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
-- « Quand le gouvernement viole les droits du peuple, l'insurrection est, pour le peuple et pour chaque portion du peuple, le plus sacré des droits et le plus indispensable des devoirs » Déclaration des droits de l'homme et du citoyen, article 35, 1793
On Tue, Mar 28, 2017 at 1:53 AM, Xavier Barthelemy <xabart@gmail.com> wrote:
Thanks!! I didn't know this trick! Is it a recent one?
Yeah, PPoly is missing the `.. versionadded::` note --- it is new in scipy 0.14.0. (this and many other things, Pauli FTW)
All the best Xavier
2017-03-25 19:30 GMT+11:00 Evgeni Burovski <evgeny.burovskiy@gmail.com>:
On Sat, Mar 25, 2017 at 9:23 AM, Xavier Barthelemy <xabart@gmail.com> wrote:
Dear everyone,
While we are talking about splining, I would like to add a request if possible. I am a heavy user of the splprep and co routines, and many times I need to get the local polynomial coefficients to compute the derivatives, and found the analitical zeros. I had found a recipe on stackoverlord years ago, on how to get back to local coefficient from the spline description.
Maybe a method, or an option, returning the local polynomial coefficients (and the interval?) could be implemented? it's my 2 cents as a user
You can convert to piecewise polynomials via
tck = splrep(x, y) p = PPoly.from_spline(tck)
thanks for considering it and please, discard if you think it's not fit.
All the best Xavier
2017-03-25 15:29 GMT+11:00 Aman Pratik <amanpratik10@gmail.com>:
Seems interesting. Though adding this would require doing away with some of the other part(s) of the project. I will do some research on it. Meanwhile, lets wait for feedback from the mentors.
On 25 March 2017 at 04:43, Stefan van der Walt <stefanv@berkeley.edu> wrote:
On Fri, Mar 24, 2017, at 12:19, Aman Pratik wrote:
Hello, This is my second Draft, Proposal : Second Draft <https://github.com/amanp10/scipy/wiki/GSoC-2017-:-Improve-support-for-B-spli...>
Would this be a good opportunity to add subdivision splines to SciPy? Their implementation (at least in 1D) is simple, and they give good locality around nodes (i.e., yield predictable curves, useful for spline design).
An example is given here:
https://gist.github.com/stefanv/a28d61694fe8f3ef2325b23cbc51312a
Stéfan
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
-- « Quand le gouvernement viole les droits du peuple, l'insurrection est, pour le peuple et pour chaque portion du peuple, le plus sacré des droits et le plus indispensable des devoirs »
Déclaration des droits de l'homme et du citoyen, article 35, 1793
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
-- « Quand le gouvernement viole les droits du peuple, l'insurrection est, pour le peuple et pour chaque portion du peuple, le plus sacré des droits et le plus indispensable des devoirs »
Déclaration des droits de l'homme et du citoyen, article 35, 1793
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
Hi Aman, On Sat, Mar 25, 2017 at 8:19 AM, Aman Pratik <amanpratik10@gmail.com> wrote:
Hello, This is my second Draft, Proposal : Second Draft <https://github.com/amanp10/scipy/wiki/GSoC-2017-:-Improve-support-for-B-spli...>
This is somewhat incomplete in detailing. It will take me some time to make it more clear and obvious as to what I am going to do.
My main feedback is that you need to try to focus the proposal more, it feels a bit scattergun. You state that the major topic is cardinal B-splines, however you don't plan to start on those until week 8 and only allocate 3 out of 12 weeks for it. Other minor comments: - no need to repeat for every week that you'll add docs and tests; instead just state that once somewhere. - string aliases for `bc_type` should not take a full week, that's less than a day of work (so consider removing it). A lot of your task descriptions are taken from https://github.com/scipy/scipy/issues/6730. I'd suggest to limit the eay-fix tasks on there to say the first two weeks, and in your proposal tackle one main topic and add enough content about it to show that you have an understanding of how to get that done. Cheers, Ralf
I am facing a problem though, in getting my hands on the book "A Practical Guide to Splines" by Carl R de Boor. Also, I need some more time to get the algorithms clear in my head. So, please bear with me. Looking forward to your feedback.
Thank You
On 24 March 2017 at 23:12, Evgeni Burovski <evgeny.burovskiy@gmail.com> wrote:
On Fri, Mar 24, 2017 at 2:15 PM, Nikolay Mayorov < nikolay.mayorov@zoho.com> wrote:
Resent my answer to the new address.
============ Forwarded message ============ From : Nikolay Mayorov <nikolay.mayorov@zoho.com> To : "SciPy Developers List"<scipy-dev@scipy.org> Date : Fri, 24 Mar 2017 01:07:10 +0500 Subject : Re: [SciPy-Dev] GSoC 2017: BSpline support ============ Forwarded message ============
De Boor, "Practical guide to splines", Chapter IX should be the place for your. Likely you will need to thoroughly study several chapters in it, it's not an easy book to quickly pick up a recipe from it.
Nikolay.
---- On Thu, 23 Mar 2017 19:31:32 +0500 *Aman Pratik <amanpratik10@gmail.com <amanpratik10@gmail.com>>* wrote ----
Hello, I need some help with *"**Convert a CubicSpline/PPoly object to a BSpline". *I am unable to find suitable literature for it, or maybe I am overlooking something. I would be really grateful if you could guide me to some reading material or code samples.
Lyche and Morken, http://www.uio.no/studier/emne r/matnat/ifi/INF-MAT5340/v05/undervisningsmateriale/ can be an easier first read than de Boor (which is, indeed, *the* reference).
(Hat tip to Pauli who suggested this to me a while ago).
Cheers,
Evgeni
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
Hello Aman, Hello,
This is my second Draft, Proposal : Second Draft <https://github.com/amanp10/scipy/wiki/GSoC-2017-:-Improve-support-for-B-spli...>
I'd echo Ralf's comments on that the proposal needs some more focus. Several further comments: * Removing FITPACK is not a goal in itself. It would be better to focus a bit more on adding what is not available otherwise. In particular: - spending two weeks on reimplementing the knot insertion is not very useful, I'd say. - ditto for spending a whole week on the root finding. Sure, root-finding for non cubic splines is something we do not have currently, so adding it could be useful to have and fun to work on. However it's lower priority IMO. * If you say your main focus is cardinal splines, then just as Ralf said, it's better to start working on them earlier. However just adding a BSpline subclass would not be enough: there are some b-splines in scipy.signal, and some of it is in not too good of a shape. It would be nice to ask scipy.signal folks for feedback to drive your design: both on cleaning up scipy.signal, and on what sort of API / functionality they would find useful. * I would suggest to expand a bit the algorithmic part of the proposal.
From the current state of the proposal it's not even clear that you know or will learn how to implement algorithms you are discussing (conversions between bases, periodic interpolation).
* In my POV, the project could/should lean a bit more towards writing algorithmic code (this is what Nikolay was saying a while ago in a parallel thread). -- Rereading the thread, I now find that I missed a prompt for comments from Nikolay:
For "Spline fitting to data" I'm somewhat confused, because make_lsq_spline and make_interp_spline seem to already solve fitting problems without relying on FITPACK. Evgeni, what is the situation here
* make_interp_spline needs an algorithmic improvement to handle periodic boundary conditions. It uses banded linear algebra, but with periodic BC, the collocation matrix has additional off-band elements, because first and last data points are close to each other. Chuck was saying at some point that a while ago he did something like that with a variant of the Sherman-Morrison formula for cubic splines. * make_lsq_spline is basically a stub: (i) it only works with user-supplied knots. Knot selection is a major thing which FITPACK does, and we don't have any alternatives. IMO looking into alternative algorithms could a major improvement from this sort of project. I'm not aware of *the* method, so possibly there's room for offering several alternatives and/or better user control. (cf https://github.com/scipy/scipy/issues/2579, https://github.com/scipy/scipy/issues/1753) (ii) it explicitly forms the normal equations (A.T @ A, where A is the collocation matrix). A better way would be to do some form of banded SVD or QR. I just recently learned (from a student) that LAPACK has routines for that (*gbbrd, *bdsqr), and we even expose them via cython_lapack. To sum up, I see at least three directions the project can focus on: - Low-level algorithms: some of the knot selection, periodic interpolation, banded SVD etc. - Cardinal b-splines and their uses in scipy.signal - What Stefan suggested upthread. Either of these can be coupled with easier-fix tasks for the first few weeks. Cheers, Evgeni
This is somewhat incomplete in detailing. It will take me some time to make it more clear and obvious as to what I am going to do. I am facing a problem though, in getting my hands on the book "A Practical Guide to Splines" by Carl R de Boor. Also, I need some more time to get the algorithms clear in my head. So, please bear with me. Looking forward to your feedback.
Thank You
On 24 March 2017 at 23:12, Evgeni Burovski <evgeny.burovskiy@gmail.com> wrote:
On Fri, Mar 24, 2017 at 2:15 PM, Nikolay Mayorov < nikolay.mayorov@zoho.com> wrote:
Resent my answer to the new address.
============ Forwarded message ============ From : Nikolay Mayorov <nikolay.mayorov@zoho.com> To : "SciPy Developers List"<scipy-dev@scipy.org> Date : Fri, 24 Mar 2017 01:07:10 +0500 Subject : Re: [SciPy-Dev] GSoC 2017: BSpline support ============ Forwarded message ============
De Boor, "Practical guide to splines", Chapter IX should be the place for your. Likely you will need to thoroughly study several chapters in it, it's not an easy book to quickly pick up a recipe from it.
Nikolay.
---- On Thu, 23 Mar 2017 19:31:32 +0500 *Aman Pratik <amanpratik10@gmail.com <amanpratik10@gmail.com>>* wrote ----
Hello, I need some help with *"**Convert a CubicSpline/PPoly object to a BSpline". *I am unable to find suitable literature for it, or maybe I am overlooking something. I would be really grateful if you could guide me to some reading material or code samples.
Lyche and Morken, http://www.uio.no/studier/emne r/matnat/ifi/INF-MAT5340/v05/undervisningsmateriale/ can be an easier first read than de Boor (which is, indeed, *the* reference).
(Hat tip to Pauli who suggested this to me a while ago).
Cheers,
Evgeni
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
Hi Evgeni, After looking into the issues page, I found this issue I could work on for 'scipy.signal'. https://github.com/scipy/scipy/issues/6393 Is there anything else you want me to have a look at, apart from the comments for 'scipy.signal' which I will be collecting in some time? Thank You On 29 March 2017 at 21:08, Evgeni Burovski <evgeny.burovskiy@gmail.com> wrote:
Hello Aman,
Hello,
This is my second Draft, Proposal : Second Draft <https://github.com/amanp10/scipy/wiki/GSoC-2017-:-Improve-support-for-B-spli...>
I'd echo Ralf's comments on that the proposal needs some more focus. Several further comments:
* Removing FITPACK is not a goal in itself. It would be better to focus a bit more on adding what is not available otherwise. In particular:
- spending two weeks on reimplementing the knot insertion is not very useful, I'd say. - ditto for spending a whole week on the root finding. Sure, root-finding for non cubic splines is something we do not have currently, so adding it could be useful to have and fun to work on. However it's lower priority IMO.
* If you say your main focus is cardinal splines, then just as Ralf said, it's better to start working on them earlier. However just adding a BSpline subclass would not be enough: there are some b-splines in scipy.signal, and some of it is in not too good of a shape. It would be nice to ask scipy.signal folks for feedback to drive your design: both on cleaning up scipy.signal, and on what sort of API / functionality they would find useful.
* I would suggest to expand a bit the algorithmic part of the proposal. From the current state of the proposal it's not even clear that you know or will learn how to implement algorithms you are discussing (conversions between bases, periodic interpolation).
* In my POV, the project could/should lean a bit more towards writing algorithmic code (this is what Nikolay was saying a while ago in a parallel thread).
-- Rereading the thread, I now find that I missed a prompt for comments from Nikolay:
For "Spline fitting to data" I'm somewhat confused, because make_lsq_spline and make_interp_spline seem to already solve fitting problems without relying on FITPACK. Evgeni, what is the situation here
* make_interp_spline needs an algorithmic improvement to handle periodic boundary conditions. It uses banded linear algebra, but with periodic BC, the collocation matrix has additional off-band elements, because first and last data points are close to each other. Chuck was saying at some point that a while ago he did something like that with a variant of the Sherman-Morrison formula for cubic splines.
* make_lsq_spline is basically a stub:
(i) it only works with user-supplied knots. Knot selection is a major thing which FITPACK does, and we don't have any alternatives. IMO looking into alternative algorithms could a major improvement from this sort of project. I'm not aware of *the* method, so possibly there's room for offering several alternatives and/or better user control. (cf https://github.com/scipy/scipy/issues/2579, https:// github.com/scipy/scipy/issues/1753)
(ii) it explicitly forms the normal equations (A.T @ A, where A is the collocation matrix). A better way would be to do some form of banded SVD or QR. I just recently learned (from a student) that LAPACK has routines for that (*gbbrd, *bdsqr), and we even expose them via cython_lapack.
To sum up, I see at least three directions the project can focus on:
- Low-level algorithms: some of the knot selection, periodic interpolation, banded SVD etc. - Cardinal b-splines and their uses in scipy.signal - What Stefan suggested upthread.
Either of these can be coupled with easier-fix tasks for the first few weeks.
Cheers,
Evgeni
This is somewhat incomplete in detailing. It will take me some time to make it more clear and obvious as to what I am going to do. I am facing a problem though, in getting my hands on the book "A Practical Guide to Splines" by Carl R de Boor. Also, I need some more time to get the algorithms clear in my head. So, please bear with me. Looking forward to your feedback.
Thank You
On 24 March 2017 at 23:12, Evgeni Burovski <evgeny.burovskiy@gmail.com> wrote:
On Fri, Mar 24, 2017 at 2:15 PM, Nikolay Mayorov < nikolay.mayorov@zoho.com> wrote:
Resent my answer to the new address.
============ Forwarded message ============ From : Nikolay Mayorov <nikolay.mayorov@zoho.com> To : "SciPy Developers List"<scipy-dev@scipy.org> Date : Fri, 24 Mar 2017 01:07:10 +0500 Subject : Re: [SciPy-Dev] GSoC 2017: BSpline support ============ Forwarded message ============
De Boor, "Practical guide to splines", Chapter IX should be the place for your. Likely you will need to thoroughly study several chapters in it, it's not an easy book to quickly pick up a recipe from it.
Nikolay.
---- On Thu, 23 Mar 2017 19:31:32 +0500 *Aman Pratik <amanpratik10@gmail.com <amanpratik10@gmail.com>>* wrote ----
Hello, I need some help with *"**Convert a CubicSpline/PPoly object to a BSpline". *I am unable to find suitable literature for it, or maybe I am overlooking something. I would be really grateful if you could guide me to some reading material or code samples.
Lyche and Morken, http://www.uio.no/studier/emne r/matnat/ifi/INF-MAT5340/v05/undervisningsmateriale/ can be an easier first read than de Boor (which is, indeed, *the* reference).
(Hat tip to Pauli who suggested this to me a while ago).
Cheers,
Evgeni
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
I will go through it properly. On 24 March 2017 at 23:12, Evgeni Burovski <evgeny.burovskiy@gmail.com> wrote:
On Fri, Mar 24, 2017 at 2:15 PM, Nikolay Mayorov <nikolay.mayorov@zoho.com
wrote:
Resent my answer to the new address.
============ Forwarded message ============ From : Nikolay Mayorov <nikolay.mayorov@zoho.com> To : "SciPy Developers List"<scipy-dev@scipy.org> Date : Fri, 24 Mar 2017 01:07:10 +0500 Subject : Re: [SciPy-Dev] GSoC 2017: BSpline support ============ Forwarded message ============
De Boor, "Practical guide to splines", Chapter IX should be the place for your. Likely you will need to thoroughly study several chapters in it, it's not an easy book to quickly pick up a recipe from it.
Nikolay.
---- On Thu, 23 Mar 2017 19:31:32 +0500 *Aman Pratik <amanpratik10@gmail.com <amanpratik10@gmail.com>>* wrote ----
Hello, I need some help with *"**Convert a CubicSpline/PPoly object to a BSpline". *I am unable to find suitable literature for it, or maybe I am overlooking something. I would be really grateful if you could guide me to some reading material or code samples.
Lyche and Morken, http://www.uio.no/studier/emner/matnat/ifi/INF-MAT5340/ v05/undervisningsmateriale/ can be an easier first read than de Boor (which is, indeed, *the* reference).
(Hat tip to Pauli who suggested this to me a while ago).
Cheers,
Evgeni
_______________________________________________ SciPy-Dev mailing list SciPy-Dev@python.org https://mail.python.org/mailman/listinfo/scipy-dev
participants (6)
-
Aman Pratik -
Evgeni Burovski -
Nikolay Mayorov -
Ralf Gommers -
Stefan van der Walt -
Xavier Barthelemy