GRAMS SPC file reader for Python
Project description
SPCfile - An SPC file reader in Python
A modern reader for GRAMS/Thermo-Galactic SPC files - a widely used file format in spectroscopy.
Installation
Requires Python >= 3.9 and NumPy. Install directly from this repository using pip:
pip install git+https://github.com/kogens/spcfile.git
Features
SPCfile focuses on a small, practical API for loading SPC files into NumPy arrays. It aims to make common spectroscopy workflows easy (load → inspect metadata → work with x/y arrays), while keeping the implementation straightforward and well-tested.
Supported SPC formats
Currently supported:
- New-format SPC (512-byte header):
0x4B(little-endian, tested) and0x4C(big-endian, supported but not currently tested due to lack of sample files) - X modes: implicit evenly-spaced X, explicit global X (
TXVALS), and per-subfile X/Y (TXYXYS/ "XYXY") - Multifile (
TMULTI) and minimal 4D metadata:.z/.wexpose per-subfile coordinates and.w_planesexposes the plane count - Log text block is read when present
Usage examples
from spcfile import SPCFile
# Load multifile with a shared X axis
spc = SPCFile("multifile.spc")
print(spc)
SPC File: multifile.spc
Date: 2021-03-15 09:21:00
Subfiles: 1
Points per subfile: 1776
Experiment type: General
Units: X='Wavenumber (cm^-1)', Y='Transmittance', Z='Arbitrary', W='Arbitrary'
Datapoints and coordinates are easily accessible as attributes of the SPCFile object:
# Access X, Y, Z values (represented as numpy arrays)
x = spc.x
y = spc.y
z = spc.z
# Subfiles can be indexed like a list
subfile0 = spc[0]
y0 = subfile0.y
Limitations
SPCfile currently rejects old-format 0x4D SPC files.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file spcfile-0.1.0.tar.gz.
File metadata
- Download URL: spcfile-0.1.0.tar.gz
- Upload date:
- Size: 18.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9d72c22d9f1951f384e1990ea816f819553a08263ba5ec8fb4bb18e969f2e21b
|
|
| MD5 |
9b016bcf875e507c64466b4050ab7387
|
|
| BLAKE2b-256 |
5eed60e602c430d852f6ec436bce0a42ce4f1399812b39fc1954516c80cc3f09
|
File details
Details for the file spcfile-0.1.0-py3-none-any.whl.
File metadata
- Download URL: spcfile-0.1.0-py3-none-any.whl
- Upload date:
- Size: 14.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e031facb7e242431722619e7f45289f376fe826c2aa4e8d3771731f05ed7c1bd
|
|
| MD5 |
c8a61e8a5ab37af4cba77a93b08d87f4
|
|
| BLAKE2b-256 |
ed65ca6a019e707289c477d44043d25cc54f668cbeec46398fdcfa31d7611611
|