Feeds:
Posts
Comments

Archive for June, 2010

Python: plotting examples

In this post, I discuss one easy plot in Python (using Matplotlib).

To plot the function y=exp(x) in the range [0., 1.], one can do the following:

>>> from pylab import *
>>> a = arange(0,1,.02)
>>> b = exp(a)
>>> plot(a,b,'r-')   # 'r' means with red color and '-' means with dashed line style

It is ready at this point, but we would like to add error bars:

>>> e = 0.2*abs(randn(len(b)))       # prepare errorbar from random numbers
>>> errorbar(a, b, e, fmt='o', label='y=exp(x)')             # vertical symmetric

Now, we plan to add a legend and axes labels:

>>> legend()                 # the label command in errorbar contains the legend

>>> xlabel('x')  
>>> xlabel('y')  

>>> show()

The following plot will appear on your screen:

Simple plot with error bar and legend


You can save image in a few formats like PNG, EPS, etc using a save button in the image box.

In a following post, I will show how to create a map and overlay contour of another map on it.

Read Full Post »

data of last year

“… data of last year, and the S/N is crap, or better in capital letters, CRAP….”  a desperate observer

Read Full Post »

upgrading to Squeeze

Today, I upgraded my Debian Lenny (on MacBook pro) to Squeeze. As I explained the squeeze repository in an earlier post, I updated

/etc/apt/source.list file.

Then, I performed

# apt-get update

# apt-get dist-upgrade

It took some 12 minutes to download more than 2200 new packages. Then, it took about 80 minutes to run the upgrade. In-between, there have been a bunch of messages about keeping configure files, etc. At one point, it crashed, complaining about a few packages like mayav, and matplotlib. I removed those packages and run dist-upgrade again. When it was finished, I restarted the machine. No graphics 😦

I went to a root terminal and realized that xserver-xorg does not exist ! I then installed this package and reboot the machine (I have a nvidia graphics card).  That was it !  Finally, I deleted a lot of KDE 3.5 packages from synaptic package manager.

Welcome to Debian Squeeze and KDE 4.4 !!

In the first try, it asked how to transfer personal data from KDE 3.5 to KDE 4.4, and it worked rather well (e.g., password manager). After that, I installed Matplotlib, and got a few python programs running to make sure that everything works fine.

I have everything working: sound, video, wireless, flash video, … (as far as I have tried so far). For packages like Skype which there is no Squeeze repository, I kept the Lenny package, and it is working.

Read Full Post »

Debian Squeeze repository

deb http://ftp.debian.org/debian/ squeeze main non-free contrib
deb-src http://ftp.debian.org/debian/ squeeze main non-free contrib

deb http://security.debian.org/debian-security squeeze/updates main

deb http://security.debian.org/ squeeze/updates main non-free contrib
deb-src http://security.debian.org/ squeeze/updates main non-free contrib

# Adobe Reader, MPlayer, etc.
deb http://www.debian-multimedia.org squeeze main

# skype has no squeeze repository yet
deb http://download.skype.com/linux/repos/debian/ lenny non-free

deb http://www.lamaresh.net/apt squeeze main

Read Full Post »

Perseids-2007

The Perseids 2007 activity is the topic of this post.


As seen in the above plot, the early peak that was observed in 88-99 and also in 2004 is not seen here. The activity level is modetare and resembles a normal Perseids meteor shower. A peak ZHR of about 90 is similar to 2005 activity level.

Read Full Post »

meaning of Holiday

HOLIDAYS, i.e. days where you DO NOT work 🙂

or

It means Holly Days, so it is holly !

but

for me, it means the days shops are closed !

Read Full Post »

How to update Twitter from the Linux command line:

1. Install curl with this command (Debian):

#apt-get install curl

or for Ubuntu:

$sudo apt-get install curl

2. Create a new file named ‘twitter’ at ‘/usr/bin’ with your favorite text editor:

#touch /usr/bin/twitter

Then, paste this code in the file:

curl –basic –user “yourusername:yourpasswd” –data-ascii “status=`echo $@|tr ‘ ‘ ‘+’`” “http://twitter.com/statuses/update.json” -o /dev/null; echo Message Sent!

Make sure you replace “yourusername” and “yourpasswd” with your own Twitter username and password. Save and Exit.

3. Make it executable:

# chmod +x /usr/bin/twitter

4. Start tweeting using the command line by typing ‘twitter’ [space] [your message]:

$ twitter hello

Read Full Post »

Older Posts »