Giter Club home page Giter Club logo

scientific-python-lectures's People

Contributors

aespaze avatar btel avatar ccomb avatar dependabot[bot] avatar dpinte avatar drvinceknight avatar emmanuelle avatar esc avatar gaelvaroquaux avatar gertingold avatar jarrodmillman avatar jorisvandenbossche avatar keszybz avatar mdhaber avatar michael-hartmann avatar mriehl avatar nellev avatar nicola-masarone avatar npettiaux avatar ozancaglayan avatar pdebuyl avatar pv avatar rc avatar rgommers avatar rossbar avatar rougier avatar stefanv avatar tupui avatar uchida avatar vahtras 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  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

scientific-python-lectures's Issues

update authors list

git shortlog -sn reports more people than listed in the AUTHORS.rst file -- sync them!

override pylab.rcParams

To avoid that a custom matplotlib_rc file will break the plots on
generation, brutally put pylab.rcParams to
pylab.rcParamsDefault before executing each script.

Was cleaning out my INBOX and found this in an old email from oct 2011, not sure if it is still relevant.

Some issues with sphinx build

I just found these wonderful lecture notes. Thank you!

Even though I think my python software is up to date I do get a few errors and warnings with the sphinx build and thought I'd let you know:

$ make html
mkdir -p build/html build/doctrees
sphinx-build -b html -d build/doctrees -D latex_paper_size=a4  . build/html
Running Sphinx v1.0.7
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/sphinx/application.py:250: FutureWarning: A plot_directive module is also available under matplotlib.sphinxext; expect this numpydoc.plot_directive module to be deprecated after relevant features have been integrated there.
  mod = __import__(extension, None, None, ['setup'])
WARNING: extension 'ipython_console_highlighting' has no setup() function; is it really a Sphinx extension module?
loading translations [en]... locale not available
loading pickled environment... not yet created
loading intersphinx inventory from http://docs.scipy.org/doc/numpy/objects.inv...
loading intersphinx inventory from http://docs.python.org/2.7/objects.inv...
building [html]: targets for 51 source files that are out of date
updating environment: 51 added, 0 changed, 0 removed
<string>:19: RuntimeWarning: overflow encountered in square                                                                                     
<string>:19: RuntimeWarning: invalid value encountered in square
<string>:17: RuntimeWarning: divide by zero encountered in divide
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/numeric.py:235: ComplexWarning: Casting complex values to real discards the imaginary part
  return array(a, dtype, copy=False, order=order)
reading sources... [100%] intro/summary-exercises/stats-interpolate                                                                             
/Users/deil/github/scipy-lecture-notes/advanced/scikit-learn/index.rst:291: (WARNING/2) toctree contains reference to nonexisting document u'advanced/scikit-learn/digits_classification_exercise'

/Users/deil/github/scipy-lecture-notes/advanced/sympy.rst:110: (WARNING/2) Inline substitution_reference start-string without end-string.

/Users/deil/github/scipy-lecture-notes/index.rst:145: WARNING: download file not readable: PythonScientific.pdf
/Users/deil/github/scipy-lecture-notes/index.rst:145: WARNING: download file not readable: PythonScientific-simple.pdf
/Users/deil/github/scipy-lecture-notes/intro/language/basic_types.rst:49: (ERROR/3) Error in "warning" directive:
invalid option block.

.. warning:: Integer division
    ::

        >>> 3 / 2
        1

    **Trick**: use floats::

        >>> 3 / 2.
        1.5

        >>> a = 3
        >>> b = 2
        >>> a / b
        1
        >>> a / float(b)
        1.5



/Users/deil/github/scipy-lecture-notes/intro/numpy/numpy.rst:586: (WARNING/2) Exception occurred in plotting numpy-3: Traceback (most recent call last):
  File "/Users/deil/github/scipy-lecture-notes/sphinxext/plot_directive.py", line 460, in run_code
    exec code in ns
  File "<string>", line 4, in <module>
