• Share
  • Email
  • Embed
  • Like
  • Save
  • Private Content
The Joy of SciPy, Part I
 

The Joy of SciPy, Part I

on

  • 831 views

 

Statistics

Views

Total Views
831
Views on SlideShare
812
Embed Views
19

Actions

Likes
2
Downloads
17
Comments
0

1 Embed 19

http://lanyrd.com 19

Accessibility

Categories

Upload Details

Uploaded via as Adobe PDF

Usage Rights

© All Rights Reserved

Report content

Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
  • Full Name Full Name Comment goes here.
    Are you sure you want to
    Your message goes here
    Processing…
Post Comment
Edit your comment

    The Joy of SciPy, Part I The Joy of SciPy, Part I Presentation Transcript

    • The Joy of SciPy Part I, Dinu GhermanPart II, Dave Kammeyer (not included here) Python Users Berlin Meet-up, 2013-02-14
    • About…Science… Visualisation Analytics Numbers Data Math Big Data Algorithms Machine Learning … and Python
    • Science, a Reminder Domains Math Education VisualisationData Models Publication Theory Experiments
    • From Scientific Python “Components”…Nat. Language Toolkit MatplotlibMol. Modelling Toolkit SymPy Chaco PILBioPython.org NumPy Veusz OpenCVPsychoPy.org Blaze … Scikit-imageAstroPython.org Scikit-learn Stackless Pandas … PyPy PyTables Cython Disco Sphinx Numba ReST (sample) Theano ………
    • … to IntegratedScientific EnvironmentsLegacy: Py-Distributions: Py-Environments:Mathematica ScientificPython IPython.orgMatlab Enthought, EPD SciPy.orgMaple Anaconda Sagemath.orgMagma Python(x, y) Wakari.io Mathics.org Orange
    • IPython Shell• Extended Inter- active Python shell • Extensions • Help• Tab completion • History• Multi-line editing • Debugger• Shell access • Bookmarks• Magic functions • DEMO…
    • IPython Notebook• IPython shell in the browser• Markdown text + executable Python code• JSON container, including output• Literate Programming – finally• Great tutorial experience• Easy to share running code – w/o hassle
    • IPython Notebook Demo• Tour of the IPython notebook (built-in)• Installing a custom extension• Combined later with Matplotlib demo
    • IPython Extension Demo • Show object graphs • Reuse a previously written package • Run interactively in the notebook • Notebook: http://nbviewer.ipython.org/4770302/ • Code: https://gist.github.com/deeplook/4731035
    • Matplotlib• Scientific plots• 2D, 3D, interactive• Smart axes, grids• Beautiful math (TeX)• Widgets, annotations, …• http://matplotlib.org/gallery.html
    • Matplotlib Demo• Simple plots• Bézier path editor• Magic cube
    • Conferences• http://conference.scipy.org• https://www.euroscipy.org• http://pydata.org †Videos (e.g. by John Hunter , Fernando Pérez et al.):http://pyvideo.org/category/17/pycon-us-2012
    • Selected Books
    • What to take away• Use available Python tools for your scientific domain (trivia)!• Use IPython shell & notebook, Matplotlib – far too powerful to leave to scientists! ;-)• Have fun with science – seriously! http://io9.com/5973726/15+year-old-whiz-kid-has- research-on-dwarf-galaxies-published-in-nature
    • Questions? Exercise?
    • ExerciseRun the algorithm below using CPython, Cython, PyPy and Numba andcompare their performance. This is implementing a spigot algorithmby A. Sale, D. Saada, S. Rabinowitz, as mentioned onhttp://mail.python.org/pipermail/edu-sig/2012-December/010721.html.Code: https://gist.github.com/deeplook/4947835.def pi_digits(n): "Generate n digits of Pi." k, a, b, a1, b1 = 2, 4, 1, 12, 4 while n > 0: p, q, k = k * k, 2 * k + 1, k + 1 a, b, a1, b1 = a1, b1, p * a + q * a1, p * b + q * b1 d, d1 = a / b, a1 / b1 while d == d1 and n > 0: yield int(d) n -= 1 a, a1 = 10 * (a % b), 10 * (a1 % b1) d, d1 = a / b, a1 / b1>>> list(pi_digits(20))[3, 1, 4, 1, 5, 9, 2, 6, 5, 3, 5, 8, 9, 7, 9, 3, 2, 3, 8, 4]