Skip to main content

splotter

Read SPEC scan files from the command line: list the scans, pull values by column name, look up metadata, and draw mesh maps that combine several scans.

The name comes from splot, the plotting command in SPEC. splotter is an independent project and is not affiliated with or endorsed by Certified Scientific Software, the makers of SPEC.

Install

Requires Python 3.13 or newer.

pip install splotter

Try it

No measured data ships with splotter. splotter demo writes a made-up SPEC file, the same one every time, and the examples below run on it:

splotter demo demo.spec
Scan What it is
1 Mesh of sx and sy, with a bright spot at sx = 0.4, sy = -0.3
2 Mesh next to scan 1, overlapping it
3, 4 ascan of sx and of sy through the bright spot
5 Mesh aborted after 100 of its 231 points
6-8 Rocking scans of th, named by the scan list demo_fwhm.csv

Commands

Every command takes the path of the SPEC file first. splotter COMMAND --help lists the options.

Command What it does
splotter info Scan list, scan summary, values of one point, metadata, values by column name
splotter mesh Map of a counter over two motors, from one or several scans
splotter rock Normalized rocking curves on a log scale
splotter gamdel Measured gamma/delta against the arc of one 2theta (interactive)
splotter fwhm Gaussian FWHM of rocking scans against Q
splotter demo Write the made-up SPEC file

Look at scans

splotter info demo.spec --last 3      # scan number, start time, duration, points, command
splotter info demo.spec 1             # times, motors at the start, range of each counter
splotter info demo.spec 1 301         # time, motors and counters of point 301 (counted from 0)
splotter info demo.spec 1 --meta      # #T, #Q lines and the #UXML metadata
splotter info demo.spec --meta        # file header

Pull values by name

-c prints only the named data columns and motors, as a table. time gives the clock time of each point: the #D time of the scan plus the Epoch seconds since its first point. Names match without regard to case, spaces and underscores, so Sample_X also finds the Sample X of older files.

splotter info demo.spec 1 -c time Sample_X Sample_Y imtot
splotter info demo.spec 1 -c imtot Sample_X Sample_Y --top 5    # the 5 points largest in imtot
splotter info demo.spec 1 -c Sample_X imtot --csv > scan1.csv
splotter info demo.spec -c time Delta Gamma --last 3            # motors at the start of each scan
splotter info demo.spec 1 -c Delta Chi                          # motors that stay put: one row
splotter info demo.spec 1 --names                               # the names -c accepts

Draw mesh maps

splotter mesh demo.spec 1 --counter imroi3 --log
splotter mesh demo.spec 1 2 5 3 4 --log --save map.png

Scans share one set of axes and one color scale, and can be mesh, ascan or dscan scans.

  • Places that were not measured, including the missing points of an aborted scan, are hatched gray.
  • Where scans overlap, the run given later is drawn on top.
  • Each scan gets its own outline, named in the legend.
  • With --log, zero counts take the lowest color, so they do not look unmeasured.
  • The axes are Sample_X and Sample_Y unless --x and --y name other motors.

Rocking curves and peak widths

splotter rock demo.spec 6 7 8 --counter imroi3
splotter gamdel demo.spec 6 7 8
splotter fwhm demo.spec demo_fwhm.csv --energy 8 --counter imroi3

The scan lists for fwhm are CSV files without a header, with the columns scan, gamma, delta, theta.

Files from different years

The parser was checked on some 3,600 SPEC files from 2005 to 2026:

  • Names may contain one space (Sample Y). Two spaces or a tab separate them.
  • A SPEC session that restarts inside a file brings a new header, and its motors apply from there.
  • When a restart reuses a run number, the plain number means the last such scan and 12.1, 12.2 name each one. splotter info FILE lists them that way.
  • Lines between the data that are not a row of the #L columns, such as macro output, are skipped.
  • Files before 2015 have no imtot, so splotter mesh needs --counter. --names lists the options.

Python

from splotter.spec import Spec

with Spec("demo.spec") as spec:
    scan = spec.get_scan(1)
    scan.command, scan.time, scan.motors["Delta"]
    df = scan.to_dataframe()  # columns named as in #L
    scan.uxml  # #UXML as a dict

Status

Alpha. The tests run on generated data (splotter demo and tests/synthetic_spec.py). The parser was also run on the measured files of one beamline, so other SPEC setups may differ, in particular in motor names.

QoraGeom has its own, extended copy of this parser as qorageom.spec.

Development

uv sync
uv run pytest
uv run ruff check
uv run ruff format --check

License

MIT, see LICENSE.

Metadata

Release files for splotter 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for splotter 0.1.0
File Size Uploaded Provenance Actions
splotter-0.1.0.tar.gz 19.9 kB With provenance Details for splotter-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for splotter 0.1.0
File Interpreter ABI Platform Actions
splotter-0.1.0-py3-none-any.whl Python 3 none any Details for splotter-0.1.0-py3-none-any.whl

Total release size: 44.1 kB

Release files / splotter-0.1.0.tar.gz

Download URL splotter-0.1.0.tar.gz
Size 19.9 kB
Tags Source
SHA-256 checksum
How to use checksums
6494c9257039c9856fac126c377914e92081fe8016fc846d13d16aac72acde79
BLAKE2b-256 checksum
How to use checksums
f559467ca08582ec7219b01d63ece979dade1a7a0f91b15f31df355f5980a420
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Release files / splotter-0.1.0-py3-none-any.whl

Download URL splotter-0.1.0-py3-none-any.whl
Size 24.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
424e7a3174ef1374eea2fef30679576fbc6334b02b99428ca9243ad5c5d3230e
BLAKE2b-256 checksum
How to use checksums
117d071f7a70f951a3393a8fd57db2f1a0af05f5ec9733f160e99cd0e767d708
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

Security for splotter 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for splotter-0.1.0.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 1, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page