Python string format examples
Thursday, November 3rd, 2011 Posted in Python, Scientific computing, Software development | No Comments »The format method for Python strings (introduced in 2.6) is very flexible and powerful. It's also easy to use, but the documentation is not very clear. It all makes sense with a few examples. I'll start with one and add ...
Parsing INI configuration files with FORTRAN
Tuesday, August 23rd, 2011 Posted in Fortran, Software development | 2 Comments »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 ...
A git branching strategy suitable for large projects
Saturday, August 13th, 2011 Posted in git, Software development | No Comments »Git is an amazing tool...but what is the best way to use it? Like any tool that gives you great power and flexibility, it's up to you to use the tool in the best way to suit your purpose. A ...
Replacing text in place with GNU sed
Monday, April 11th, 2011 Posted in Linux, Software development | No Comments »sed is a stream editor, which means that it accepts a stream of text, processes it, and spits out another stream of text. sed can process files that are too large to load into memory, and it is a completely ...
A self-contained Fortran linear equation solver
Wednesday, March 16th, 2011 Posted in Fortran, Python, Scientific computing, Software development | No Comments »I've just released a self-contained Fortran module that solves a system of linear equations using the LU decomposition. Download the Fortran linear solver from github This module is based on code that was implemented and released on the Web by Jean-Pierre Moreau. ...
Finding a value in an unordered Fortran array
Friday, March 11th, 2011 Posted in Fortran, Scientific computing, Software development | 2 Comments »I have been optimizing some Fortran code that involved searching for an integer value in an unordered array (we know the value occurs only once). Since there is no intrinsic procedure to accomplish this, I thought I'd try a couple ...
Sage: open-source mathematical software
Monday, March 7th, 2011 Posted in Python, Sage, Scientific computing, Software development | No Comments »I've recently gained a lot of experience with Sage, an open-source alternative to MATLAB, Mathematica, Maple, MuPAD, and Magma. Here are a couple of links to check out: Public notebook servers--try it online right now! Interactive examples with Sage Mathematical publications citing Sage
Linear system simulation with Python
Friday, December 17th, 2010 Posted in Python, Scientific computing, Software development | 2 Comments »Linear time-invariant (LTI) system are widely used in the field of signal processing. Scipy contains powerful tools for simulating LTI systems in the scipy.signal package, but they are not well documented. I will provide a simple example that demonstrates how ...
Storing large Numpy arrays on disk: Python Pickle vs. HDF5
Sunday, January 10th, 2010 Posted in Python, Scientific computing, Software development | 1 Comment »In a previous post, I described how Python's Pickle module is fast and convenient for storing all sorts of data on disk. More recently, I showed how to profile the memory usage of Python code. In recent weeks, I've uncovered ...
f2py: binding Fortran and Python
Wednesday, September 23rd, 2009 Posted in Fortran, Python, Software development | No Comments »I have recently started using f2py to call Fortran from Python. I have found this useful for two reasons: speeding up Python scripts by calling compiled Fortran code, and using Python as a unit testing framework for Fortran modules. Unfortunately, ...