Thursday, December 30, 2010

[QnA] GL/gl.h and GL/glu.h in Ubuntu 10.04

I have installed PyODE and tried some examples once when my system was Ubuntu 8.04. Today I think about the PyODE examples and want to study them again. Because my system is Ubuntu 10.04 now, I have to rebuild some necessary environment.

The most tedious step is to install the cgkit. It has to be installed from the source. During the installation, some more packages or libraries are necessary. Two of them are GL/gl.h and GL/glu.h. Out of my expectation, they have to be installed from different packages.

To have GL/gl.h:

$ sudo apt-get install mesa-common-dev 

To have GL/glu.h:

$ sudo apt-get install libglu1-mesa-dev

Wednesday, December 22, 2010

[DP] Window functions trial

I am studying the windowed-sinc filters and found SciPy has had a set of window functions to play around.

Below is my code to generate the plot of several window functions. Note that only 12 of them have been shown. There are four of them need more than one argument and I don't have time to figure out their parameters to get corresponding results.
from scipy import signal
from pylab import *


data_point = 500


windows =\
['boxcar'
, 'triang'
, 'parzen'
, 'bohman'
, 'blackman'
, 'blackmanharris'
, 'nuttall'
, 'flattop'
, 'bartlett'
, 'hann'
, 'barthann'
, 'hamming'
#, 'kaiser'
#, 'gaussian'
#, 'general_gaussian'
#, 'slepian'
]


t = [i for i in range(data_point)]
steps = 3


for i in range(0,len(windows),steps):
        for j in range(i,i+steps):
                w = eval('signal.'+windows[j])(data_point)
                subplot(2,2,1+i/steps)
                plot(t, w)
                axis([0,data_point,-0.2,1.2])
        legend((windows[i:i+steps]),loc='upper left')


show()

The result:

Basically, the window functions return an array which has the size as you assigned. An easy example is as the following:

>>> from scipy import signal
>>> signal.blackman(50)
array([ -1.38777878e-17,   1.48858213e-03,   6.05806481e-03,
         1.40095693e-02,   2.58120534e-02,   4.20553960e-02,
         6.33894512e-02,   9.04534244e-02,   1.23800653e-01,
         1.63824257e-01,   2.10689158e-01,   2.64275593e-01,
         3.24138580e-01,   3.89486780e-01,   4.59182958e-01,
         5.31766851e-01,   6.05499812e-01,   6.78429126e-01,
         7.48468603e-01,   8.13490971e-01,   8.71426720e-01,
         9.20363618e-01,   9.58640963e-01,   9.84932919e-01,
         9.98315897e-01,   9.98315897e-01,   9.84932919e-01,
         9.58640963e-01,   9.20363618e-01,   8.71426720e-01,
         8.13490971e-01,   7.48468603e-01,   6.78429126e-01,
         6.05499812e-01,   5.31766851e-01,   4.59182958e-01,
         3.89486780e-01,   3.24138580e-01,   2.64275593e-01,
         2.10689158e-01,   1.63824257e-01,   1.23800653e-01,
         9.04534244e-02,   6.33894512e-02,   4.20553960e-02,
         2.58120534e-02,   1.40095693e-02,   6.05806481e-03,
         1.48858213e-03,  -1.38777878e-17])

---
Ref:
  1. You can find the source code containing these window functions in the SciPy folder. Mine is located in /usr/lib/python2.6/dist-packages/scipy/signal/signaltools.py
  2. Documents can be found at http://docs.scipy.org/doc/scipy/reference/signal.html
  3. There is a good book about the signal processing for engineers by Steven W. Smith: The Scientist and Engineer's Guide to Digital Signal Processing. The windowed-sinc filters are introduced in Chapter 16.

[ML] Pretty good tutorial for MLE

What is Maximum Likelihood Estimation (MLE) exactly? This question has bothered me for a long time. When I was reading papers relevant to ICA, the term MLE appeared again. This time, fortunately, I found a really good tutorial in Wikipedia:


The first three parts introduce the most fundamental ideas about MLE, and I suggest you, who want to figure out what is MLE, to read these three parts.

In the next three parts, however, some terms and examples seem come from the biology or genetic aspect. If you get confused with the technical words used in ``twin data'', the ``twin study'' item given by Wikipedia might help you.

So far, I've had more clear idea about the difference between the probability and the likelihood estimation, which can be summarized as:
  • Probability
    • Knowing parameters: Prediction of outcome
  • Likelihood
    • Observation of data: Estimation of parameters
There still are some concepts I have not quite known yet, such as the ideas presented in the section of ``Likelihood ratio test.''

Wednesday, December 15, 2010

[SW] Installation of the LaTeX formula extension in Inkscape 4.07

First, the ``Effects'' item has been renamed as ``Extensions'' in Inkscape 4.07.

Then what you need are:

To install the textext package, just copy the textext.py and textext.inx files to the folder:
~/.config/inkscape/extensions/

Finally, restart your Inkscape and try it. Note the LaTeX formula might appear in some place beyond your working window, so make sure to zoom out your working area and look around for your formula.

Monday, December 13, 2010

[QnA] eth0 disappeared...

I have no idea why this could happened, yet. My Toshiba laptop lost its eth0 again, and this time I was very sure that the driver had been installed properly.

Again, I found the following posts which solved my problem:
http://ubuntuforums.org/showthread.php?t=1459907

Just edit ``/etc/NetworkManager/nm-system-settings.conf'' and let ``managed=true'':