Skip to main content

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).

What it handles for you

  • Sparse CSR-on-mass-axis decoding (mass_bin / indptr / pixel_id / count).
  • count > 255 exceptions patched back in.
  • Absent @mass_bin_width_ps → treated as lossless (1).
  • Per-mode geometry: image_2d / depth_profile collapse to (ny, nx); mosaic tiles are stitched onto the stage grid → (gy*ny, gx*nx).
  • 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

simsh5-0.2.0.tar.gz (639.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

simsh5-0.2.0-py3-none-any.whl (7.6 kB view details)

Uploaded Python 3

File details

Details for the file simsh5-0.2.0.tar.gz.

File metadata

  • Download URL: simsh5-0.2.0.tar.gz
  • Upload date:
  • Size: 639.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for simsh5-0.2.0.tar.gz
Algorithm Hash digest
SHA256 c0099922a52ad3261dd1bf6d7c97978d03b8c24178f34db19759e44cdc0d2bbe
MD5 1d7e858d8c3876b5d2832b5b2be4ccc5
BLAKE2b-256 257889d9b59ae0e53215489c507758f0a6e4687c16e2c9db2effc7b736630945

See more details on using hashes here.

Provenance

The following attestation bundles were made for simsh5-0.2.0.tar.gz:

Publisher: publish.yml on PhysicalElectronics/simsh5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file simsh5-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: simsh5-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 7.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for simsh5-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0797312748c17f8e614e4dfd158a9873fb6c7d99dd30d990010f74caf8c1819e
MD5 1f460b37a213c4f6b3466dd52d6e0ef7
BLAKE2b-256 b5ecfa1fb33794442d079bfb1cd0282b35dfd96b7b5671d39d629196cc2fa205

See more details on using hashes here.

Provenance

The following attestation bundles were made for simsh5-0.2.0-py3-none-any.whl:

Publisher: publish.yml on PhysicalElectronics/simsh5

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page