ImportError: cannot import name imsave


/Users/deil/github/scipy-lecture-notes/intro/numpy/numpy.rst:1868: (WARNING/2) Literal block expected; none found.

/Users/deil/github/scipy-lecture-notes/intro/summary-exercises/image-processing.rst:52: WARNING: duplicate label image-answers, other instance in /Users/deil/github/scipy-lecture-notes/intro/summary-exercises/answers_image_processing.rst
looking for now-outdated files... none found
pickling environment... done
checking consistency... /Users/deil/github/scipy-lecture-notes/README.rst:: WARNING: document isn't included in any toctree
/Users/deil/github/scipy-lecture-notes/intro/solutions.rst:: WARNING: document isn't included in any toctree
done
preparing documents... done
writing output... [100%] intro/summary-exercises/stats-interpolate                                                                              
writing additional files... search
copying images... [100%] advanced/image_processing/diamond_kernel.png                                                                           
copying downloadable files... [100%] advanced/optimizing/demo.py                                                                                
copying static files... done
dumping search index... done
dumping object inventory... done
build succeeded, 11 warnings.
mkdir -p build/html/data
cp data/max-speeds.npy data/sprog-windspeeds.npy  build/html/data

Build finished. The HTML pages are in build/html.

Improve the chapter on working on the scipy-lectures

  • The chapter is in the 'guide' directory
  • It should explain quickly
    • How to build (using sphinx)
    • How to doctest
    • The use of examples to generate figures (ie: figure are not allowed to be checked in)
    • The use of intersphinx to link across projects
  • It should stress our style guide:
    • Chapters should be readable / doable as a tutorial in 1.5 hours to 2 hours max (which implies limiting the amount of information)
    • Links (internal, to others projects and to Wikipedia) matter terribly
    • Jargon is to be avoided at all cost
    • The use of restructured text directives, such as topic, note, seealso, tip, sidebar, is strongly encouraged

Optimization: what about SGD?

I'm not an expert, but googling for a while tells me that when you can estimate gradient or if you have tons of training samples (when used in machine learning) then using SGD can be even more efficient than BFGS(-L).

http://metaoptimize.com/qa/questions/785/online-optimization-algorithms-are-there-good-implementations-libraries-to-use

http://www.quora.com/Machine-Learning/Is-the-L-bfgs-always-better-than-stochastic-gradient-descent

It seems to me that it should be somehow represented in docs. :) Thanks.

Error in indexing example

The red example is false in intro/numpy/numpy_indexing.png
It is not array([2,22,52]).

Thank you for this nice lecture notes. I like it.

About scipy-lecture-notes / advanced / optimizing / index.rst

It seemed that it has never mentioned anything about ica.py in the index.rst……

In fact, I just tried to import fastica from sklearn.decomposition for I couldn't find out what the ica module is until I found ica.py at scipy-lecture-notes/advanced/optimizing/ica.py.

It should be better if it is explicitly mentioned for beginners like me, I think

plot directive can't handle nested directories

I ran into a problem when converting plots to sphinx plot directive. It apparently can't handle nested directories. When used in the sub-directory

intro/summary-exercices/

The generated plot file is not copied over to the build directory, and hence not included in the final build. The following error is produced when running 'make html':

/home/esc/git-working/scipy-lecture-notes/intro/summary-exercices/stats-interpolate.rst:: WARNING: image file not readable: intro/pyplots/cumulative_wind_speed_prediction.png
/home/esc/git-working/scipy-lecture-notes/intro/summary-exercices/stats-interpolate.rst:: WARNING: image file not readable: intro/pyplots/cumulative_wind_speed_prediction.pdf

This may be caused by buggy plot extension code.

To reproduce the error, check:

https://github.com/esc/scipy-lecture-notes/tree/sphinx-plot-extension-buggy

Add a chapter on testing

Science is largely the process of testing, confirming, and rejecting hypotheses in order to answer questions.

