Reader and analysis recipes for open SIMS-H5 (tof-sims-sparse-hdf5) TOF-SIMS data
Project description
simsh5
Reader and analysis recipes for open SIMS-H5 (tof-sims-sparse-hdf5) TOF-SIMS
data. Small and dependency-light — a SIMS-H5 archive is self-contained, so reading
it needs only numpy + h5py (plus hdf5plugin for the compression filters).
The file format is defined in
open_tof_sims_format;
this library implements the §10 analyst recipes behind a small API.
Install
pip install simsh5 # core reader (numpy + h5py + hdf5plugin)
pip install "simsh5[notebook]" # + matplotlib/Jupyter for examples/
Usage
import simsh5
arc = simsh5.open_archive("scan.h5") # or use as a context manager
print(arc.acquisition_mode, arc.polarity, arc.row_shape)
img = simsh5.total_ion_image(arc) # total counts; (ny, nx), or stitched mosaic
mz, intensity = simsh5.total_spectrum(arc) # summed spectrum
fe = simsh5.ion_image(arc, 55.0, 57.0) # ion image for an m/z window
mz_p, counts_p = simsh5.spectrum_at_pixel(arc, 0)
arc.close()
For depth_profile archives, simsh5.depth_profile(arc) returns
(sputter_time_s, counts_per_cycle).
For mosaic archives, total_ion_image / ion_image stitch the tiles onto
the stage grid using /mosaic/tile_index_xy, returning a (gy*ny, gx*nx) panorama
(e.g. a 6×6 grid of 256×256 tiles → (1536, 1536)) rather than (ny, nx).
Images use a lower-left origin (PHI convention: row 0 is the bottom row), so
display them with plt.imshow(img, origin="lower"). Both image recipes accept
bin_factor=N to sum non-overlapping N×N pixel blocks (2→1, 4→1, …; must divide
the image dimensions) for coarser, higher-SNR images.
What it handles for you
- Sparse CSR-on-mass-axis decoding (
mass_bin/indptr/pixel_id/count). count > 255exceptions patched back in.- Absent
@mass_bin_width_ps→ treated as lossless (1). - Per-mode geometry:
image_2d/depth_profilecollapse to(ny, nx);mosaictiles are stitched onto the stage grid →(gy*ny, gx*nx)(lower-left origin). - Optional
bin_factorpixel binning ontotal_ion_image/ion_image. - Quadratic m/z calibration (
tof_ps_to_mz/mz_to_tof_ps).
Development
pip install -e ".[dev]"
ruff check . && mypy && pytest
Tests run against any tests/fixtures/*.h5 archive (an image_2d sample and a
synthetic mosaic are bundled).
License
MIT — see LICENSE.
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 simsh5-0.3.0.tar.gz.
File metadata
- Download URL: simsh5-0.3.0.tar.gz
- Upload date:
- Size: 640.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10d09bcf5a5abadd6bd9761ef14c683545d0982aa76d0f51dda1f49f8fe84be2
|
|
| MD5 |
cca27acfbbe4f13347d0a3650adcffb1
|
|
| BLAKE2b-256 |
cde60c2c8e522dac321da233d49678f01ebfb9c53873fea90079c5411d6eaef5
|
Provenance
The following attestation bundles were made for simsh5-0.3.0.tar.gz:
Publisher:
publish.yml on PhysicalElectronics/simsh5
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simsh5-0.3.0.tar.gz -
Subject digest:
10d09bcf5a5abadd6bd9761ef14c683545d0982aa76d0f51dda1f49f8fe84be2 - Sigstore transparency entry: 1782482515
- Sigstore integration time:
-
Permalink:
PhysicalElectronics/simsh5@afc6518a961b28438aa1a4aec183d11b9ce92a44 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/PhysicalElectronics
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@afc6518a961b28438aa1a4aec183d11b9ce92a44 -
Trigger Event:
push
-
Statement type:
File details
Details for the file simsh5-0.3.0-py3-none-any.whl.
File metadata
- Download URL: simsh5-0.3.0-py3-none-any.whl
- Upload date:
- Size: 8.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
dcaa6194e6febac90402b8b0fee9b3d331bc27a9a695908fb7253653d3a4fe31
|
|
| MD5 |
807e3c83e4759ce87bcd68ff7bf2a735
|
|
| BLAKE2b-256 |
46576e9e3acc3c54f09ea43328c187b5e437a5739a7d00e3a143688addb57960
|
Provenance
The following attestation bundles were made for simsh5-0.3.0-py3-none-any.whl:
Publisher:
publish.yml on PhysicalElectronics/simsh5
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simsh5-0.3.0-py3-none-any.whl -
Subject digest:
dcaa6194e6febac90402b8b0fee9b3d331bc27a9a695908fb7253653d3a4fe31 - Sigstore transparency entry: 1782482601
- Sigstore integration time:
-
Permalink:
PhysicalElectronics/simsh5@afc6518a961b28438aa1a4aec183d11b9ce92a44 -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/PhysicalElectronics
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@afc6518a961b28438aa1a4aec183d11b9ce92a44 -
Trigger Event:
push
-
Statement type: