Feeds:
Posts
Comments

Archive for February, 2010

KOrganizer

KOrganizer is the calendar and scheduling component of Kontact, the integrated personal information manager from KDE.

Part of KOrganizer panel on my Debian/Lenny desktop.

You can easily put all your TO Do stuff there, adjust reminder notes, and have a measure of progress. Any time you plan to add a new subject, you face a wizard like this:

"TO Do" wizard

You can mark all your appointments, birthdays, etc.

Advertisements

Read Full Post »

Universal constants

Electromagnetic constants

Atomic and nuclear constants

Physical/chemical constants

Astrophysical constants

An extensive list

These PDF files are based on the  physical constant at the NIST webpage:

http://physics.nist.gov/cuu/Constants/index.html

Another way is to use the Astroconst,  a package of header files for a variety of languages that defines a plethora of astrophysical constants. The different language files are all generated from one central data file, so it is easy to add new constants.

For all information and downloads, please see:
http://clavelina.as.arizona.edu/astroconst/

or

http://ostatic.com/astroconst

Read Full Post »

Executable Python scripts

On Linux systems, you can execute Python scripts directly. Just put that in the first line of your script :

#!/usr/bin/env python

The ‘#!’ must be the first two characters of the file.
Make the file executable with

$ chmod +x program.py

and you can execute it with

$ ./program.py

Read Full Post »

Python: general examples

You can start using Python either in its shell script or by running codes. Note that like C++, you have to include the libraries you need in each code at the first few lines.

Simple unix commands within python:

import shutil #a python built-in utility to copy files and directory trees
shutil.copy2(‘file1.fits’,’file2.fits’) # equal to “cp -p source destination”

from unix import *
ls # or ll, pwd, cd, less, cat, edit…

Get system time:
import time
time.localtime()

(2008, 11, 6, 21, 58, 18, 3, 311, 0)          # year, month, day, hour, minute, second, day in week, day in year, …
time.time()
1226005588.412873                               # return the time as a floating point number expressed in seconds

to simply measure the execution time:

import time
t1 = time.time()
………..                                                      # program body
elapsed = time.time() – t1

or having a pause (wait):
time.sleep(x) # x is waiting time in seconds

to run a bash script within python, e.g., making a movie
out of a set of images,

import os, sys
os.system(“mencoder ‘mf://img*.png’ -mf type=png:fps=10 \\
-ovc lavc -lavcopts vcodec=wmv2 -oac copy -o animation.mpg”)

Note: in the above example, you see that  using “\\”, you can break long lines.

os.system execute the command (a string) in a subshell

to access help for each command:

help(numpy)                             # help on the whole package

help(scipy.linalg) # help on the specified  package

conversion between string and float data types:

a = 2.50000074675 # float to string
print str(a)
2.50000074675

b = ‘ -2.60300 ‘ # string to float
print float(b)
-2.603

In future posts, I put examples of plots and numeric programs.

Read Full Post »

Compaire two files or directories

Diff command will examine both file1 and file2 and tells you what changes need to be made for file1 and file2 to match.

$diff   file1.txt   file2.txt

Alternatively, you can have side-by-side merge of file differences
You can get a clear-cut visual difference between two text files using the command sdiff:

$ sdiff   file1.txt   file2.txt

These commands can be used for comparing directories as well.

Read Full Post »