TeXLive and Asymptote on CentOS 5
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’t have time right now to package it myself, I installed TeX Live manually in my user directory and it’s working fine. I used the network install process, which starts with downloading a command-line installer and then following the detailed installation instructions with the base path set to $HOME/texlive/2011.
How to install Octave video tools on CentOS 5
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’t explain how to do that here. 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’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. As a superuser, use yumto 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: yum install octave octave-devel ncurses-devel As a superuser, useyum 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.
Moving example code to GitHub
As this site has grown, the example code has gradually become unmanageable. I’ve posted snippets and fragments here and there over the years, and the original code is scattered in various locations across several computers. Further, as people have pointed out bugs or ways to improve the examples, I’ve had a hard time making changes. This is problem is crying out for version control with a central repository. Since I’ve been using Git for the past year or so, I decided to try GitHub. So, I am gradually moving all the examples from the site to: https://github.com/cfinch/Shocksolution_Examples When I put code in a post, I will provide a link to GitHub where you can browse or download the code. You won’ t need to use Git, or even learn anything about it.
Reading an array from a text file with Fortran 90/95
If you’re used to coding in more modern languages, Fortran I/O can seem a little bizarre. Strings in Fortran are much more difficult to work with, since they are fixed-length rather than null-terminated. The following example illustrates a simple way to read an array of numbers from a text file when the array length is unknown at compile time.
program io_test
real, dimension(:), allocatable :: x
integer :: n
open (unit=99, file='array.txt', status='old', action='read')
read(99, *), n
allocate(x(n))
read(99,*) x
write(*,*) x
endHere is the text file that the array is read from. The integer on the first line is the number of elements to read from the next line.
Managing a pool of MPI processes with Python and Pypar
MPI is a standard for communication between multiple processes in parallel computing. These processes can be running on different cores, CPUs, or entirely different computers in a grid. MPI is a standard, and there are many implementations available (many are open source). The features of MPI can be accessed from Python with the packages pypar and mpi4py. Here I present a Python script that implements a “process pool” design pattern using pypar. I have observed a pattern often enough in my own work that I wrote this framework to avoid reinventing the wheel every time I come across it. This pattern is useful for any embarrassingly parallel problem. This describes a computing task that can be easily accelerated by running multiple parallel processes that do not not need to interact with one another. For example, I have large scientific data sets from several runs of an experiment that need to be analyzed. Since the data from each run can be analyzed independently from the other runs, I can analyze all the data sets at once on a parallel machine. The code below implements a “master-worker” paradigm that requires at least three processes to accelerate the calculation. The first process be comes the master, which does no calculation but hands out tasks to the workers. The rest of the processes are workers, which receive a chunk of work, finish it, return the result to the master process, and then wait for more work.
Redirecting text output from Python functions
Two posts ago, I described how I wrote a function in Python that reads in a binary file from Labview. In my last post, I described using wxPython to write a GUI to process the data from those binary files. Naturally, I called the binary-file-reader function from the GUI. The problem is that the file reader prints a lot of information to the terminal, using Python printstatements. None of this goes to the GUI, requiring the user to run the GUI from a terminal and keep an eye on the text output, which is inconvenient. However, I don’t want to modify the file reader to include GUI-specific code, because that would be less modular and less re-usable. Instead, I learned that Python has a very easy facility to redirectstdout, the default destination of the print statement. I modified the file reader as follows:
Blog infrastructure update
During the past week, the blog engine was updated and a few things were tweaked “under the hood.” You may have already noticed that the theme has been totally changed. It’s a modified version of the Blue Box theme by Bob–the header photo is mine.
How do you say "bye bye Ubuntu" in Zulu?
I finally had enough and wiped Ubuntu off of my computer at work, and now Gentoo is happily running. Maybe I could have gotten Ubuntu to do what I wanted if I had spent more time with it, but I was sick of playing with it instead of getting work done. To be fair to Ubuntu, maybe I’m just more familiar with how to do strange things with Gentoo. Things like installing and using my open-source toolchain:
Who got fired for this?
What an unusual pine tree! Who would have guessed that this is actually a giant antenna, cleverly disguised as a tree?
I just hope that my taxpayer dollars weren’t used on this monstrosity.