GithubHelp home page GithubHelp logo

analyze-scipy-code's Introduction

Assorted scripts that I use to analyze the SciPy source code.

  • dists_that_override.py: Display which of the SciPy univariate continuous distributions override the given method names. For example,

    $ python dists_that_override.py _cdf _ppf _sf _isf _rvs
    SciPy version 1.11.0.dev0+1566.d5ceb77
    
    distribution         _cdf _ppf _sf  _isf _rvs
    alpha                ✔    ✔    -    -    -
    anglit               ✔    ✔    -    -    -
    arcsine              ✔    ✔    -    -    -
    argus                ✔    -    ✔    -    ✔
    beta                 ✔    ✔    ✔    ✔    ✔
    betaprime            ✔    ✔    -    -    ✔
    bradford             ✔    ✔    -    -    -
    burr                 ✔    ✔    ✔    -    -
    [...]
    wald                 ✔    ✔    ✔    ✔    ✔
    weibull_max          ✔    ✔    ✔    -    -
    weibull_min          ✔    ✔    ✔    -    -
    wrapcauchy           ✔    ✔    -    -    -
    
  • find_functions_missing_examples.py: Find functions whose docstring is missing the "Examples" section.

  • find_missing_import_np.py: Find functions where there is an "Examples" section that uses the name np but that do not have a corresponding import numpy as np.

  • find_docstring_issues.py: (Work in progress) Looks for several common issues in the docstrings. For example,

    $ python find_docstring_issues.py sparse
    scipy version 1.10.0.dev0+2299.5beb395
    
    === sparse ===
    sparse.block_diag
        section out of order: 'See Also'
    sparse.diags
        missing section: 'Returns'
    sparse.eye
        missing section: 'Returns'
    sparse.hstack
        missing section: 'Returns'
    sparse.identity
        missing section: 'Returns'
    sparse.rand
        section out of order: 'See Also'
    sparse.random
        duplicated imports in Examples:
            >>> from scipy.sparse import random
    sparse.save_npz
        missing section: 'Returns'
    sparse.spdiags
        missing section: 'Returns'
    sparse.vstack
        missing section: 'Returns'
    
  • extract_example_code.py: Extract the code from the 'Examples' section of the SciPy object.

    For example,

    $ python extract_example_code.py scipy.special.logsumexp
    Code from the 'Examples' section of scipy.special.logsumexp written to 'example_logsumexp.py'.
    $ cat example_logsumexp.py
    # Python code extracted from the 'Examples' section of
    # scipy.special.logsumexp
    
    import numpy as np
    from scipy.special import logsumexp
    a = np.arange(10)
    logsumexp(a)
    np.log(np.sum(np.exp(a)))
    a = np.arange(10)
    b = np.arange(10, 0, -1)
    logsumexp(a, b=b)
    np.log(np.sum(b*np.exp(a)))
    logsumexp([1,2],b=[1,-1],return_sign=True)
    a = np.ma.array([np.log(2), 2, np.log(3)],
                    mask=[False, True, False])
    b = (~a.mask).astype(int)
    logsumexp(a.data, b=b), np.log(5)
    

analyze-scipy-code's People

Contributors

warrenweckesser avatar

Watchers

 avatar

Forkers

soubhagyakhan

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.