Posts Tagged ‘Code’

Hello everyone,

Before I install packages, I’d like to check their status using aptitude,

$ aptitude search gimp
p   extremetuxracer-gimp-dev        - plugins for GIMP for easy development of e
i   gimp                            - The GNU Image Manipulation Program        
p   gimp-cbmplugs                   - plugins for The GIMP to import/export Comm
i A gimp-data                       - Data files for GIMP                       
i   gimp-data-extras                - An extra set of brushes, palettes, and gra
p   gimp-dbg                        - Debugging symbols for GIMP                
p   gimp-dcraw                      - GIMP plug-in for loading RAW digital photo
p   gimp-dds                        - DDS (DirectDraw Surface) plugin for GIMP  
p   gimp-dimage-color               - GIMP plugin to convert Minolta DiMAGE pict
p   gimp-flegita                    - Scanner plugin for the GNU image manipulat
p   gimp-gap                        - animation package for the GIMP            
p   gimp-gluas                      - Lua environment plug-in for GIMP          
i A gimp-gmic                       - GREYC's Magic for Image Computing - GIMP P
p   gimp-gutenprint                 - print plugin for the GIMP                 
v   gimp-help                       -                                           
p   gimp-help-common                - Data files for the GIMP documentation     
p   gimp-help-de                    - Documentation for the GIMP (German)       
p   gimp-help-en                    - Documentation for the GIMP (English)      
p   gimp-help-es                    - Documentation for the GIMP (Spanish)      
p   gimp-help-fr                    - Documentation for the GIMP (French)       
p   gimp-help-it                    - Documentation for the GIMP (Italian)      
p   gimp-help-ko                    - Documentation for the GIMP (Korean)       
p   gimp-help-nl                    - Documentation for the GIMP (Dutch)        
p   gimp-help-nn                    - Documentation for the GIMP (Norwegian)    
p   gimp-help-pl                    - Documentation for the GIMP (Polish)       
p   gimp-help-ru                    - Documentation for the GIMP (Russian)      
p   gimp-help-sv                    - Documentation for the GIMP (Swedish)      
v   gimp-helpbrowser                -                                           
p   gimp-lensfun                    - Gimp plugin to correct lens distortion usi
i   gimp-plugin-registry            - repository of optional extensions for GIMP
v   gimp-python                     -                                           
p   gimp-resynthesizer              - Transitional package for gimp-plugin-regis
v   gimp-save-for-web               -                                           
p   gimp-texturize                  - generates large textures from a small samp
p   gimp-ufraw                      - gimp importer for raw camera images       
p   gtkam-gimp                      - gtkam gimp plugin to open digital camera p
i A libgimp2.0                      - Libraries for the GNU Image Manipulation P
p   libgimp2.0-dev                  - Headers and other files for compiling plug
p   libgimp2.0-doc                  - Developers' Documentation for the GIMP lib
p   libgimpactutils2.81             - professional 3D Game Multiphysics Library 
p   planetpenguin-racer-gimp-dev    - Dummy transition package for extremetuxrac

I won’t lie to you… from the very beginning I knew that the i at the first column meant installed… but What about the other keys?

I found the answer by looking at the documentation, using

$ man aptitude

Here’s is the thing:

Each search result is listed on a separate line. The first character of each line indicates the current state of the package: the most common states are p, meaning that no trace of the package exists on the system, c, meaning that the package was deleted but its configuration files remain on the system, i, meaning that the package is installed, and v, meaning that the package is virtual. The second character indicates the stored action (if any; otherwise a blank space is displayed) to be performed on the package, with the most common actions being i, meaning that the package will be installed, d, meaning that the package will be deleted, and p, meaning that the package and its configuration files will be removed. If the third character is A, the package was automatically installed.

Great!!! Isn’t it?


Read Full Post »

I’m installing SAGE1 v.5.12 on my laptop which runs Debian. Here I describe the procedure.

  1. Since there is no Debian binary package, you should download the source code. Here the link.
  2. When it finishes, open a terminal C-M-t (sorry for the emacs notation, it means Ctrl+Alt+t)
    • Go to the Downloads folder (or the right place where the tar file was saved)
    $ cd ~/Downloads
    • Untar the file
    $ tar xvf sage-5.12.tar
    • Move to the sage-5.12 folder just created
    cd sage-5.12/
  3. Install the dependencies of the first line. Optionally install LaTeX and ImageMagick using the second line. (NOTE: superuser power is needed to run the below code)
    $ sudo apt-get install -y gcc perl m4 dpkg-dev 
    $ sudo apt-get install -y texlive imagemagick
  4. In machines with more than one core, the instruction to perform parallel compilation is (yo should change the “4” by the amount of cores in your machine)
    $ export MAKE="make -j4"
  5. Now is time to compile the code.For a local compilation, run

    For a
    You can relax, go and have a coffee, because the compilation may longs one hour (or more depending of the machine specifications).

  6. For running the software after the installation is complete, run (on the SAGE directory) the command
    $ ./sage
    • I don’t like to move to the SAGE directory every time and then run the ./sage command, therefore, I tend to create an alias on my ~/.bash_aliases file,
      $ echo "alias sage="sh ~/Downloads/sage-5.12/sage" >> ~/.bash_aliases

      This command adds the line alias sage="sh ~/Downloads/sage-5.12/sage at the end of the file ~/.bash_aliases, you can do it by hand with your favourite editor (gedit, emacs, nano, vim, …)

    • If you refresh your terminal (or open a new one) you just have to run the command sage to start SAGE. Additionally, the notebook environment can be started directly from the terminal by using the flag -n,
      $ sage -n

