Loading...
 

AllPlot

DescriptionSupportInstallationOptional FeaturesFile Formats
AllPlot 1.1
Copyright © 2020-2022 by Tom Roberts
All rights reserved.
This program is Open Source and may be redistributed in accordance with the Gnu Public License v3.


AllPlot is a general-purpose plotting program designed to read common data file formats and to easily display plots that are commonly used in physics analyses. It is implemented in Python, making it portable to essentially all modern systems; its only prerequisites are Python 3 and readily-available Python modules.

Data file formats:

textspace/tab separated (.txt) or comma separated (.csv)
numpy(.npz)
Root(.root)    (you must install pyroot)


A data file consists of multiple rows (events), each with the same number of columns (fields). Columns have names, and many plots can display arithmetic expressions involving those names and common math functions. The column 'N' is generated for each data file, containing the row number for each row (starting with 0). If column names are not found in the file, 'c1', 'c2', ... are used.

Each data file is displayed in its own window; each plot is displayed in a tab of its data-file window. The tab can be clicked to select it and display its plot; Ctrl-Tab and Ctrl-Shift-Tab move between tabs (and their plots).

Plots:

Selection PlotA plot of one column vs Time (if present) or N. The middle mouse button can be clicked and dragged  to define a range in Time or N; all other plots in this window will use only the data in that range.
Simple Data PlotPlot one column vs Time (if present) or N.
HistogramHistogram of an expression, with optional statistical errorbars, weight, and cut (logical expression).
XY plotPlot one expression vs another expression, with optional cut and errorbars. For a scatterplot set its style to use no line and an appropriate marker.
FFTFast Fourier Transform of an expression, with optional windowing. A Time column is required.
CorrelationPlot the correlation of one expression with itself or with another expression.
Allan DeviationPlot the Allan deviation of an expression.  A Time column is required.


The above plots show a single plot; the following combine multiple plots:

Combo PlotPlot multiple existing plots on a single axes. Each plot uses its current style.
Quad PlotPlot four common plots of one column: Data, FFT, Histogram, and Allan Deviation. A Time column is required.
Compare PlotPlot up to 8 plots vertically in a single frame, with X axes aligned. Each plot uses a separate axes and its current style.


Each plot has an editable Style (color, solid/dotted/dashed, point markers), with title and labels for X and Y axes, optional log scaling for X and Y axes, and optional gridlines. Each plot can be auto-scaled (default), or the user can set specific limits in X and Y.

In most plots, the user can left-click and drag to define a rectangle, and the plot will be zoomed-in to it. Successive zooms are remembered, and Right-Click will pop back one level.

Arithmetic functions usable in expressions: abs, arccos, arccosh, arcsin, arcsinh, arctan, arctan2, arctanh, min, max, ceil, floor, cos, cosh, deg2rad, degrees, exp, exp2, fabs, log, log10, log2, power, rad2deg, sin, sinh, sinc, sqrt, tan, tanh, hypot.

This program is written in Python 3, and extensively uses Numpy arrays and array operations for efficiency. Note that all data files must fit in memory simultaneously, as well as intermediate array values.

NOTE: AllPlot won't run with Python 2; use Python 3. Python 2.7 is past end-of-life. Note, however, that main.py will detect Python 2 and attempt to find Python 3 and use it.

Installation

Before running AllPlot you must install the following standard Python modules:
    numpy, matplotlib, tkinter
Note these are often installed with Python, and sometimes cannot be installed via pip3; some may already be installed.

NOTE: installing Pandas will speed up reading text files by more than a factor of 10, and is VERY worthwhile if you use large files. If Pandas is not installed, a slower numpy routine is used. "pip3 install pandas"

Installation on Mac and Linux

  1. download AllPlot.zip into a directory in your PATH
  2. chmod +x AllPlot.zip
AllPlot.zip is an executable file on its own; it will find the Python interpreter as long as either python or python3 is Python 3 and in your PATH.

Alternate for Mac and Linux:

Download AllPlot.zip to any convenient folder and link AllPlot.zip to "$HOME/bin/allplot" for convenience from the command-line. $HOME/bin should be in your PATH. chmod +x AllPlot.zip

Alternate for Mac and Linux:

Download AllPlot.zip to any convenient folder and use the command "python /path/to/AllPlot.zip" (no chmod needed).

Installation on Windows

Download AllPlot.zip to a convenient folder. Create a shortcut to run "python \path\to\AllPlot.zip", and put it into the Start menu.

Optional Features:

To enable Allan Deviation plots:
        pip3 install allantools
To enable fitting to plots:
        pip3 install scipy
To read Root Files:
        install Root in the usual way for your platform --  that should include the ROOT Python module, pyroot.
        If not, try: pip3 install pyroot
On macOS, if you installed Python3 via homebrew, install Root via HomeBrew as well, or it won't install pyroot into Python3.

Support

Questions about AllPlot can be discussed on the G4beamline forum.
You may request to join the forum: mailto:g4beamline+subscribe@muonsinc.com.

File Formats

Text File

The "Text File Input" automatically detects whether the file is space delimited (typically .txt) or comma delimited (typically .csv). This is determined by the file contents, not the extension (which can be anything).

Text File, Space Delimited:
Columns are delimited by one or more spaces and tabs. Comment lines begin with '#'. If the file begins with a series of comments, the file is read until the first non-comment line, which determines whether it is space- or comma-delimited, and also the number of columns. The column names come from the first initial comment line containing the same number of names, each of which is a valid Python identifier.

Text File, Comma Delimited:
When the first non-comment line in the file is comma delimited, it can contain column names enclosed in single- or double-quotes; each must be a valid Python identifier. Multiple, balanced quotes can be used (e.g. in files written by Excel).

Numpy file:

Numpy zip files can be read. Their format is a Python dictionary with key being the column name and value being a 1-d Numpy array with dtype=float32 or dtype=float64. All columns must have the same length (>1). There can also be parameters in the dictionary (value is a single float32 or float64), and a comment (value is a string of arbitrary length).

Root File:

AllPlot will read TNtuple-s from a Root file (other object types are ignored, except directories). TNtuple-s inherently have named columns (fields) and multiple rows (events). In particular, Root files written by G4beamline can be read in full. See the Root documentation for details.