Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

BUG: levy_stable.pdf does not use pdf_default_method_name attribute #18432

Closed
pdonnat opened this issue May 6, 2023 · 4 comments · Fixed by #18633
Closed

BUG: levy_stable.pdf does not use pdf_default_method_name attribute #18432

pdonnat opened this issue May 6, 2023 · 4 comments · Fixed by #18633
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.stats
Milestone

Comments

@pdonnat
Copy link
Contributor

pdonnat commented May 6, 2023

Describe your issue.

The option pdf_default_method is not used for pdf computation of levy_stable pdf.

Line 892 of file __init__.py
pdf_default_method_name = levy_stable_gen.pdf_default_method
should be
pdf_default_method_name = self.pdf_default_method
similar to line 1037 for cdf computation.

Reproducing Code Example

from scipy.stats import levy_stable
import numpy as np
x = np.arange(-10, 10, .001)
alpha=1.5
beta=1
levy_stable .pdf_default_method = 'piecewise'
y= levy_stable.pdf(x, alpha, beta)
levy_stable .pdf_default_method = 'fft-simpson'
z = levy_stable.pdf(x, alpha, beta)

Error message

(z-y).all() should return True

SciPy/NumPy/Python version and system information

1.10.1 1.23.5 sys.version_info(major=3, minor=11, micro=0, releaselevel='final', serial=0)
Build Dependencies:
  blas:
    detection method: pkgconfig
    found: true
    include directory: c:/opt/openblas/if_32/64/include
    lib directory: c:/opt/openblas/if_32/64/lib
    name: openblas
    openblas configuration: USE_64BITINT= DYNAMIC_ARCH=1 DYNAMIC_OLDER= NO_CBLAS=
      NO_LAPACK= NO_LAPACKE= NO_AFFINITY=1 USE_OPENMP= PRESCOTT MAX_THREADS=4
    pc file directory: c:/opt/openblas/if_32/64/lib/pkgconfig
    version: 0.3.18
  lapack:
    detection method: pkgconfig
    found: true
    include directory: c:/opt/openblas/if_32/64/include
    lib directory: c:/opt/openblas/if_32/64/lib
    name: openblas
    openblas configuration: USE_64BITINT= DYNAMIC_ARCH=1 DYNAMIC_OLDER= NO_CBLAS=
      NO_LAPACK= NO_LAPACKE= NO_AFFINITY=1 USE_OPENMP= PRESCOTT MAX_THREADS=4
    pc file directory: c:/opt/openblas/if_32/64/lib/pkgconfig
    version: 0.3.18
Compilers:
  c:
    commands: cc
    linker: ld.bfd
    name: gcc
    version: 10.3.0
  c++:
    commands: c++
    linker: ld.bfd
    name: gcc
    version: 10.3.0
  cython:
    commands: cython
    linker: cython
    name: cython
    version: 0.29.33
  fortran:
    commands: gfortran
    linker: ld.bfd
    name: gcc
    version: 10.3.0
  pythran:
    include directory: C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-tkj0pjht\overlay\Lib\site-packages\pythran
    version: 0.12.1
Machine Information:
  build:
    cpu: x86_64
    endian: little
    family: x86_64
    system: windows
  cross-compiled: false
  host:
    cpu: x86_64
    endian: little
    family: x86_64
    system: windows
Python Information:
  path: C:\Users\runneradmin\AppData\Local\Temp\cibw-run-7zsnxupn\cp311-win_amd64\build\venv\Scripts\python.exe
  version: '3.11'
@pdonnat pdonnat added the defect A clear bug or issue that prevents SciPy from being installed or used as expected label May 6, 2023
@mdhaber
Copy link
Contributor

mdhaber commented Jun 1, 2023

@steppi now that gh-18133 is done, could you take a look at this other levy_stable issue?

@steppi
Copy link
Contributor

steppi commented Jun 1, 2023

@steppi now that gh-18133 is done, could you take a look at this other levy_stable issue?

Sure. I’ll take a look tomorrow. Thanks for the bug report @pdonnat.

@steppi
Copy link
Contributor

steppi commented Jun 1, 2023

Good catch @pdonnat. gh-9523 was such a big PR that it was easy to miss things like this. Do you want a submit a PR with the fix?

pdonnat pushed a commit to pdonnat/scipy that referenced this issue Jun 5, 2023
pdonnat pushed a commit to pdonnat/scipy that referenced this issue Jun 5, 2023
@pdonnat
Copy link
Contributor Author

pdonnat commented Jun 5, 2023

I created the PR #18633 for correcting the issue.

steppi pushed a commit that referenced this issue Jun 5, 2023
Co-authored-by: Philippe DONNAT <pdonnat@hcmdom.local>
@j-bowhay j-bowhay added this to the 1.12.0 milestone Jun 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
defect A clear bug or issue that prevents SciPy from being installed or used as expected scipy.stats
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants