Sep 14, 2013

Difference Between Update and Upgrade in Ubuntu

Update :
Updates the list of available packages and their versions, but it does not install or upgrade any packages.
apt-get update


Upgrade :
Installs newer versions of the packages based on the updated list of available packages.
apt-get upgrade

After updating the lists, the package manager would know about available updates for the software already installed in a computer. This is why running update prior to upgrade is recommended.

Sep 9, 2013

Python for Scientific Computing


The persuasion of a masters degree has for the last two years has exposed me to scientific computing on a regular basis. In light of that experience, scientific computing demands a distinct way of information representation, interpretation and processing. While general purpose programming languages and platforms are capable of getting the job done, a specialized scientific computing platform allows the scientist to be the scientist more often than being the programmer.

There are several scientific computing platforms.  MATLAB is perhaps the most widely known proprietary option. There are a few open source alternatives too, R is one example. My favorite used to be MATLAB. That changed about two years ago when I started working in Python.

In my experience the following list of Python packages and modules comprise of a satisfying scientific computing environment. The libraries are listed bellow:

Core Python Packages/Modules: 

sys

For passing command line arguments to your python script

time

For timestamping or for benchmarking

string

Read and write text in different formats including parsing

math

A very handy library for, obviously, mathematical operations. This library has several built in statistical functions too.

random

Allows creating of randomized samples from various probability distribution functions.

Third Party Packages/Modules

 

SciPy

A Python based ecosystem of open-source software for mathematics, science, and engineering.

NumPy

The fundamental package for scientific computing with Python. Linear algebra, N dimensional array etc. Member of the SciPy ecosystem.

Matplotlib

A library for producing publication quality 2D charts in Python. Can be integrated with GUI libraries like PyQt.

PyQt

Python bindings for a cross platform open source GUI toolkit called Qt. It comes with a standard set of widgets as well as the option of making custom ones. Meets the need for smart clean GUI for Scientific computing. PyQt has a good chance of becoming one of the leading GUI library for scientific and advanced computing. This video shows an impressive GUI for particle system in Maya.



PyQt GUI for Maya from Tim Withers on Vimeo.

Sep 4, 2013

Saving images of plots made in Matplotlib

Matplotlib, a versatile python library for 2D plotting, allows saving images in several bitmap formats as well as vector formats like SVG.To save an image, one has to specify output format first. Then simply calling a save image function gets the job done. The following example saves an image in SVG format, then in PNG.
from matplotlib import pyplot as plt #code for drawing the plot goes here plt.savefig("output.svg") plt.savefig("output.png")
As you can see, the library figures out the format of output from the extension of the output file name.