Re: Implementation of Landau distribution into scipy

Warren Weckesser <[email protected]> Fri, 5 May 2023 10:37:42 -0400
Newsgroups gmane.comp.python.scientific.devel
Message-ID <CAGzF1udpNg9eHQ8NZ4AUyOT3EPPK6zSwmrXYFPgQb3KDFTffSQ@mail.gmail.com>
On 4/30/23, Matias Senger <[email protected]> wrote:
> Hi,
>
> I am new here, though have been a SciPy user for several years. I am working
> on solid state radiation detectors and often need to use the [Landau
> distribution](https://es.wikipedia.org/wiki/Distribuci%C3%B3n_de_Landau) to
> model my data. Since I could not find it in Python I implemented it myself
> (see here https://github.com/SengerM/landaupy). It is based on the Root
> implementation, still it is a "pure Python" version only using scipy and
> numpy.
>
> Now I would like to add it into SciPy so it is there for other people as
> well. I would like to do this myself mainly for two reasons, one is to give
> back a grain of salt to SciPy and the other is to actually contribute to a
> large open source project, which I've never done before but always wanted
> to. I am following the steps listed in the [contributor quickstart
> guide](https://scipy.github.io/devdocs/dev/dev_quickstart.html). I run into
> [an issue](https://github.com/scipy/scipy/issues/18390) which will hopefully
> be solved but while asking for help about that I was suggested to propose
> this feature here before sitting to work on it.
>
> Please let me know your thoughts.
>

Thanks for your interest in contributing to SciPy, Matias.

The ROOT library uses the LGPL license, and if your code is derived
from the ROOT code, it must also use the LGPL license.  The LGPL
license is not compatible with SciPy's license, so we would not be
able to include your version in SciPy.  (Disclaimer: I am not a
lawyer; this is just my understanding of the situation.)

The Landau distribution is a special case of Levy's stable
distribution, which is available in SciPy as
`scipy.stats.levy_stable`.  The Landau distribution is obtained from
`levy_stable` by setting both shape parameters alpha and beta to 1.
That leaves the location and scale parameters still available to
adjust the location and scale of the Landau distribution.

It might be worthwhile to have a specialized implementation
specifically for the Landau distribution.  The specialized code could
probably be made much faster and/or more accurate than the
implementation of `levy_stable`.   It would be good to get more
feedback from users (probably mostly physicists) on whether there is
demand for it.  But if we do, the implementation cannot be derived
from the ROOT implementation.

Warren


> Kind regards,
> Matias.
> _______________________________________________
> SciPy-Dev mailing list -- [email protected]
> To unsubscribe send an email to [email protected]
> https://mail.python.org/mailman3/lists/scipy-dev.python.org/
> Member address: [email protected]
>
_______________________________________________
SciPy-Dev mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/scipy-dev.python.org/
Member address: [email protected]