<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>shocksolution.com</title>
	<atom:link href="http://www.shocksolution.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.shocksolution.com</link>
	<description>computational science and engineering</description>
	<lastBuildDate>Sun, 22 Jan 2012 17:32:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Installing PETSc and libMesh on CentOS 5</title>
		<link>http://www.shocksolution.com/2012/01/installing-petsc-and-libmesh-on-centos-5/</link>
		<comments>http://www.shocksolution.com/2012/01/installing-petsc-and-libmesh-on-centos-5/#comments</comments>
		<pubDate>Fri, 20 Jan 2012 20:06:18 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scientific computing]]></category>

		<guid isPermaLink="false">http://www.shocksolution.com/?p=746</guid>
		<description><![CDATA[Prerequisites: boost-devel, openmpi-devel, valgrind-devel I installed PETSc and libMesh in my user directory, since I have a single-user workstation. Installing PETSc for use with libMesh First, ensure that OpenMPI is installed and the system paths have been configured correctly.  You will need to add the directory containing OpenMPI binaries to your $PATH, and the directory [...]]]></description>
			<content:encoded><![CDATA[<p><strong>Prerequisites:</strong> boost-devel, openmpi-devel, valgrind-devel</p>
<p>I installed PETSc and libMesh in my user directory, since I have a single-user workstation.</p>
<h2>Installing PETSc for use with libMesh</h2>
<p>First, ensure that OpenMPI is installed and the system paths have been configured correctly.  You will need to add the directory containing OpenMPI binaries to your $PATH, and the directory containing OpenMPI libraries to $LD_LIBRARY_PATH.  CentOS does <em>not</em> do this automatically!  Type <strong>mpicc</strong> on the command line to make sure the shell can find the binary.  If mpicc and mpif77 run, then you <a title="OpenMPI docs on PETSc" href="http://www.open-mpi.org/faq/?category=mpi-apps#petsc" target="_blank">should <em>not</em> need to use the comnand-line flags to the configure script for PETSc</a>.</p>
<p><span id="more-746"></span></p>
<p>If you are going to use libMesh with PETSc, you need to enable C++ with a command-line option to the configure script.  Here is the process I used (it might be a good idea to set PETSC_ARCH and PETSC_DIR in your .bashrc so they are consistent for all builds).</p>
<pre>tar xfz petsc-3.2-p6.tar.gz
cd petsc-3.2-p6
export PETSC_DIR=$PWD
./configure --with-clanguage=c++
make PETSC_ARCH=arch-linux2-c-debug all
make PETSC_ARCH=arch-linux2-c-debug test</pre>
<h2>Installing libMesh</h2>
<p>You must have <a title="Building PETSc for libMesh" href="http://comments.gmane.org/gmane.comp.mathematics.libmesh.user/2764">compiled PETSc with C++ support</a>, as detailed above, to install libMesh successfully.  Also, the environment variables PETSC_ARCH and PETSC_DIR in the libMesh build environment must have the same values used to build PETSc.  Once PETSc is built correctly, libMesh is easy to build:</p>
<pre> cd libmesh-0.7.2/libmesh
./configure
make
make run_examples</pre>
<p>That&#8217;s it!  Please comment below if you have a different experience.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shocksolution.com/2012/01/installing-petsc-and-libmesh-on-centos-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Paraview 3.12 on 64-bit CentOS 5.7</title>
		<link>http://www.shocksolution.com/2012/01/paraview-3-12-on-64-bit-centos-5-7/</link>
		<comments>http://www.shocksolution.com/2012/01/paraview-3-12-on-64-bit-centos-5-7/#comments</comments>
		<pubDate>Thu, 19 Jan 2012 19:23:15 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Scientific computing]]></category>

		<guid isPermaLink="false">http://www.shocksolution.com/?p=740</guid>
		<description><![CDATA[I finally got around to installing Paraview on my CentOS 5 box.  There are no official RPMS for CentOS 5, so I was expecting a painful build process. To my great surprise, I was able to download the Paraview binary for Linux (64-bit) from Kitware, unpack the archive, and run it!  As root, I placed [...]]]></description>
			<content:encoded><![CDATA[<p>I finally got around to installing Paraview on my CentOS 5 box.  There are no official RPMS for CentOS 5, so I was expecting a painful build process. To my great surprise, I was able to <a title="Download Paraview" href="http://www.paraview.org/paraview/resources/software.html" target="_blank">download the Paraview binary</a> for Linux (64-bit) from Kitware, unpack the archive, and run it!  As root, I placed the entire ParaView-3.12.0 directory under <span style="color: #0000ff;">/opt/Paraview</span>.  You could also keep it in your home directory if you are running a single-user system.  I added <span style="color: #0000ff;">/opt/Paraview/ParaView-3.12.0/bin</span> to the $PATH in the .bashrc file in my home directory.  Now I can type <strong>paraview</strong> at the command line and it runs!</p>
<p>What if you want Paraview to appear in the Applications menu in your desktop environment?  Most modern desktops (I use XFCE4) construct the Applications menu &#8220;on the fly&#8221; based upon the files in a standard directory (<span style="color: #0000ff;">/usr/share/applications</span> on CentOS).  The <a title="Free Desktop Project" href="http://www.freedesktop.org/wiki/Home" target="_blank">Free Desktop Project</a> has created a <a title="Desktop Entry File Format" href="http://standards.freedesktop.org/desktop-entry-spec/latest/" target="_blank">standard for desktop entry files</a>.  You may also find this <a title="Summary of .desktop standard" href="http://linuxcritic.wordpress.com/2010/04/07/anatomy-of-a-desktop-file/" target="_blank">summary of the standard</a> to be helpful.  To add Paraview to the menu, you simply need to create a new file in the standard location.  If you installed Paraview in your user directory, you may want to place the desktop file in <span style="color: #0000ff;">$HOME/.local/applications</span>.  Here are the contents of a file I called paraview.desktop:</p>
<pre>[Desktop Entry]
Type=Application
Name=Paraview
Categories=Graphics;3DGraphics;Science;Engineering
Comment=3D visualization tool
Exec=paraview
Icon=paraview.svg</pre>
<p>I found <a title="Paraview icons" href="http://www.paraview.org/pipermail/paraview/2008-May/007909.html" target="_blank">Paraview menu icons here</a>.  Save the SVG icon to /usr/share/icons (there may be an equivalent location in your user directory but I don&#8217;t know what it is).  Now, when you bring up the Applications menu in your desktop environment the entry should appear (no need to restart or anything).</p>
<div id="attachment_743" class="wp-caption aligncenter" style="width: 310px"><a href="http://shocksolution.com/wordpress/wp-content/uploads/2012/01/Paraview_glyphs.png"><img class="size-medium wp-image-743" title="Paraview screenshot" src="http://shocksolution.com/wordpress/wp-content/uploads/2012/01/Paraview_glyphs-300x222.png" alt="" width="300" height="222" /></a><p class="wp-caption-text">Screenshot of Paraview</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.shocksolution.com/2012/01/paraview-3-12-on-64-bit-centos-5-7/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Installing Sage 4.7 on CentOS 5</title>
		<link>http://www.shocksolution.com/2011/11/installing-sage-4-7-on-centos-5/</link>
		<comments>http://www.shocksolution.com/2011/11/installing-sage-4-7-on-centos-5/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 23:07:59 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Sage]]></category>
		<category><![CDATA[Scientific computing]]></category>

		<guid isPermaLink="false">http://www.shocksolution.com/?p=714</guid>
		<description><![CDATA[I recently upgraded my desktop workstation from an old 32-bit version of Gentoo to 64-bit CentOS 5.  I downloaded and installed the latest version of Sage, and the process went smoothly. If you find this post helpful, please check out the Sage Beginner&#8217;s Guide at Packt Publishing.  Since I don&#8217;t use Sage every day, I [...]]]></description>
			<content:encoded><![CDATA[<p>I recently upgraded my desktop workstation from an old 32-bit version of Gentoo to 64-bit CentOS 5.  I downloaded and installed the latest version of <a title="Sage home page" href="http://www.sagemath.org/" target="_blank">Sage</a>, and the process went smoothly.</p>
<p>If you find this post helpful, please check out the <a title="Sage Beginner's Guide" href="http://www.packtpub.com/sage-beginners-guide/book" target="_blank">Sage Beginner&#8217;s Guide at Packt Publishing</a>.  Since I don&#8217;t use Sage every day, I actually refer to my own book on a regular basis!</p>
<h3>Download</h3>
<p>Since CentOS is designed to be binary compatible with Red Hat Enterprise Linux, the correct binary to download is<br />
<strong>sage-4.7.2-linux-64bit-red_hat_enterprise_linux_server_release_5.6_tikanga-x86_64-Linux.tar.gz</strong></p>
<h3>Install</h3>
<p>Uncompress the file with <strong>tar xfz</strong> &lt;filename&gt;  The result is a huge directory (3.1Gb) with a self-contained version of Sage that can be run right where you uncompressed it.  As <strong>root</strong>, I moved the directory to <strong>/opt</strong>, changed ownership to <strong>root</strong>, and changed the name to <strong>sage-4.7.2</strong>.  I then edited the script <strong>/opt/sage-4.7.2/sage</strong> so that the variable SAGE_ROOT contains the correct path:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #007800;">SAGE_ROOT</span>=<span style="color: #ff0000;">&quot;/opt/sage-4.7.2&quot;</span></pre></div></div>

<p>Run sage once as root to set the paths correctly.</p>
<p><span id="more-714"></span></p>
<h3>User Access</h3>
<p>To make it easier to run Sage,  I created a symbolic link to the Sage run script in /usr/bin/:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>bin
<span style="color: #c20cb9; font-weight: bold;">ln</span> <span style="color: #660033;">-s</span> <span style="color: #000000; font-weight: bold;">/</span>opt<span style="color: #000000; font-weight: bold;">/</span>sage-4.7.2<span style="color: #000000; font-weight: bold;">/</span>sage sage</pre></div></div>

<p>Since this directory is on every user&#8217;s default path, a user can now start Sage by simply typing <strong>sage</strong> in a terminal.</p>
<h3>Notebook Interface</h3>
<p>When you first start Sage you will get a comnand-line interface in a terminal, which is very similar to iPython.  If you want to use a more graphical interface, type <strong>notebook()</strong> at the Sage command prompt:</p>
<div id="attachment_722" class="wp-caption aligncenter" style="width: 310px"><a href="http://www.shocksolution.com/2011/11/installing-sage-4-7-on-centos-5/screenshot-1/" rel="attachment wp-att-722"><img class="size-medium wp-image-722" title="Launching Sage Notebook" src="http://shocksolution.com/wordpress/wp-content/uploads/2011/11/Screenshot-1-300x173.png" alt="" width="300" height="173" /></a><p class="wp-caption-text">Launching Sage Notebook</p></div>
<p>You will have to create an admin password, as shown above.  Follow the advice and create a secure password.  If a new browser tab or window doesn&#8217;t automatically open, open one manually and paste <strong>http://localhost:8000</strong> into the address field.  You are now logged in as a user called <strong>admin</strong>, so I suggest creating a separate user account for yourself (for the same reason that you should only use the <strong>root</strong> account for system administration on a Linux system).  From the links at the top of the screen choose <span style="color: #0000ff;">Settings-&gt;Manage Users-&gt;Add User</span>.  After entering a user name, you will be given a temporary password.  Copy the temporary password, log out, and log in with your new user name and temporary password.  I suggest that you go to <span style="color: #0000ff;">Settings</span> and change your password to something easier to remember.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shocksolution.com/2011/11/installing-sage-4-7-on-centos-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Python string format examples</title>
		<link>http://www.shocksolution.com/2011/11/python-string-format-examples/</link>
		<comments>http://www.shocksolution.com/2011/11/python-string-format-examples/#comments</comments>
		<pubDate>Thu, 03 Nov 2011 22:38:10 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Scientific computing]]></category>
		<category><![CDATA[Software development]]></category>

		<guid isPermaLink="false">http://www.shocksolution.com/?p=705</guid>
		<description><![CDATA[The format method for Python strings (introduced in 2.6) is very flexible and powerful.  It&#8217;s also easy to use, but the documentation is not very clear.  It all makes sense with a few examples.  I&#8217;ll start with one and add more as I have time: Formatting a floating-point number &#34;{0:.4f}&#34;.format&#40;0.1234567890&#41; The result is the following [...]]]></description>
			<content:encoded><![CDATA[<p>The <a title="Python strings format method" href="http://docs.python.org/library/string.html#format-string-syntax" target="_blank">format method for Python strings</a> (introduced in 2.6) is very flexible and powerful.  It&#8217;s also easy to use, but the documentation is not very clear.  It all makes sense with a few examples.  I&#8217;ll start with one and add more as I have time:</p>
<h2>Formatting a floating-point number</h2>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #483d8b;">&quot;{0:.4f}&quot;</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0.1234567890</span><span style="color: black;">&#41;</span></pre></div></div>

<p>The result is the following string:</p>
<pre>'0.1235'</pre>
<h3>Explanation</h3>
<p>Braces { } are used to enclose the &#8220;replacement field&#8221;<br />
0 indicates the first argument to method <strong>format</strong><br />
: indicates the start of the format specifier<br />
.4 indicates four decimal places<br />
f indicates a floating-point number</p>
<h2>Scientific Notation</h2>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #483d8b;">&quot;{0:.4e}&quot;</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0.1234567890</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Output:</p>
<pre>'1.2346e-01'</pre>
<h2>Multiple Arguments</h2>
<p>In Python 2.6 you can include multiple arguments like this:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #483d8b;">&quot;sin({0:.4f}) = {1:.4e}&quot;</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0.1234567890</span>, sin<span style="color: black;">&#40;</span><span style="color: #ff4500;">0.123456789</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></div></div>

<pre>'sin(0.1235) = 1.2314e-01'</pre>
<p>In Python 2.7 and later, you may omit the first integer from each replacement field, and the arguments to <strong>format</strong> will be taken in order:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;"><span style="color: #483d8b;">&quot;sin({:.4f}) = {:.4e}&quot;</span>.<span style="color: black;">format</span><span style="color: black;">&#40;</span><span style="color: #ff4500;">0.1234567890</span>, sin<span style="color: black;">&#40;</span><span style="color: #ff4500;">0.123456789</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></div></div>

<pre>'sin(0.1235) = 1.2314e-01'</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.shocksolution.com/2011/11/python-string-format-examples/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Linux kernel 3.1 config for Gentoo guest on VMWare Fusion</title>
		<link>http://www.shocksolution.com/2011/10/linux-kernel-3-1-config-for-gentoo-guest-on-vmware-fusion/</link>
		<comments>http://www.shocksolution.com/2011/10/linux-kernel-3-1-config-for-gentoo-guest-on-vmware-fusion/#comments</comments>
		<pubDate>Mon, 24 Oct 2011 03:23:48 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Mac]]></category>

		<guid isPermaLink="false">http://www.shocksolution.com/?p=699</guid>
		<description><![CDATA[The following kernel configuration was posted by Alessandro Di Marco as a comment on a previous post in which I provided a Linux kernel config for an earlier version of the kernel. In the interest of sharing his contribution, I&#8217;m placing it in its own post. I don&#8217;t know the author personally and I have [...]]]></description>
			<content:encoded><![CDATA[<p>The following kernel configuration was posted by Alessandro Di Marco as a comment on a previous post in which I provided a Linux kernel config for an earlier version of the kernel. In the interest of sharing his contribution, I&#8217;m placing it in its own post. I don&#8217;t know the author personally and I have not tried this config.  Like any other free software, you are <span style="color: #ff0000;">using it at your own risk and neither Alessandro nor I provide any warranty</span>. Download the file from the link below, change the file extension from .txt. to .config and load the config into one of the standard kernel configuration tools (such as <strong>make menuconfig</strong>) and look over all the options before using it.</p>
<p><a href="http://shocksolution.com/wordpress/wp-content/uploads/2011/11/gentoo_kernel31_config.txt">Gentoo Kernel 3.1 Config</a></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shocksolution.com/2011/10/linux-kernel-3-1-config-for-gentoo-guest-on-vmware-fusion/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>TeXLive and Asymptote on CentOS 5</title>
		<link>http://www.shocksolution.com/2011/10/texlive-and-asymptote-on-centos-5/</link>
		<comments>http://www.shocksolution.com/2011/10/texlive-and-asymptote-on-centos-5/#comments</comments>
		<pubDate>Mon, 03 Oct 2011 18:18:50 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.shocksolution.com/?p=689</guid>
		<description><![CDATA[Tex Live For reasons unknown, a TeX Live package is not available for Red Hat Enterprise Linux/Centos 5 from the major repositories (EPEL or DAG).  I consider this to be a glaring omission, since TeXLive is a great improvement upon teTeX.  Since I don&#8217;t have time right now to package it myself, I installed TeX [...]]]></description>
			<content:encoded><![CDATA[<h3>Tex Live</h3>
<p>For reasons unknown, a <a title="TeX Live" href="http://www.tug.org/texlive/" target="_blank">TeX Live</a> package is not available for Red Hat Enterprise Linux/Centos 5 from the major repositories (EPEL or DAG).  I consider this to be a glaring omission, since TeXLive is a great improvement upon teTeX.  Since I don&#8217;t have time right now to package it myself, I installed TeX Live manually in my user directory and it&#8217;s working fine.  I used the network install process, which starts with <a title="Tex Live installation script" href="http://www.tug.org/texlive/acquire-netinstall.html" target="_blank">downloading a command-line installer</a> and then following the <a title="Detailed TeX Live installation instructions" href="http://www.tug.org/texlive/doc/texlive-en/texlive-en.html#x1-150003" target="_blank">detailed installation instructions </a>with the base path set to <span style="color: #000080;">$HOME/texlive/2011</span>.</p>
<h3>Asymptote</h3>
<p>The binary version of <a title="Asymptote vector graphics language" href="http://asymptote.sourceforge.net/" target="_blank">Asymptote</a> installed with TeX Live didn&#8217;t run on my system, so I installed the Asymptote vector graphics language manually.  As root, I used <strong>yum</strong> to install the <strong>gc</strong> and <strong>gc-devel</strong> packages to provide the <a title="Boehm garbage collector" href="http://www.hpl.hp.com/personal/Hans_Boehm/gc/" target="_blank">Boehm garbage collector</a> that Asymptote uses.  I also had to install the package <strong>texinfo-tex</strong> from the CentOS base repo to provide the <strong>texindex</strong> utility that Asymptote uses to build its documentation.  Once the dependencies were in place, I downloaded the Asymptote source archive and unpacked it.  I used the following commands to build Asymptote in my user directory:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">.<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #007800;">$HOME</span><span style="color: #000000; font-weight: bold;">/</span>asymptote
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>Finally, I set up up the path environment variable in my .bashrc so that the copy of Asymptote I just built will run instead of the binary that comes with TeX Live and my locally installed TeX Live will run instead of the system installation of teTeX:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">PATH</span>=~<span style="color: #000000; font-weight: bold;">/</span>asymptote<span style="color: #000000; font-weight: bold;">/</span>bin:~<span style="color: #000000; font-weight: bold;">/</span>texlive<span style="color: #000000; font-weight: bold;">/</span><span style="color: #000000;">2011</span><span style="color: #000000; font-weight: bold;">/</span>bin<span style="color: #000000; font-weight: bold;">/</span>x86_64-linux:<span style="color: #007800;">$PATH</span></pre></div></div>

<p>If you are doing this from scratch, you should check whether there is a away to prevent the TeX Live installer from installing Asymptote.</p>
<p>Technically, I could remove the system installation of teTeX at this point, but the <a title="LyX" href="http://http://www.lyx.org/" target="_blank">LyX</a> package depends on teTeX and I&#8217;ll have to see if there&#8217;s a way to tell yum to keep LyX and get rid of teTeX.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shocksolution.com/2011/10/texlive-and-asymptote-on-centos-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to install Octave video tools on CentOS 5</title>
		<link>http://www.shocksolution.com/2011/09/how-to-install-octave-video-tools-on-centos-5/</link>
		<comments>http://www.shocksolution.com/2011/09/how-to-install-octave-video-tools-on-centos-5/#comments</comments>
		<pubDate>Wed, 14 Sep 2011 15:57:44 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.shocksolution.com/?p=681</guid>
		<description><![CDATA[This post describes how to get GNU Octave up and running on a CentOS 5 Linux system for use in reading, processing, and writing video files.  You will need to use the EPEL and DAG/rpmforge repositories, but I won&#8217;t explain how to do that here. NOTE: I had to go through some trial and error [...]]]></description>
			<content:encoded><![CDATA[<p>This post describes how to get <a title="GNU Octave: free software that works like MATLAB" href="http://www.gnu.org/software/octave/" target="_blank">GNU Octave</a> up and running on a CentOS 5 Linux system for use in reading, processing, and writing video files.  You will need to use the <a title="How to set up EPEL repository" href="http://fedoraproject.org/wiki/EPEL" target="_blank">EPEL</a> and <a title="How to set up DAG/RPMForge repository" href="http://wiki.centos.org/AdditionalResources/Repositories/RPMForge" target="_blank">DAG/rpmforge</a> repositories, but I won&#8217;t explain how to do that here.</p>
<p><span style="color: #ff0000;">NOTE: I had to go through some trial and error to get this working.  I tried to summarize only the necessary steps, but I can&#8217;t guarantee I got it completely right until I try a fresh install on another system which does not have any of the dependencies already installed.  Please leave a comment if you encounter any problems.</span></p>
<p>As a superuser, use <strong>yum</strong> to install octave.  You need octave-devel and ncurses-devel in order to install any Octave packages.  You will need to have the EPEL repository enabled:</p>
<p><span style="color: #800000;">yum install octave octave-devel ncurses-devel</span></p>
<p>As a superuser, use <strong>yum</strong> to install ffmpeg and ffmpeg-devel from the rpmforge repo.  The video package for octave uses the ffmpeg libraries (avilib) to perform the actual video processing.  You will need the ffmpeg-devel package, because Octave builds the video package from source.</p>
<ol>
<li>Since ffmpeg and ffmpeg-devel are only available from DAG/rpmforge, I suggest disabling EPEL before installing these packages.  This will ensure that all the dependencies are installed from rpmforge, instead of mixing packages from EPEL and rpmforge.  Mixing dependencies from different repositories might lead to incompatibilities and bugs that can be hard to trace.</li>
<li><span style="color: #800000;">yum install ffmpeg ffmpeg-devel</span></li>
</ol>
<p>Install the video package for Octave.  I prefer to do this as an ordinary user (not root) so that the packages will be installed in my home directory (I have a &#8220;rule&#8221; that only the package manager is allowed to put files into system locations).  You will need to set the CXX flags environment variable to work around a bug in the C++ headers for the ffmpeg libraries.  If you are going to build other packages that link to ffmpeg&#8217;s libraries, you should probably set CXXFLAGS in your .bashrc.  I think this bug was fixed in later versions of ffmpeg, but they haven&#8217;t made it into EPEL or rpmforge yet.</p>
<ol>
<li><a title="Download video package for Octave" href="http://octave.sourceforge.net/video/index.html" target="_blank">Download video package</a></li>
<li>Unpack the archive: <span style="color: #800000;">tar xfz video-1.0.2.tar.gz</span></li>
<li>Change to the unpacked directory: <span style="color: #800000;">cd video-1.0.2</span></li>
<li>Temporarily set C++ flags and configure: <span style="color: #800000;">CXXFLAGS=-D__STDC_CONSTANT_MACROS ./configure</span></li>
<li>Temporarily set C++ flags and build: <span style="color: #800000;">CXXFLAGS=-D__STDC_CONSTANT_MACROS make</span></li>
<li>Install: <span style="color: #800000;">make install</span></li>
</ol>
<p><span style="color: #000000;">If you don&#8217;t set the C++ flags this way, you will get an error like this:</span></p>
<p><span style="color: #800000;"><span style="color: #ff0000;">/usr/include/libavutil/common.h: In function ‘int32_t av_clipl_int32(int64_t)’:</span><br />
<span style="color: #ff0000;">/usr/include/libavutil/common.h:154: error: ‘UINT64_C’ was not declared in this scope</span><br />
</span></p>
]]></content:encoded>
			<wfw:commentRss>http://www.shocksolution.com/2011/09/how-to-install-octave-video-tools-on-centos-5/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to build ScipPy with Python 2.7.2 on CentOS5</title>
		<link>http://www.shocksolution.com/2011/08/how-to-build-scippy-with-python-2-7-2-on-centos5/</link>
		<comments>http://www.shocksolution.com/2011/08/how-to-build-scippy-with-python-2-7-2-on-centos5/#comments</comments>
		<pubDate>Thu, 25 Aug 2011 00:17:57 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Linux]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Scientific computing]]></category>

		<guid isPermaLink="false">http://www.shocksolution.com/?p=652</guid>
		<description><![CDATA[EDIT: added &#8211;enable-shared to configure script for building Python, and added /home/yourname/lib to shared library path.  This is necessary for building some packages such as pycairo (which you may need to build pygtk and matplotlib). EDIT 2: you should use the &#8211;prefix=/home/yourusername instead of &#8211;user.  The prefix option places packages in the standard location: /home/yourusername/lib/python2.7/site-packages.  [...]]]></description>
			<content:encoded><![CDATA[<p><span style="color: #ff0000;">EDIT: added &#8211;enable-shared to configure script for building Python, and added /home/yourname/lib to shared library path.  This is necessary for building some packages such as pycairo (which you may need to build pygtk and matplotlib).<br />
</span></p>
<p><span style="color: #000080;">EDIT 2: you should use the &#8211;prefix=/home/yourusername instead of &#8211;user.  The prefix option places packages in the standard location: /home/yourusername/lib/python2.7/site-packages.  The &#8211;user option places the packages in /home/yourusername/.local/lib/python2.7/site-packages which I think is screwed up!</span></p>
<p>&nbsp;</p>
<p>I use CentoOS5 because I want enterprise-class stability, as well as binary compatibility with a commercial application that is built for RHEL5.  I need to use some &#8220;bleeding edge&#8221; packages, such as the latest version of SciPy, but I don&#8217;t want to affect the base stability of the system.  Here is how I did it.  First, with superuser privileges, use yum to install the following packages.  You may need to set up epel as an alternate repository:</p>
<p><span id="more-652"></span></p>
<ul>
<li>readline-devel</li>
<li>python-devel</li>
<li>blas</li>
<li>lapack</li>
<li>atlas</li>
<li>blas-devel</li>
<li>lapack-devel</li>
<li>atlas-devel</li>
</ul>
<p>If you are going to install iPython (which I highly recommend) you will also need to install:</p>
<ul>
<li>sqlite-devel</li>
</ul>
<p>Installing the &#8220;-devel&#8221; packages is critical!  The basic packages install <a title="NumPy-Discuss email about .so and .so.3" href="http://mail.scipy.org/pipermail/numpy-discussion/2009-November/046868.html" target="_blank">libraries that end in *.so.3, which cannot be used to link newly built applications</a>.  The -devel packages include libraries that end in *.so that are required for building Scipy.</p>
<p>Now, <em>without</em> superuser privileges, download Python 2.7.2, NumPy 1.6.1, and SciPy 0.9.0 to your home directory.</p>
<h3>Building Python 2.7</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">cd</span> Python-2.7.2
<span style="color: #007800;">LDFLAGS</span>=<span style="color: #ff0000;">'-L/usr/lib64'</span> .<span style="color: #000000; font-weight: bold;">/</span>configure <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>cfinch <span style="color: #660033;">--enable-shared</span>
<span style="color: #c20cb9; font-weight: bold;">make</span>
<span style="color: #c20cb9; font-weight: bold;">make</span> <span style="color: #c20cb9; font-weight: bold;">install</span></pre></div></div>

<p>The LDFLAGS variable tells <strong>configure</strong> where to find libraries like sqlite, which will be needed if you want to build iPython.  A Python binary should now be installed in /home/yourname/bin/python2.7.  You have to type <strong>python2.7</strong> to use the new one; if you just type <strong>python</strong> you will get the system-wide Python 2.4 interpreter.  You don&#8217;t want to change the default to 2.7 unless you really know what your are doing, because important system tools depend on having 2.4 as the default.  Finally, set your LD_LIBRARY_PATH environment variable to include /home/cfinch/lib:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #7a0874; font-weight: bold;">export</span> <span style="color: #007800;">LD_LIBRARY_PATH</span>=<span style="color: #ff0000;">'/home/cfinch/lib'</span>:<span style="color: #007800;">$LD_LIBRARY_PATH</span></pre></div></div>

<h3>Building NumPy</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> xfz numpy-1.6.1.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> numpy-1.6.1</pre></div></div>

<p>Now, copy the file <span style="color: #0000ff;">site.cfg.example</span> to <span style="color: #0000ff;">site.cfg</span> and make the following changes:</p>
<pre>[DEFAULT]
#library_dirs = /usr/local/lib
#include_dirs = /usr/local/include
library_dirs=/usr/lib64/atlas</pre>
<p>This tells the installation process where to find the library files for BLAS, LAPACK, and ATLAS. Now, we can install NumPy with:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">python2.7 setup.py <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>cfinch</pre></div></div>

<h3>Building SciPy</h3>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">tar</span> xfz scipy-0.9.0.tar.gz
<span style="color: #7a0874; font-weight: bold;">cd</span> scipy-9.0.0
python2.7 setup.py <span style="color: #c20cb9; font-weight: bold;">install</span> <span style="color: #660033;">--prefix</span>=<span style="color: #000000; font-weight: bold;">/</span>home<span style="color: #000000; font-weight: bold;">/</span>cfinch</pre></div></div>

<p>Finally, download, build, and install iPython per the instructions. It won&#8217;t work unless you built Python with sqlite support, as described above.</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shocksolution.com/2011/08/how-to-build-scippy-with-python-2-7-2-on-centos5/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Parsing INI configuration files with FORTRAN</title>
		<link>http://www.shocksolution.com/2011/08/parsing-ini-configuration-files-with-fortran/</link>
		<comments>http://www.shocksolution.com/2011/08/parsing-ini-configuration-files-with-fortran/#comments</comments>
		<pubDate>Tue, 23 Aug 2011 21:14:44 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Fortran]]></category>
		<category><![CDATA[Software development]]></category>

		<guid isPermaLink="false">http://www.shocksolution.com/?p=649</guid>
		<description><![CDATA[Fortran would not be my first choice for working with text, in any form! However, sometimes even numerical codes need to read data from configuration files. The easiest way to read a configuration file from a Fortran 90 routine is by using namelist I/O (I really need to add an example of that). If you&#8217;re [...]]]></description>
			<content:encoded><![CDATA[<p>Fortran would not be my first choice for working with text, in any form! However, sometimes even numerical codes need to read data from configuration files. The easiest way to read a configuration file from a Fortran 90 routine is by using <a title="Fortran namelist I/O" href="http://owen.sj.ca.us/~rk/howto/slides/f90model/slides/namelist.html" target="_blank">namelist I/O </a>(I really need to add an example of that). If you&#8217;re stuck with <a title="All about INI files" href="http://en.wikipedia.org/wiki/INI_file" target="_blank">INI files</a>, I found an <a title="Fortran INI file parser" href="http://www.fortranlib.com/freesoft.htm#Miscellaneous" target="_blank">INI file parser written in Fortran</a> buried in an index of free Fortran routine.  I don&#8217;t even remember how I even found it, since it&#8217;s not well labeled and doesn&#8217;t come up in the first few pages of Google results, so I thought I&#8217;d better write a post about it in case I ever need such a thing in the future.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shocksolution.com/2011/08/parsing-ini-configuration-files-with-fortran/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Removing an axis or both axes from a matplotlib plot</title>
		<link>http://www.shocksolution.com/2011/08/removing-an-axis-or-both-axes-from-a-matplotlib-plot/</link>
		<comments>http://www.shocksolution.com/2011/08/removing-an-axis-or-both-axes-from-a-matplotlib-plot/#comments</comments>
		<pubDate>Wed, 17 Aug 2011 22:40:14 +0000</pubDate>
		<dc:creator>craig</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Scientific computing]]></category>

		<guid isPermaLink="false">http://www.shocksolution.com/?p=627</guid>
		<description><![CDATA[Sometimes, the frame around a matplotlib plot can detract from the information you are trying to convey.  How do you remove the frame, ticks, or axes from a matplotlib plot? The full example is available on github. First, we construct a figure and an axes object: fig1 = plt.figure&#40;facecolor='white'&#41; ax1 = plt.axes&#40;frameon=False&#41; The Axes object [...]]]></description>
			<content:encoded><![CDATA[<p>Sometimes, the frame around a <a title="matplotlib" href="http://matplotlib.sourceforge.net/" target="_blank">matplotlib</a> plot can detract from the information you are trying to convey.  How do you remove the frame, ticks, or axes from a matplotlib plot?</p>
<div id="attachment_632" class="wp-caption aligncenter" style="width: 310px"><a rel="attachment wp-att-632" href="http://www.shocksolution.com/2011/08/removing-an-axis-or-both-axes-from-a-matplotlib-plot/plot_without_y_axis/"><img class="size-medium wp-image-632" title="matplotlib plot without a y axis" src="http://shocksolution.com/wordpress/wp-content/uploads/2011/08/plot_without_y_axis-300x225.png" alt="" width="300" height="225" /></a><p class="wp-caption-text">matplotlib plot without a y axis</p></div>
<p><a title="Removing an axis from a Matplotlib plot" href="https://github.com/cfinch/Shocksolution_Examples/tree/master/Plotting/matplotlib" target="_blank">The full example is available on github</a>.</p>
<p><span id="more-627"></span>First, we construct a figure and an axes object:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">fig1 = plt.<span style="color: black;">figure</span><span style="color: black;">&#40;</span>facecolor=<span style="color: #483d8b;">'white'</span><span style="color: black;">&#41;</span>
ax1 = plt.<span style="color: black;">axes</span><span style="color: black;">&#40;</span>frameon=<span style="color: #008000;">False</span><span style="color: black;">&#41;</span></pre></div></div>

<p>The Axes object is a container that holds the axes, the ticks, the labels, the plot, the legend, etc.  You will always have an Axes object, even if the axes are not visible!  The keyword argument <strong>frameon=False</strong> turns the frame off.  An alternative method is:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">ax1.<span style="color: black;">set_frame_on</span><span style="color: black;">&#40;</span><span style="color: #008000;">False</span><span style="color: black;">&#41;</span></pre></div></div>

<p>We&#8217;ll disable the drawing of ticks at the top of the plot:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">ax1.<span style="color: black;">get_xaxis</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">tick_bottom</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Now, we&#8217;ll turn off the y axis:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">ax1.<span style="color: black;">axes</span>.<span style="color: black;">get_yaxis</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">set_visible</span><span style="color: black;">&#40;</span><span style="color: #008000;">False</span><span style="color: black;">&#41;</span></pre></div></div>

<p>Replace <strong>get_yaxis</strong> with <strong>get_xaxis</strong> to access the x axis.  The problem is that now the x axis doesn&#8217;t have a line, so we&#8217;ll have to add one ourselves.  Let&#8217;s assumed we&#8217;ve plotted some stuff.  To add the x axis line:</p>

<div class="wp_syntax"><div class="code"><pre class="python" style="font-family:monospace;">xmin, xmax = ax1.<span style="color: black;">get_xaxis</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">get_view_interval</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
ymin, ymax = ax1.<span style="color: black;">get_yaxis</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>.<span style="color: black;">get_view_interval</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
ax1.<span style="color: black;">add_artist</span><span style="color: black;">&#40;</span>Line2D<span style="color: black;">&#40;</span><span style="color: black;">&#40;</span>xmin, xmax<span style="color: black;">&#41;</span>, <span style="color: black;">&#40;</span>ymin, ymin<span style="color: black;">&#41;</span>, color=<span style="color: #483d8b;">'black'</span>, linewidth=<span style="color: #ff4500;">2</span><span style="color: black;">&#41;</span><span style="color: black;">&#41;</span></pre></div></div>

<p>First, we obtain the limits of the current view.  Then, we use these limits to define the length of the x axis line.  This approach allows the line to dynamically adapt if the user changes the view limits in the plot window.  Note that we have to use a linewidth of 2 to get a visible linewidth of 1, because the lower half of the lower half of the line is clipped.  We use the <strong>add_artist</strong> method to add the line to the Axes object.   This method is better than just plotting a line on the Axes, because we don&#8217;t want the axis to show up in the legend!<br />
<a title="Removing an axis from a Matplotlib plot" href="https://github.com/cfinch/Shocksolution_Examples/tree/master/Plotting/matplotlib" target="_blank">Get the full example on github</a>.</p>
<p>An alternate approach is to use the <a title="AxesGrid Toolkit for matplotlib" href="http://matplotlib.sourceforge.net/mpl_toolkits/axes_grid/index.html" target="_blank">AxesGrid Toolkit</a>, which comes with versions of Matplotlib 0.99 or higher.  Here is an example of how <a title="AxesGrid show only left and bottom axes" href="http://matplotlib.sourceforge.net/examples/axes_grid/simple_axisline3.html" target="_blank">AxesGrid can display only the left and bottom axes</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.shocksolution.com/2011/08/removing-an-axis-or-both-axes-from-a-matplotlib-plot/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
	</channel>
</rss>

