Archive for the ‘Notes’ Category.

Install Python modules as non-root user on HPC cluster

The key steps

1. Create a folder named “~/python-packages”, then create a path “~/python-packages/lib/python2.6/site-packages/” with

1
mkdir -p python-packages/lib/python2.6/site-packages/

The above path containing the version number of Python should be adjust accordingly base on the actual Python version you are using.
This step sets up a directory structure that is needed by python modules.

Continue reading ‘Install Python modules as non-root user on HPC cluster’ »

Python initial script for Qtiplot

OK, even after reading the handbook a few times, it is not very clear which python file is the initial script for Qtiplot. It is important to know if you want to extend Qtiplot with python. After checking all the default python files in the Qtiplot installation path, I found qtiplotrc.py should be the one, although a smarter guy would have realized this from its name. You could import your own Python module in this startup file and enjoy them right after entering Qtiplot.

Animation with matplotlib

A demo program showing the way to make animation with matplotlib.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# A demo for animation with matplotlib
# Written by Ting Li (Dr.Ting.Li at gmail.com)
# 2010-09-10
# Ref: http://www.scipy.org/Cookbook/Matplotlib/Animations
import numpy as np
import time
import matplotlib
matplotlib.use('WXAgg') #before import pylab, choose the GUI backend
#It can also be done while calling this script from command line:
#>>> python animation.py -dWXAgg
#Other backends are: valid strings are ['ps', 'Qt4Agg', 'GTK', 'GTKAgg', 'svg',
# 'agg', 'cairo', 'MacOSX', 'GTKCairo', 'WXAgg', 'TkAgg', 'QtAgg', 'FltkAgg',
# 'pdf', 'CocoaAgg', 'emf', 'gdk', 'template', 'WX']
from pylab import *

 <a href="http://9rivers.linkka.com/2010/09/11/animation-with-matplotlib/#more-561" class="more-link"><small>Continue reading &#8216;Animation with matplotlib&#8217; &raquo;</small></a>

A Zotero style for ACS references with titles

Zotero, the must-have reference manager for scientists, supports various bibliography styles. This is benefited from the CSL (citation style language), which is an open XML standard for citations and bibliographies. Since Zotero is implemented as a Firefox addon, it naturally supports search and grab references from the internet, which is very convenient and better than some other stand-alone reference managers.

Continue reading ‘A Zotero style for ACS references with titles’ »

Keyboard shortcut to insert euqations

I didn’t know this before I saw this post. The shortcut is ‘Alt+=’. That’s simple!

Hide the command console window while running a GUI/Command line program on Windows

While running a command line program or some GUI initiated from command line on Windows, there is always a black console window on the screen. This sometime becomes annoying. For example, when you start the Eric Python IDE on Windows, normally you start it by calling a batch file “eric4.bat” which calls the actual eric4.py script sequentially. Since Eric4 is designed to be a GUI program, the black console window has no use but it is there. To prevent that or hide it, there are several ways. Continue reading ‘Hide the command console window while running a GUI/Command line program on Windows’ »

A bash script to plot multiple files in old version of gnuplot

For gnuplot version older than 4.4, ‘plot for’ is not an option to plot multiple files. In order to make it work and easier, I wrote a BASH script to generate the gnuplot input for multiple file plotting. You are lucky too find this if you are still using old version of gnuplot. No need to use it for the lastest version.

Continue reading ‘A bash script to plot multiple files in old version of gnuplot’ »

van der Waals

Internal overflow compressing coordinates

I occasionally got this error while running some mpi programs. I could not find the exact reason. Even when I google it, it seems no relevant explanation of it. By investigating the codes with debugger, I notices some data in the memory are huge, when I correct them, the error information was gone too. Therefore I guess this error is related to the expression of illegal numbers. However, I would like to know more about it if someone can point out the exact reason.

Mount Windows shared folders automatically with fstab

According to the article “Mounting smbfs Shares Permanently Help File” published on JustLinux by Ray Cowan, we could mount a Windows shared folder automatically using /etc/fstab. There are many discussions about how to do this on the internet. E.g. some people suggest using ~/.bashrc or ~/.bash_profile to fulfill this. But there are not the right solution. Because the mounting should only be done once not more. The essential thing in Ray’s article is one can use options of smbmount command in fstab. The working format looks like

Continue reading ‘Mount Windows shared folders automatically with fstab’ »