Test-Driven Development is strongly aligned with this objective.

A section on testing could be helpful?

Remove IPython style prompts

Replace all the IPython style prompts by standard ">>>"

Rational:

  • Simplifies build (we can remove ipython_console_highlighting.py)
  • Enables doctesting
  • The javascript ">>>" thing to remove interactively prompts is very cool.

document release procedure

Should probably document it, like:

  1. Check HTML and PDF compiles, warnings are OK
  2. Update and finalize changelog
  3. Bump version (and copyright) in conf.py
  4. Tag (lightweight)
  5. do make install
  6. Push tag? Push changes?

List examples have confusing elements

My wife was doing the tutorial and said that the list examples (§1.2.2.2.1. and others) were a little confusing. Coming from Matlab, a list l = [1,2,3,4,5] where l[0] == 1, l[2] = 3, while highlighting the indexing differences, was still confusing. perhaps it would be better to have the list be ['a', 'b', 'c', 'd', 'e'] or random floats or something similar.

Localization of the notes

As of Sphinx 1.1, there is the posibility to generate translatable strings (.pot files) from a Sphinx project, like it is done in the Open Data Handbook:

https://github.com/okfn/opendatahandbook#building-the-english-source-for-translation-i18n

which can be later translated, for example, through a crowdsourcing service like Transifex:

https://www.transifex.com/projects/p/opendatahandbook/

(also self-hosted if needed, otherwise the platform is free for open source projects)

Would it be possible to have this for the notes? For the case of Spanish language, we started our own translation:

https://github.com/Pybonacci/scipy-lecture-notes-ES

but it's very difficult to catch up with the changes upstream, and everything gets messed up. I would like to know if there would be the possibility, otherwise translating is probably not worth the effort.

Release next week?

Since I will be using the lecture notes for teaching from 10-15 of Feb, I would like to do a release next week. I have some more material that needs to be merged, but does anyone see any blockers? Also, are there notes about how to release somewhere?

Use sphinx-gallery

We can throw away our gen_rst.py and use sphinx gallery.

Once this is done, we can use it's cool features, like the fact that you can have multiple sub gallery, and the notebook-style examples.

Color printing

I understand this has to be a printed in color cause of the images but there is lot of other colors like every single code has a color background. That is an awful lot of color to print and gain nothing. Can you create a version where the code background isn't colored. Perhaps add a border around the code to differentiate them. Color printing is expensive. I would prefer to use color ONLY where it is absolutely necessary like the color images

Python Drawback: development environment

First of all, many thanks for this fabulous resource !

It is stated in the first section that a drawback of Python is that Python has a "less pleasant development environment than, for example, Matlab. (More geek-oriented).".

Of course it is very true is one talks about pure python or ipython from the command line. But it exists fancy GUI to develop in Python, close to to the Matlab's user experience (e.g. Spyder, ...). I would not like that a reader believes that there is no such tools.

I understand that naming directly a project and not some other can be problematic, but at least a sentence explaining that there is such GUIs would help new Python users.

Regards,

Use travis-ci to run our doc tests

On Python 2 and python 3: we need to run doc-test on the documentation, elsewhere it ends up broken (and fix them).

We can mimic the way nilearn does it to use miniconda for python 3
https://github.com/nilearn/nilearn

To run examples, we can use circle-ci, as done in nilearn, because it gives you much more computing power, and can cache dowloads in a persistent way across different runs.

Some plots do not work with scikit-image 0.9.x

Some functions in scikit-image were removed with 0.9.x :

________________________________________________________________________________
plotting plot_filter_coins.py
/data/home/max/workspace/scipy-lecture-notes/ve/local/lib/python2.7/site-packages/skimage/filter/ctmf.py:22: skimage_deprecation: Call to deprecated function ``median_filter``. Use ``filter.r
ank.median`` instead.
  def median_filter(image, radius=2, mask=None, percent=50):