Hope you find this post useful! Remember to leave your comments or suggestions.



1SAGE is an open source mathematical software which allows numerical and symbolic manipulations

Read Full Post »

In order to install CalcHEP, one needs to download the code and to compile it.

The code can be found at http://theory.sinp.msu.ru/~pukhov/calchep.html, as usual it is recommended to download the current version, unless a major pre-requisite problem is in sight.


It is useful to install some packages before start compiling CalcHEP

 $ sudo apt-get install cernlib gfortran xlibx11-dev

Then, go to the folder where CalcHEP was downloaded and decompress it,

 $ tar -xzf calchep_3.4.cpc.tgz

Now, move to the calchep_3.4.cpc folder and compile the code

 $ cd calchep.3.4.cpc
 $ make

If the code has compiled without errors, it is enough to start working. However, usually it is recommended to do a couple of extra things.

Creating a Working folder

The default work directory is


, but in general it is a good idea to have an independent “work folder”, in order for doing so, in the CalcHEP directory there is a script to create that folder… it is called mkUsrDir and admits one argument (the path to the folder you want to create)

 $ ./mkUsrDir ~/Documents/WorkCalcHEP

Once created the working directory, you can move there and call the CalcHEP console (assuming the directory created above I would do the following)

 $ cd ~/Documents/WorkCalcHEP
 $ ./calchep

and you get this:calchep-console

Now, you are ready to start working!

Read Full Post »

A quick tip today, thanks to Jason from the google group for the tip. 🙂

I must admit to be a LaTeX addict, I’ve never used a wysiwyg editor… I do everything in LaTeX code,

  • Reports,
  • Magazine articles,
  • Letters,
  • Scientific articles,
  • Tried once to do a music sheet,
  • Posters,
  • I tried sagetex,
  • and plenty more!…
  • When I discover that SAGE notebook accepted LaTeX code, that help convince me to use it!!!


    $\vec{F} = m\vec{a}$


    \vec{F} = m\vec{a}

    I use this method to explain in the calculation worksheet what I’m doing. However, when trying to print the sheet the LaTeX code was around and the file was `messy’.

    If you use either %hide or %hideall character, the LaTeX output is hidden (at least when you want to print). Sometimes I get the cose hidden as well in the notebook, but thats not that important as hiding it when printing 🙂

    Thank you again Jason.



    Read Full Post »

    As I wrote last week I think, I’m teaching Modern Physics at the Catholic University of Valparaiso.

    Since I’m a LaTeX lover and a prolific writer (just science b.t.w.), just decide to prepare some lecture notes of the course (in Spanish) for my students… and for producing the pictures I’m using the matplotlib module of Python.


    import numpy as np
    import matplotlib.pyplot as plt

    x = np.arange(0.,5.,0.001)
    y = 1.0/np.sqrt(1- x**2)

    plt.plot(x, x**2/2.0, ‘r–‘, x, x**3/(np.exp(2*x)-1), ‘b’)
    plt.suptitle(r’Radiancia Espectral’, fontsize = 25)
    plt.ylabel(r’$\mathcal{R}(\nu)$’, fontsize = 15)
    plt.xlabel(r’Frecuencia $\nu$’, fontsize = 15)

    plt.annotate(‘Teoria Clasica’, xy=(1, 0.35), xytext=(1.6, 0.35), \ arrowprops = dict(facecolor = ‘red’, shrink=0.1))
    plt.annotate(‘Experimento’, xy=(2, 0.15), xytext=(2.4, 0.25),\ arrowprops = dict(facecolor = ‘blue’, shrink=0.1))



    import numpy as np
    import matplotlib.pyplot as plt

    x = np.arange(0.,15.,0.001)

    plt.plot(x, x**3/(np.exp(2*x)-1), ‘r’, x, x**3/(np.exp(x)-1), ‘b’, x,\ x**3/(np.exp(2*x/3.0)-1), ‘g’)
    plt.suptitle(r’Radiancia Espectral’, fontsize = 25)
    plt.ylabel(r’$\mathcal{R}(\nu)$’, fontsize = 15)
    plt.xlabel(r’Frecuencia $\nu$’, fontsize = 15)

    plt.annotate(“”, xy=(1.41396, 0.17766), xytext=(1.41396, 0.),\ arrowprops=dict(arrowstyle=”-“, connectionstyle=”arc3”))
    plt.annotate(“”, xy=(2.82534, 1.42151), xytext=(2.82534, 0.),\ arrowprops=dict(arrowstyle=”-“, connectionstyle=”arc3”))
    plt.annotate(“”, xy=(4.23398, 4.79732), xytext=(4.23398, 0.),\ arrowprops=dict(arrowstyle=”-“, connectionstyle=”arc3”))

    plt.annotate(r’$T$’, xy=(2, 0.15), xytext=(2.4, 0.65),\ arrowprops=dict(facecolor = ‘red’, shrink=0.1))
    plt.annotate(r’$2T$’, xy=(4, 1.45), xytext=(5, 2.),\ arrowprops=dict(facecolor = ‘blue’, shrink=0.1))
    plt.annotate(r’$3T$’, xy=(7.24, 4.15), xytext=(8.5, 4.5),\ arrowprops = dict(facecolor = ‘green’, shrink=0.1))


    Those are the final pictures I include in the notes, which are updated at least once a week at the google group page.

    Read Full Post »