Loading...
 

AllPlot

DescriptionSupportInstallationOptional FeaturesFile Formats
AllPlot 3.0
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 3.1 is now available. It greatly simplifies installation on Mac and Windows.

Several minor bugs have been fixed. On Mac the distributions are code-signed and notarized, so they ruth without security concerns. On Windows the installer has been recognized by Microsoft as "safe", and runs without security concerns.

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.

NOTE: For Root input, versions of AllPlot before 26-AUG-2022 did not work with Root v6.26 or later (because Root changed the Python interface). This update detects the Root version and should work for all reasonably-recent versions of Root.

AllPlot 2.0 is a major refactoring of the code. It now has an API that is used by File/SaveConfig and File/LoadConfig to save and restore the current configuration as a Python program. The Python file can be edited and combined with other Python code. See Help/AllPlotAPI in the GUI.

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 and must have uniform sampling.
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 AllPlot.zip will detect Python 2 and attempt to find Python 3 and use it.

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 filename 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 TFile (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.

Installation

AllPlot 3.1

Standard install packages are available for Mac and Windows. These include a private version of Python3 and all Python modules required, so it should just run, independent of how Python is installed into your system. The install packages do not support Root input files.

NOTE: the install packages are large because they contain Python3 and many modules; AllPlot can take up to a minute to start up. The source .zip is much smaller and starts more quickly, but you must manually install all prerequisites.

Mac — Monterey (12.6.7) and later

Simply download the correct installer for your system, open it, and drag AllPlot into your Applications folder; you can then put it into your Dock, if desired:
    AllPlot-3.1-MacIntel.dmg for Macs with an Intel Processor
    AllPlot-3.1-MacM1.dmg for Macs with an Apple M1 or M2 processor
These packages are code-signed by Tom Roberts and notarized by Apple, so they should run without any security issues. The first time you run it, you do need to authorize running a program downloaded from the Internet.

Windows 10

Simply download the installer and run it in the usual way; it will put shortcuts onto the Desktop and into the Start Menu:
    AllPlot-3.1-Windows10.msi

Windows 11

The Windows 10 installer works on Windows 11, but the Edge browser refuses to let you run it — with expertise you can get around that. It is much simpler to use Firefox or Chrome to download it, as it installs and runs just fine. You may have to click "more info" and "Run Anyway" in a Windows Defender pop-up.

Update July 30,2023: I reported the AllPlot Windows installer to Microsoft as "safe". They agreed and removed the block. So now Edge, Firefox, and Chrome can all download and install AllPlot on Windows 10 and 11, without any security pop-ups.

(It's rather remarkable that Microsoft is keeping a worldwide database of "safe" downloads, and both their Edge browser and Microsoft Defender, on every WIndows machine in the world, query it for every download.)

Source (can support Root input files)

AllPlot.zip
On Linux and Mac this is an executable file (but you must "chmod +x AllPlot.zip"). Or run it: "python3 /path/to/AllPlot.zip".
This source should run on essentially any OS with Python3; that includes Mac, Windows, and all flavors of Linux.

Prerequisites:

Before running AllPlot from source you must install the following standard Python modules:
    numpy, matplotlib, tkinter
Note these often come 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 text files. If Pandas is not installed, a slower numpy routine is used. "python3 -m pip install pandas"

NOTE: using the "pip" or "pip3" command can sometimes install modules into the wrong version of Python, causing confusion. Using "python3 -m pip" avoids that.

Optional Features:

To enable fitting to plots:
        python3 -m pip 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, set ROOTSYS to point to your Root installation and try: python3 -m pip install pyroot
On macOS, if you installed Python3 via HomeBrew, install Root via HomeBrew as well, or it won't install pyroot into Python3.

The most common problems getting AllPlot to run via source are due to having multiple installations of Python, and intermixing versions when installing additional modules. In particular, "pip" and/or "pip3" may not be associated with the same Python that runs when you type "python3". To avoid this, instead of using "pip3" use "python3 -m pip" — this ensures installation into that version of Python.

 

[+] AllPlot 2.1