Permalink
Browse files

Move README to ReST format.

  • Loading branch information...
1 parent f443fbf commit c534b0356f0b58c71d75b6d3f02b82202ee8af20 Leif Johnson committed Jan 22, 2014
Showing with 44 additions and 34 deletions.
  1. +0 −1 MANIFEST.in
  2. +43 −32 README.md → README.rst
  3. +1 −1 setup.py
View
@@ -1 +0,0 @@
-include README.md
@@ -1,22 +1,26 @@
-# py-plot
+py-plot
+=======
A command-line tool for creating plots from data in text files.
-## Installation
+Installation
+------------
-With `pip`:
+With `pip`::
pip install lmj.plot
-Or, clone this repository and put the plot script somewhere in your `PATH`:
+Or, clone this repository and put the plot script somewhere in your `PATH`::
- git clone http://github.com/lmjohns3/py-grep-plot
- export PATH=$PATH:$(pwd)/py-grep-plot/scripts
+ git clone http://github.com/lmjohns3/py-plot
+ cd py-plot
+ python setup.py develop
-## Usage
+Usage
+-----
Let's say you're running an experimental algorithm, and you put accuracy values
-in a log file as the experiments run. Here's a snippet from an example log file:
+in a log file as the experiments run. Here's a snippet from an example log file::
D 2012-03-19 15:02:35,181 decoded p-a-n-c-r-e-a-t-i-c in 4058ms
D 2012-03-19 15:02:35,365 tags p-ae2-n-k-r-iy0-ae1-t-ih0-k, best p-ae1-n-k-er0-_-eh1-th-iy0-_
@@ -29,31 +33,32 @@ in a log file as the experiments run. Here's a snippet from an example log file:
D 2012-03-19 15:02:36,540 tags s-p-ih1-t-s-l-_-iy0, best s-p-ey1-t-ah0-l-_-iy0
All of those "training accuracy" lines hidden in there will give us a good idea
-of how well the algorithm is performing. To get a quick plot of them:
+of how well the algorithm is performing. To get a quick plot of them::
- cat ~/Experiments/tagger-beam1.log | py-grep-plot -m 'training accuracy: (\S+)'
+ cat ~/Experiments/tagger-beam1.log | lmj-plot -m 'training accuracy: (\S+)'
If you have your matplotlib configured with an interactive backend, you should
see a nice little plot appear.
-The general usage of the script is
+The general usage of the script is::
- py-grep-plot [--match RE] < FILE
+ lmj-plot [--match RE] --input FILE
-Basically, you provide a bunch of data on stdin, and, optionally, a regular
-expression that specifies how to extract data from the files. The plotting
-script will check the regular expression against each input line, parsing out
-numerical values from those that match. Each matched value will be included in
-the plot.
+Basically, you provide a bunch of data in some sort of file (defaults to stdin),
+and, optionally, a regular expression that specifies how to extract data from
+the files. The plotting script will check the regular expression against each
+input line, parsing out numerical values from those that match. Each matched
+value will be included in the plot.
-### Multiple values
+Multiple values
+~~~~~~~~~~~~~~~
If you just provide one match group in your regular expression, the matched
values will be plotted on the ordinate, in data-file order. If you want explicit
control over the abscissa, just include another match group in your regular
-expression:
+expression::
- nl ~/Experiments/tagger-beam1.log | py-grep-plot -m '^(\d+) .* training accuracy: (\S+)'
+ nl ~/Experiments/tagger-beam1.log | lmj-plot -m '^(\d+) .* training accuracy: (\S+)'
(The `nl` utility numbers the lines of the input file.)
@@ -64,51 +69,57 @@ using a shaded polygon instead of bars on the data points.
To get even more sophisticated, name your match groups to specify them in an
alternate order. For instance, if your log file had `0.33 +/- 0.01` you could
-include error bars like so:
+include error bars like so::
- nl ~/Experiments/tagger-beam1.log | py-grep-plot -m \
+ nl ~/Experiments/tagger-beam1.log | lmj-plot -m \
'^(?P<x>\d+) .* training accuracy: (?P<y>\S+) ... (?P<ey>\S+)'
You can specify match groups for `x`, `y`, `ex` (error in the abscissa) and `ey`
(error in the ordinate).
-### Multiple series
+Multiple series
+~~~~~~~~~~~~~~~
You can also provide multiple input files, and the script will show multiple
-data series on the same plot:
+data series on the same plot::
- py-grep-plot [--match RE] FILE...
+ lmj-plot [--match RE] --input FILE...
By default, each file will use the same regular expression for matching data.
-#### Multiple series from one file
+Multiple series from one file
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Alternatively, you can specify just one data file and multiple regular
expressions. For instance, let's say you have one log file that contains
`training accuracy: XX` and `evaluation accuracy: XX` lines that you'd like to
-plot. You can grab these lines and put them in separate series on your plot:
+plot. You can grab these lines and put them in separate series on your plot::
- py-grep-plot -m 'training accuracy: (\S+)' 'evaluation accuracy: (\S+)' < training.log
+ py-grep-plot -m 'training accuracy: (\S+)' 'evaluation accuracy: (\S+)' \
+ --input training.log
In this case, it's probably easier to pass input to the script using a shell
redirection, because the `-m` option will slurp up anything that comes after it
(that's not itself a flag).
-### Smoothing
+Smoothing
+~~~~~~~~~
You can smooth the ordinates by using either the `-s N` (`--smooth N`) or the
`-b N` (`--batch N`) options. The `--smooth` option convolves a rectangular
filter over the data values before plotting, which yields smoother curves but
has edge effects. The `--batch` option groups the input data and plots just the
mean and standard deviation of each group.
-### Other options
+Other options
+~~~~~~~~~~~~~
There are several other command-line options, including some basic controls for
-the plot colors and styles, X- and Y-axis limits, ; use `--help` to get an
+the plot colors and styles, X- and Y-axis limits; use `--help` to get an
overview.
-## License
+License
+-------
(The MIT License)
View
@@ -11,7 +11,7 @@
author='Leif Johnson',
author_email='leif@leifjohnson.net',
description='A command line tool for plotting data from text files',
- long_description=open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'README.md')).read(),
+ long_description=open(os.path.join(os.path.dirname(os.path.abspath(__file__)), 'README.rst')).read(),
license='MIT',
url='http://github.com/lmjohns3/py-plot',
keywords=('plots '

0 comments on commit c534b03

Please sign in to comment.