RichardNeill.org

Plot data-files (optionally performing FFT or Linear Regression)

Introduction

These are some simple CLI utilities which read in data from a file (one or more columns of int or float data), transform it, and plot it.
It's intended for automating repeated experiments, so the axis-names, legend, and output filename (if desired) are all CLI arguments.

This is all written using Python (numpy, scipy, pyplot, matplotlib), and is released as GPL. It's ready to use, and easy to modify.
Data files are read by numpy.loadtxt(), so are formatted as multiple columns, whitespace delimited, separated by newlines.
Data may be integer or floating-point. Blank lines and '#comments' are ignored.

For example:
dataplot -c0 file.dat plots the raw data from the first column of the datafile.
fftplot -f 1000 -z -o out.png file.dat plots the FFT of the input, zooming on the interesting bit, saving to out.png.

Contents

  • fftplot processes a raw datafile (of columns of ascii float/int) and performs the Fourier Transform. It plots the resulting power spectrum, and prints out the frequency peak. It can also plot the input file. The file can contain multiple columns; fftplot can choose any one, sum them, or plot them all.

  • linregplot processes a raw datafile (of columns of ascii float/int) and performs linear regression upon it. (similar to fftplot)

  • dataplot just plots raw data.

  • dat2wav extracts one or more columns from the datafile and converts to a .wav file. Useful for listening to noise, or viewing the wave directly in a wav editor, such as audacity.

  • decimate decimate a data file. Useful because dataplot etc can't cope with very large datasets. (a limit of matplotlib).

  • genffttest and genlinregtest creates some sample data for fftplot and linregplot

Installation

  • These are complete and well commented, ready to use and easy to modify. It's all written in Python (except decimate which is perl).
  • Documentation is in the README.txt, the man pages, and by invoking each command with -h. Or read the source.
  • To install, simply: make && sudo make install
  • This is Free Software released under the GNU GPL v3+. Please feel free to take it, modify it, package it etc.
  • Author: Richard Neill. Do ask if you would like further information and assistance.

Notes

This was written as part of my PhD InfraRed Camera system. These plot utilities are generally applicable.
The file proofs/cdsm-vs-linreg.py is part of the PhD, demonstrating why linear-regression beats correlated-double-sampling in some situations. It's irrelevant for general use.

Download

maths.tgz

Documents

Some selected files, from the tarball: Readme and Man-pages.
README.txt
dataplot.1
fftplot.1
linregplot.1
dat2wav.1
decimate.1

Navigation

Return to all programs, site home.