________________________________________________________________________________
plot_filter_coins.py is not compiling:
Traceback (most recent call last):
  File "/data/home/max/workspace/scipy-lecture-notes/sphinxext/gen_rst.py", line 239, in generate_file_rst
    execfile(os.path.basename(src_file), {'pl': plt})
  File "plot_filter_coins.py", line 14, in <module>
    tv_filter_coins = filter.tv_denoise(coins, weight=0.1)
AttributeError: 'module' object has no attribute 'tv_denoise'
________________________________________________________________________________
plotting plot_segmentations.py
________________________________________________________________________________
plot_segmentations.py is not compiling:
Traceback (most recent call last):
  File "/data/home/max/workspace/scipy-lecture-notes/sphinxext/gen_rst.py", line 239, in generate_file_rst
    execfile(os.path.basename(src_file), {'pl': plt})
  File "plot_segmentations.py", line 11, in <module>
    from skimage.morphology import watershed, is_local_maximum
ImportError: cannot import name is_local_maximum
________________________________________________________________________________
plotting plot_lena_tv_denoise.py
________________________________________________________________________________
plot_lena_tv_denoise.py is not compiling:
Traceback (most recent call last):
  File "/data/home/max/workspace/scipy-lecture-notes/sphinxext/gen_rst.py", line 239, in generate_file_rst
    execfile(os.path.basename(src_file), {'pl': plt})
  File "plot_lena_tv_denoise.py", line 4, in <module>
    from skimage.filter import tv_denoise
ImportError: cannot import name tv_denoise
________________________________________________________________________________
plotting plot_watershed_segmentation.py
________________________________________________________________________________
plot_watershed_segmentation.py is not compiling:
Traceback (most recent call last):
  File "/data/home/max/workspace/scipy-lecture-notes/sphinxext/gen_rst.py", line 239, in generate_file_rst
    execfile(os.path.basename(src_file), {'pl': plt})
  File "plot_watershed_segmentation.py", line 2, in <module>
    from skimage.morphology import watershed, is_local_maximum
ImportError: cannot import name is_local_maximum

The docstring example in skimage.morphology seems to suggest that peak_local_max can be used as a drop-in replacement but that doesn't do the trick for me :

Traceback (most recent call last):
  File "plot_watershed_segmentation.py", line 18, in <module>
    local_maxi = peak_local_max(distance, image, np.ones((3, 3)))
  File "/data/home/max/workspace/scipy-lecture-notes/ve/local/lib/python2.7/site-packages/skimage/feature/peak.py", line 128, in peak_local_max
    image_max = ndi.maximum_filter(image, size=size, mode='constant')
  File "/data/home/max/workspace/scipy-lecture-notes/ve/local/lib/python2.7/site-packages/scipy/ndimage/filters.py", line 926, in maximum_filter
    cval, origin, 0)
  File "/data/home/max/workspace/scipy-lecture-notes/ve/local/lib/python2.7/site-packages/scipy/ndimage/filters.py", line 859, in _min_or_max_filter
    sizes = _ni_support._normalize_sequence(size, input.ndim)
  File "/data/home/max/workspace/scipy-lecture-notes/ve/local/lib/python2.7/site-packages/scipy/ndimage/_ni_support.py", line 66, in _normalize_sequence
    raise RuntimeError(err)
RuntimeError: sequence argument must have length equal to input rank

Pandas section

From a discussion with Gael, it would be nice to add an introductory section on pandas.

Typos and typesettings

On the one page per side version:

page 36, the last line,
"In you own code" should be "In your own code"

page 38, the last but two code box, code out of box.

Make the >>> text in the example unselectable

Users who want to copy and paste from the examples have to click on the >>> button to filter out the >>> symbols. It'd be nice to get rid of the >>> button and just make the >>> text in the textarea unselectable like in this example.

Note JsFiddle doesn't work as a normal website and although the highlight behaviour works for this example, it's actually saving all the text in the clipboard. It'll work properly in "real" websites.

