10 von 12 Kunden fanden die folgende Rezension hilfreich
Von
cbrunet
- Veröffentlicht auf Amazon.com

Format: Taschenbuch

I'm a PhD student whose has been using Python, NumPy, and related software for two years. This is why I was excited reading a book about NumPy, wondering what I could learn from it. When I opened the book and read the Table of Contents, I realized that the book was covering far mush than only NumPy library. As a matter of fact, it talks about many other pieces of software gravitating around it. Another thing I realized is that, as the title states, it's a Cookbook. This book teaches NumPy by examples. Those examples, like recipes in a cookbook, are there to teach you different aspects of NumPy. They are short, but not necessarily simple, meaning you have to think about them to well understand how they work. It assumes you already know Python, and have some basis on scientific computing.

Chapter 1 is about IPython, an alternative Python shell, well suited for scientific use. I think they begin talking about this to give you a tool you can use to experiment with NumPy et al. It doens't give mush about it, but just enough to give an insight of how powerful it is. This chapter also talk about installation of not only IPython, but also other libraries like Matplotlib and Sympy. However, I think it is a bad idea talking about software installation in a book, since it is version and platform dependant. The strangest thing is that nowhere in the book it talks about installing NumPy itself!

Chapter 2 is about array indexing, which is the core of NumPy functionality. But again, it begins by explaining how to install other related software like SciPy and PIL. After that, a serie of examples are given, to illustrate different aspects of array indexing with NumPy. What is interesting is the variety of the examples: image manipulation, Sudoku puzzle, sound manipulation... There are recipes for every tastes! However, I think a little general introduction about how array indexing works in NumPy is missing there. Without my knowledge of NumPy, I think it would be difficult for me to well understand the examples.

Chapter 3 gives recipes using commonly used NumPy functions. To do it, a variety of mathematical problems are exposed and solved. For each problem, a Wikipedia link is given to allow the reader to familiarize itself with the problem and the algorithm used to solve it. I found this chapter very interesting. I even learned about an obscure undocumented Matplotlib module used to query an plot financial data on Yahoo finance.

Chapter 4 talks about how to interconnect NumPy with other pieces of software. It first talks about buffer and array interfaces that allow to exchange NumPy arrays with other Python libraries without needing to copy the data. Then it shows how to exchange data with other software like Matlab and Octave, R, and Java. Finally, it gives an insight of how to use NumPy in the cloud, using either Google App Engine, Python Anywhere, or PiCloud.

Chapter 5 is dedicated to audio and image processing. The use of images and sounds is interesting because we can see (or hear) the result of our manipulations. The recipes also are closer to real world problems. Here, we combine images, we repeat sounds, and we apply different kinds of filters. As a bonus, we generate the Mandelbrot set!

Chapter 6 is about special arrays and universal functions. I must admit I learned a lot of new things on NumPy reading this chapter. As always, it doesn't study all the possibilities in depth, but gives a good introduction to understand how it works.

Chapter 7 is about profiling and debugging. Those are two very important tasks when developing scientific software. I like the fact it covers many tools used to profile and debug NumPy code. I wasn't aware of some of those tools.

Chapter 8 is about quality assurance (QA). It talks about software and libraries to perform code coverage, unit tests, mocking, etc. Chapter 7 and 8 (and chapter 1) are different from the rest of the book, in the sense they talk about tools instead of giving coding recipes. However, I think this is a good thing, as those are important concepts to master while developing scientific applications.

Chapter 9 is about Cython, a tool allowing to speed up Python by converting it to C code and compiling it. Personally, I use it a lot, because it allows me to optimize critical parts of my code using C language, while performing the rest of the tasks using Python. I must admin I was a little disappointed by the given recipes. It begins with a hello world program, which in in my sense very common an unnecessary. Afterwhat it briefly presents how to optimize Python code and how to call C code using Cython. However, it doesn't mention how to use the buffer interface (which we already saw in chapter 4) to exchange NumPy arrays between C programs and Python without copying data, which is critical to get performance.

Finally, chapter 10 is about Scikits, which are independent projects somehow related to NumPy. Functions presented there covers machine learning, statistical modelling, image processing, and data analysis.

Overall, I liked this book. I think it is well organized and well presented. I appreciated the fact it gives examples taken from a lot of different fields of interest: images, sounds, math, finance... Many recipes are good starting points for solving projecteuler problems. On the other side, I think too mush focus is given to software installation. Some recipes could be simplified to use less dependencies while remaining instructive. There are also some recipes that could gain from having more explanations. Finally, I was surprised not to see any references to Python(x,y) project, which is a good alternative to EDP on Windows.

I would recommend this book to a programmer who knows Python and want to learn about possibilities it offers for scientific programming, or to a programmer already knowing NumPy a little bit, but wanting to get a deeper knowledge of it.

Charles.