Coder Social home page Coder Social logo

scipy / scipy-cookbook Goto Github PK

View Code? Open in Web Editor NEW
459.0 52.0 179.0 31.32 MB

Scipy Cookbook

Home Page: https://scipy-cookbook.readthedocs.io/

License: Other

Python 5.35% Jupyter Notebook 94.00% C 0.36% Lasso 0.10% MATLAB 0.06% SWIG 0.09% Cython 0.04%
ipython-notebook scientific scipy-stack examples jupyter-notebook notebook python

scipy-cookbook's Introduction

Scipy Cookbook

This is a conversion and second life of SciPy Cookbook (previously at http://wiki.scipy.org/Cookbook/); as a bunch of Ipython notebooks.

It can be found live at http://scipy-cookbook.readthedocs.org/

Contributing

Add new notebooks or fix old ones by sending pull requests

Alternatively open an issue and attach (drag-and-drop) a fixed notebook file.

  • The ipython/ directory contains IPython notebooks.
  • Each notebook should start with a title (Markdown # Some title).
  • Notebooks can be categorized by adding Markdown text TAGS: Name of section (on a single line). Try to stick with existing sections, if reasonable.
  • Notebooks can include author name, by adding Markdown text AUTHORS: Some Name; Another Name (on a single line).

Run python build.py --html to generate HTML output to _build/html.

The conversion of the wiki content was originally done by Matti Pastell: https://github.com/mpastell/SciPy-CookBook

Janitorial tasks

Much of the old wiki content is outdated, so if someone has huge amounts of extra time on their hands, going through them could be useful.

Before starting, check out the list of pull requests and issues here to avoid doing duplicate work. You can see which files have been already modified by looking at here: https://github.com/scipy/scipy-cookbook/tree/master/ipython. It's also worth checking https://github.com/scipy/scipy-cookbook/network to see if there are any in-progress branches uploaded to Github which haven't yet been merged.

Your help is both needed and appreciated. The quick way to get started is to fork this repo, and then do

git clone [email protected]:YOURUSERNAME/SciPy-CookBook.git
cd SciPy-CookBook
git remote add upstream https://github.com/scipy/scipy-cookbook.git
cd ipython

and then switch to a new branch

git checkout -b edit-xxx
git fetch upstream
git reset --hard upstream/master

after which

ipython notebook
# edit notebook XXX in ipython web notebook and save
git commit -m "Fix up notebook XXX" -a
git push origin edit-xxx

and then browse to your github repo page and send the fixed version as a pull request.

If you however cannot be arsed to use git, just upload the file somewhere (e.g. gist.github.com) and file a new issue and tell which file you changed and include a link to the uploaded file. Thanks!

What to fix

The Ipython notebook conversion is not fully flawless, and cannot be fully automated. What needs to be done is:

  • Ensure the code examples are runnable.

  • Ensure the image links are correct (look for malformatted [...](...) in the markdown text blocks --- the conversion didn't always treat these correctly).

    Local files and images should be linked to via standard Markdown syntax [link text](files/attachments/NotebookName/filename) and ![](files/attachments/NotebookName/image.png)

  • Ensure each notebook begins with a top-level heading with a title for the snippet. Avoid using other top-level headings in the rest of the notebooks. (This should be the case currently.)

  • Replace image attachments with the images generated by the plotting commands in the examples themselves, where appropriate.

  • Remove unnecessary file attachments, where appropriate (remember that the ipython notebooks can be converted to scripts easily, and the purpose is more to distribute code snippets rather than full modules).

  • Remove obviously useless (e.g. empty) files.

  • Obviously outdated content should get a short notice on top, with a date of the last update on http://wiki.scipy.org/

    Also add TAGS: Outdated so that it goes to the outdated section.

  • If some entry is too incomplete to fix (e.g. math formulas), look at the source version at http://wiki.scipy.org/Cookbook/

  • Compare against the original wiki version under original/. Check if a part of the text at the end is missing.

  • And other things. Note, however, that the point is more to fix surface issues than to try to rewrite things in a better way.

scipy-cookbook's People

Contributors

alexemg avatar benjimin avatar billtubbs avatar biogeek avatar bmaranville avatar cassiasamp avatar chryss avatar clem-starsky avatar danielboone avatar j-bowhay avatar josephcslater avatar kotmorderca avatar lzkelley avatar mathemusician avatar mckib2 avatar mdhaber avatar mpastell avatar nicoguaro avatar nmayorov avatar pv avatar quintusdias avatar reptilianbrain avatar rgommers avatar riwoodward avatar roya0045 avatar scottza avatar squiba avatar steppi avatar teusia avatar warrenweckesser avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

scipy-cookbook's Issues

Is there appetite for trying to revitalize the cookbook?

The scipy-cookbook has been a great resource in the past, but (as noted in the book itself) it is not really curated/had a high volume of attention paid to it. Is there any interest among maintainers to try to kick-start the cookbook and perhaps make it a more easy/visible place for users to contribute scipy tutorial content?

Specifically, I'd think of starting with updating the infrastructure - moving away from the custom build/cookbookrebuild.py workflow to a pure sphinx-based workflow using some of the excellent tools of the executablebooks project. I've had some experience working on similar projects for NumPy (numpy-tutorials) and NetworkX (nx-guides) and have found that the tools of the executablebooks project work very well and offer some great benefits like including (but not limited to):

  • The possibility for a fully sphinx-based workflow (doesn't require any custom building/rendering scripts - notebook execution and execution caching via sphinx extensions)
  • Support for jupyter notebooks out of the box (a major advantage here, since the content is already in notebooks)
  • Support for a markdown-based text format for Jupyter notebooks that makes diffing/reviewing notebooks much more straightforward

I realize that this is just the tip of the iceberg - the real challenge would be evaluating/updating the content of the cookbook - but I think modernizing the workflow might make subsequent steps/improvements easier.

I'd be happy to work on this, but I want to make sure that this is something that others/maintainers would be interested in!

Incorrect variable used in RadialBasisFunctions.ipynb

In the 1D example, when plotting the two curves, it plots the same curve twice.

On line 58:
plt.plot(xi, yi, 'g')
Should be:
plt.plot(xi, fi, 'g')

I would do a pull request but this would require updating the image as well, and I'm not able to produce the image without the title of the RBF curve overlapping with the xticks of the first curve.

Miss-assigned errors in power-law fit?

The current error assignment in the power-law fit is:
indexErr = np.sqrt( covar[0][0] )
ampErr = np.sqrt( covar[1][1] ) * amp

But since index is the first component and amp is the zeroth component:
index = pfinal[1]
amp = 10.0**pfinal[0]
Shouldn't the error assignment be:
indexErr = np.sqrt( covar[1][1] )
ampErr = np.sqrt( covar[0][0] ) * amp
? Am I missing something obvious? Thanks!

slice in https://github.com/scipy/scipy-cookbook/blob/master/ipython/SignalSmooth.ipynb

Sorry not sending pull request as I am not sure I am correct. But I tried returning the slice suggested and had different output length. I am not sure of the math and how numpy.convolve works but my correction seems to pull the "middle" slice. E.g,. for window_len = 5 my suggested slice omits first two and last two elements.

NOTE: length(output) != length(input), to correct this: return y[(window_len/2-1):-(window_len/2)] instead of just y.

be

NOTE: length(output) != length(input), to correct this: return y[(window_len/2):-(window_len/2)] instead of just y.

Notebook formats

If I want to submit a PR with an updated notebook, the notebook format will be updated to the current one (v4 i think?). Is that okay? It will mean that the notebook formats are mixed in the repo, because i won't update all of them?

Missing words in scipy-cookbook/ipython/ViewsVsCopies.ipynb

"For example, fancy indexing for could have been expressed by , but it is not possible to do the same for by means of a slice. So, this is why an object with a copy of the original data is returned instead."

"i.e. a new object with a copy (remember, fancy indexing does not return views) of some elements of is created and returned prior to call <is there missing information here? which call?>."

''Hint: think in terms of the sequence of {{{getitem()}}} and {{{setitem()}}} calls and what they do on each example.'' Not sure if something else is meant with the triple braces.

Sorry I would put up a PR if I knew what info to fill in, but i'm learning now!

Value, Point methods not available in matplotlib.transforms

Hi,

I am trying to reproduce the multiline transforms code, but it seems that some methods (Value, Point) from the .transforms module haven't been included in it since a decade already. What can I use instead of these methods?

Best,
Izabel

Output text without formatting

Hi!

I noticed that all text in output cells is displayed with all formatting ignored. For example the first "out" here.

Maybe you can fix it?

Discussion

Thank you for this work. It’s pretty amazing.

Please open a discussion.

Small but important correction

In the section titled "Parallel Programming with numpy and scipy" in ParallelProgramming.ipynb, there's statement that while true in most cases, is not universally valid: "Using a multicore machine will provide at best a speedup by a factor of the number of cores available."

For things like searching a tree, depending on where the sought-after node is, it is possible to observe speedups of factors far greater than the number of cores available.

License?

I cannot find license information in this repo. What is the license for this material?

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.