Errors and warnings during "make html": plot_gradient_descent.py

There are several, but I will start with one:

plot_gradient_descent.py is not compiling:
Traceback (most recent call last):
File "/home/vahtras/Courses/scipy-lecture-notes/sphinxext/gen_rst.py", line 236, in generate_file_rst
execfile(os.path.basename(src_file), {'pl' : plt})
File "plot_gradient_descent.py", line 175, in
hessian=counting_hessian)
File "plot_gradient_descent.py", line 65, in gradient_descent_adaptative
return gradient_descent(x0, f, f_prime, adaptative=True)
File "plot_gradient_descent.py", line 57, in gradient_descent
x_i += - step*dx_i
TypeError: bad operand type for unary -: 'NoneType'

The error is due to 'step' being None, which is returned from scipy.optimize.line_search when the procedure fails to converge.

Should we fix or drop the example? The initial comment says

A gradient descent algorithm

do not use: its a toy, use scipy's optimize.fmin_cg

Python 3 version

Very nice set of documents - thanks for this.

I am planning to teach with Python 3 - do you have any plans / suggestions for what do with Python 3 edits to these notes?

plot directive does not generate link to source code

As advertised on:

http://matplotlib.sourceforge.net/sampledoc/extensions.html

In the HTML version of the document, the plot includes links to the original source code, a high-resolution PNG and a PDF. In the PDF version of the document, the plot is included as a scalable PDF.

However when using this directive the links are not generated. Perhaps this is caused since we ship our own copy of the extension.

See also:

https://github.com/esc/scipy-lecture-notes

Consider moving section on help

The section on getting help seems a little out of place as 1.4 sandwiched between the numpy and matplotlib sections . I suggest to move it to the end of the introductory section.

Thoughts?

Finish up new numpy section

  • In operations.rst, around line 209: the "data statistics" example
    can probably be completely removed in my eyes (it is in the
    exercises.rst file).
  • I'd really like the random walk example back in. I use it to teach
    how a problem can be vectorized, rather than relying on for loops.
  • The transpose remark should be put back in. It is a very important
    remark, in my experience.
  • array_object.rst, line 767: I would keep the simple 'arange(10)'
    example, just for the sake of simplicity, unless I am missing the point.

intersphinx for numpy is broken

when doing :mod:numpy.linalg`` we don't get links into the numpy documentation. Not sure what is going wrong, because the intersphinx configuration looks fine.

Make tests pass on Python 3

We should enable testing on travis for Python 3 and then fix the resulting problems with tests.

Maybe after #176 is merged (ie: the corresponding test failures are fixed) and #141 is fixed.

Get the epub sphinx builder to work

Sphinx has an epub builder. It would be awesome to be able to provide good epub (eg for reading on the kindle). I suspect that there will be work making sure that everything renders well.

Swig bindings to C/C++/CUDA

Are you interested in a section about swig and the interoperability with C/C++ or even CUDA? I could write something about that, if you like.

Make doctest pass reliably

We need to move to more doctesting, which will force us to have more testable code.

Steps are

  • Run 'make test', fix the failing, skip the rest
  • Convert code snippets to use doctest-like syntax (eg those using IPython prompts or chunks of code without prompts
  • Fix the resulting problems by adding things like doctest ellipsis, normalise white-space or skipping the test

incompatabilities between 'intro numpy' and 'image processing'

Hi,

it seems like some of the commits for the 'intro numpy' break the 'image processing'.

Possible dangerous commits are:

I presume this was the reason why Emmanuelle had to revert them for the tuorial this morning?

https://github.com/emmanuelle/scipy-lecture-notes/compare/tutorial

The plot_directive and the pngmath settings (5a387d9) may also break other images/plots in other sections.

We should take a close look at this, perhaps when the conference is over, since it might be a bit tricky to solve.

Sympy section is outdated

The Sympy section is outdated, if you want to run the examples in the current version (0.7.5) some of them won't work.

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.