Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Introduction to Python for Science 2013.pdf
Скачиваний:
60
Добавлен:
21.05.2015
Размер:
2.41 Mб
Скачать

APPENDIX

C

PYTHON RESOURCES

This text provides an introduction to Python for science and engineering applications but is hardly exhaustive. There are many other resources that you will want to tap. Here I point out several that you may find useful.

C.1 Web resources

The best web resource for Python is a good search engine like Google. Nevertheless, I list a few web sites here that you might find useful. I have successfully resisted any attempt to be exhaustive so that the list is actually useful. Nevertheless, if you find a really cool site that you think should be on this list, please let me know.

http://www.python.org/ The official Python web site. I almost never look here.

http://docs.python.org/2/reference/ Sometimes I look here for detailed information about Python 2, which is the version used in this manual. Someday, when all the most useful packages are available for Python 3, we will switch to Python 3 and use http://docs.python.org/3/reference/ instead.

http://docs.scipy.org/doc/numpy/reference/ I usually start here when I need information about NumPy. It has links to just about all the NumPy documentation I need. By the way, I say “num-pee”, which rhymes with “bumpy”—a lot of people say “num-pie”, which doesn’t sound like English to me.

http://docs.scipy.org/doc/scipy/reference/ I start here when I need information about SciPy, its various packages and their functions. I say

193

Introduction to Python for Science, Release 0.9.23

“psy-pi” for SciPy, like everyone else. Who says I have to be consistent? (see Emerson)

http://matplotlib.org/api/pyplot_summary.html The Plotting Commands Summary page for MatPlotLib. It has a search feature and links to all the MatPlotLib documentation, which I use a lot. You can go the the main MatPlotLib page, http://matplotlib.org/, but frankly, it’s less useful. The site http://www.loria.fr/~rougier/teaching/matplotlib/ is also useful for learning some MatPlotLib tricks.

http://ipython.org/ I go to this page mostly to learn about IPython Notebook (http://ipython.org/notebook.html) but it’s also useful if you need information about the IPython interpreter, especially if you want to find out more about IPython magic commands.

http://www.enthought.com/ I get my latest version of Python and all the packages I need for scientific computing here. One stop shopping and everything is free for academic users. They offer three distributions: Express, Basic, and Professional. Express is free to all users and contains all the Python libraries, NumPy, MatPlotlib, SciPy, etc, that are described in this manual. Basic includes all the packages Enthought supports, which is likely to be everything you will ever need. Professional adds support services. Basic is free to academic users. One nice feature of Canopy is its package manager, which makes it child’s play to update or add Python packages. This is a very nice feature, especially for beginners. Canopy displaces the older Enthought EPD packages.

https://code.google.com/p/spyderlib/ Get the latest version of Spyder, the alternative IDE to Enthought’s Canopy. Sypder is completely open source and has a number of nice features, like introspection, not currently available in Canopy. Its package manager isn’t as nice as Canopy’s, but it’s pretty good. Spyder is very popular and can be installed easily on all platforms.

http://www.scipy.org/Mailing_Lists Go here if you want to sign up for a mailing list for NumPy or SciPy, or if you want to report a bug. Mailing lists give you access to a community of developers and users that can often provide expert help. Just remember to be polite and respectful of those helping you and also to those posting questions.

https://lists.sourceforge.net/lists/listinfo/matplotlib-users The

mailing

list for MatPlotLib. See paragraph immediately above.

 

194

Appendix C. Python Resources

Introduction to Python for Science, Release 0.9.23

C.2 Books

There are a lot of books on Python and there is no way I can provide reviews for all of them. I have found that the book by Mark Lutz, Learning Python, published by O’Reilly Media does the trick for most people. It doesn’t have anything special for scientific programming, and thus does not cover the NumPy, SciPy, or MatPlotLib packages, but for just about everything else, it’s an excellent resource. It gives a good introduction to object oriented programming, or OOP, which I say little about in this text. The 3rd edition of the book covers Python 2 while the 4th and 5th (current) editions cover Python 3. You are probably better off getting the latest edition as everybody will soon be using Python 3. If you are using Python 2, as we do in this text, you can easily enough figure out the differences between Python 3 and 2.

C.2. Books

195

Introduction to Python for Science, Release 0.9.23

196

Appendix C. Python Resources

array (NumPy), 29 printing, 61

assignment operator, 17

Canopy

Code Editor, 20 installing Python, 179 IPython pane, 6

tab completion, 20 window, 5

conditionals, 99

applied to arrays, 119 curve fitting, 140

linear, 130

exponential function, 141 power law function, 146 power-law function, 146 with weighting, 133

nonlinear, 146

dictionary, 29, 46

functions arguments

**kwargs, 122 *args, 122 keyword, 121 positional, 121

variable number, 122 fast array processing, 119

INDEX

looping over arrays, 117 NumPy, 16

positional arguments, 122 user defined, 115

input, 55 keyboard, 55

reading data from a file, 62 installing Python

Canopy, 179

Spyder, 179 IPython

Canopy IPython pane, 6 IPython Notebook, 181 magic commands, 8 magic functions, 7 navigation commands, 7 system shell commands, 9 tab completion, 9

list, 29, 30

list comprehension, 110, 148 logical operators, 104 loops, 105

for loops, 105 while loops, 107

magic functions IPython, 7

masked arrays, 85

197

Introduction to Python for Science, Release 0.9.23

MatPlotLib module, 14

MatPlotLib functions ayhline, axhline, 79 figure, 79

legend, 79 plot, 79 savefig, 79 show, 79 tight_layout, 90

xlabel, ylabel, 79 module

importing, 24 MatPlotLib, 14 NumPy, 14 SciPy, 14

NumPy array, 35

functions, 16 module, 14

output, 55 screen, 57

writing data to a file, 66

plots, 73 basic, 75

error bars, 81 interactive, 74

line and symbol specifiers, 80 log-log, 91

logarithmic axes, 89 masked arrays, 85 semi-log, 89

setting axis limits, 83 subplots, 87

programs, 20 Python

installing, 179 module, 14

reserved words, 19

roots of equations, see solving non-linear equations

SciPy

module, 14 scripts, 20

solving non-linear equations, 165 Bisection method, 169 Brent method, 166

Newton-Raphson method, 169 Ridder method, 169

systems of nonlinear equations, 169 Spyder

installing Python, 179 string, 29

strings, 30

tab completion Canopy, 20 IPython, 9

variable, 17 variable names, 19

random numbers, 48

198

Index

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]