Skip to main content

Contributor Covenant PyPI badge Anaconda-Server Badge License: BSD 3-Clause

McStasToX

About

Python package to read McStas data and export as python objects in different formats or as other files.

DISCLAIMER: This project is still at prototype stage

The current version of the code is supposed to be a starting point to figure out how such a package should be structured, especially with regards to the API for the user. The demo notebook shows how the package can be used.

Dependencies

The core package only depends on

  • h5py
  • numpy

The different export formats, such as scipp, should not be core dependencies but only used when exporting to that format.

To run the demo notebook one will need

  • Recent McStas through conda (>3.5.20)
  • mcstasscript
  • matplotlib
  • scipp
  • scippneutron
pip install mcstastox

Installation

Note that still an early version of the package is on pip, but the API is not stable yet.

python -m pip install mcstastox

Basic use

To for example export to scipp, one needs to specify which component is the source and which is the sample.

Then all monitors with pixel id's are loaded, this is purely supported by Monitor_nD with option strings such as:

square x bins=512 y bins=256, neutron pixel min=0 t, list all neutrons
square x bins=1024 y bins=512, neutron pixel min=131073 t, list all neutrons

The next pixel min should be large enough to accommodate all pixels of the previous monitors, so here above 512*256.

This data can then be loaded to a simple scipp object with:

import mcstastox
with mcstastox.Read(file_path) as loaded_data:
    scipp_data = loaded_data.export_scipp_simple(source_name="source", sample_name="sample_position")

This data can also be loaded to a scipp data group with:

import mcstastox
with mcstastox.Read(file_path) as loaded_data:
    scipp_data_group = loaded_data.export_scipp(source_name="source", sample_name="sample_position")

This takes less space and events are already grouped by pixel ids

Release files for mcstastox 0.0.12

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

Source distribution (sdist)

Source distribution for mcstastox 0.0.12
File Size Uploaded
mcstastox-0.0.12.tar.gz 43.5 kB Details

Built distribution (wheel)

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

Total release size: 58.1 kB

Release files / mcstastox-0.0.12.tar.gz

Download URL mcstastox-0.0.12.tar.gz
Size 43.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8ebf3023d06e4a762cfdf5d84925b23d5b8dd396e703fa40477ac205672bb074
BLAKE2b-256 checksum
How to use checksums
cfb23a55993dd90bbaec165504c169a04004254240eef8e8ffaa8e49973d52ca
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 20, 2026.

Transparency log

Release files / mcstastox-0.0.12-py3-none-any.whl

Download URL mcstastox-0.0.12-py3-none-any.whl
Size 14.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
ad963f01378bb05a56b405fe471ef9bc637cf75326448f2549ae46e64d18d30e
BLAKE2b-256 checksum
How to use checksums
1a848c38176f97ee333c5b0d3f003548718ee87abdac67d4a2d5c00183c872bf
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

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 Apr 20, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.0.12 This release

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.0

2 release files

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