14 November 2009

Python For Scientists and Engineers: Recent Class

Steve and I took a three day class that ended up being a survey of what is available for scientists and engineers using Python. The instructor did point out a good number sites to look at for scientific software bundles in Python.

One the most interesting sites pointed to was Python(x,y) which has bundled a number of tools (mostly python) into one package that was right up our alley on the MCATK project we are working. Python(x,y) is free and all the packages bundled under it are free-ware.

Python(x,y) has downloads for two platforms so far. Windows and Ubuntu. I have downloaded the Windows version (full setup) onto two different machines and it has installed perfectly and easily.

Python(x,y) provides a small window with menus and buttons that serve up the various packages it offers. Some of the packages Eclipse, Qt, MayaVi, SciTE, IDLE, gnuplot, Python, and IPython. There are Python modules for numpy, scipy, numexpr, sympy, matplotlib, pylab, and VTK to name a few. There is easy access to documentation for all of these packages and more.

You can easily launch Eclipse from the Python(x,y) window and turn around and launch the IPython command line window too. Also in the bundle is the Spyder the interactive software development environment.

For us one nice thing is that Eclipse already has plug-ins for CDT(C++), Python, and PyDev (unit tester). This way since we already do development with Eclipse and C++ then we can now easily do any Python work within the same IDE with unit testing. Unfortunately it is only available for Windows and Ubuntu at this time.

Also downloaded is the Photran plugin for Fortran development under Eclipse. Not that we need that.

Another site pointed out to us was EnThought which has some prebundled Python tools. The bundles are not free but all the packages under them are free. So you could download them yourself if you did not want to pay. The site is a great resource for scientific computing.

All in all it seems that Python would be fine choice for many scientific computation needs. Less so for the HPC we are doing at LANL but it certainly come in handy as another tool in our toolbox. One suggested use of Python and all the available tools was as a replacement for MatLab since all the Python tools are free. Definitely a possibility especially for students.

Recently, Neopythonic (Guido van Rossum) has an interesting post about Python in the Scientific World. Check it out.

18 October 2009

Wolfram Demonstrations Project

Mathematica is a very useful and powerful tool for learning, teaching, and doing simulations. Recently, I ran across a Project page which has demonstration topics in almost every field. Very cool stuff. The demos themselves can be used as templates to create your own demonstrations.

Wigner Function of Two-Dimensional Isotropic Harmonic Oscillator

"Wigner Function of Two-Dimensional Isotropic Harmonic Oscillator" from the Wolfram Demonstrations Project


There is some really cool stuff ... check it out.

Wolfram Demonstrations Project

03 October 2009

Favorite Scientific Biography: Rabi

Back in around 1988, when I started graduate school, I decided to subscribe to a weekly science news magazine which I have now forgotten its name. Inside each issue was an advertisement to join a science book club that I could not resist. Upon joining this book club you get a complimentary book.

One day in the mail I received a biography about Isidor Rabi called Rabi: Scientist and Citizen by John Rigden as my complimentary book. I had no idea who Rabi was and was not really interested in the book. So it sat on my shelf for several years then one day I decided to read the book.

It has ever since been my favorite biography about a scientist and has not been displaced after all these years.

Some highlights of I.I. Rabi incredible life and influential work:
There was so much more to Rabi than I have listed here. I highly recommend this biography that is hard to put down once you get started.


Rabi, Scientist and Citizen (Google Books)

20 September 2009

Simulation Models

In scientific computing, we often are looking to model physical processes through computer simulation. Though generally computational scientists (physical scientists that is) are performing this work, often this simulation and modelling is not done in a very systematic or scientific way. This has been an issue for computational science since the inception of the computer.

This challenge was recognized many decades ago and was the driving force in John Pople's computational quantum chemistry research. Though Pople's chosen field was quantum chemistry, we would do well to learn from his approach to modelling for our chosen fields of research and study.


Here in general terms and for an outline of development and use of a model (from Pople.)

A theoretical model for any complex process is an approximate but well-defined mathematical procedure of simulation.

......

Five stages may be distinguished in the development and use of such a model:

1) Target
2) Formulation
3) Implementation
4) Verification
5) Prediction



Now an explanations of these stages from Pople's quantum chemical models:

1) Target
A target accuracy must be selected. A model is not likely to be of much value unless it is able to provide clear distinction between possible different modes of molecular behavior. As the model becomes quantitative, the target should be that data is reproduced and predicted within experimental accuracy. For energies, such as heat of formation or ionization potentials, a global accuracy of 1 kcal/mole would be appropriate.

2) Formulation
The approximate mathematical procedure must be precisely formulated. This should be general and continuous as far as possible. Thus, particular procedures for particular molecules or particular symmetries should be avoided. If this can be done, the procedure becomes a full theoretical model chemistry, which can be explored in detail as far a available resources permit.

3) Implementation
The formulated method has to be implemented in a form which permits its application in reasonable times and at reasonable cost. In recent times, this stage involves the development of efficient and easily used computer programs. It is closely comparable to the stage of building equipment in an experimental investigation.

4) Verification
The next step is to test the model against known chemical facts to determine whether the target has been achieved. If quantitative accuracy is being sought, this can be done by various statistical criteria such as the root-mean-square difference between the results of the theoretical model and experimental data. In selecting such a dataset, it is important to make it as broad as possible, while limiting it to experimental facts known to be of high quality. If the results of such a comparison do meet the target requirements, the model may be said to
be validated.

5) Prediction
Finally, if the model has been properly validated according to some such criterion, it may be applied to chemical problems to which the answer is unknown or in dispute. If the experimental dataset is sufficiently broad, there is a reasonable expectation that the results will be accurate to something like the target accuracy. This stage, of course, is the one of
most interest to the larger chemical community.

From - Nobel Lecture: Quantum chemical models by John A. Pople.
Reviews of Modern Physics, Vol. 71, No. 5, October 1999, page 1287.


As a computational scientist, all the stages should be of interest. As a scientific software developer then stages 3 and 4 are of the most interest though often all stages cross our path. Particularly stage 3 where often we as scientists are building our experimental apparatus (computer software) for the experiment ( computer simulation.) Interestingly enough as scientists we often do not build our software to the same standards we build our experimental equipment. Why? I am still trying to formulate the reasons we often seem to lose our scientific training when it comes to scientific software and computation.