Skip to main content

Tool to read McStas NeXus data and export contained information

Project description

McStasToX

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

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

Install

An early version of the package is on pip, but the API is not stable yet.

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 stings 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 accomodate all pixels of the previous monitors, so here above 512*256.

This data can then be loaded 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")

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

mcstastox-0.0.9.tar.gz (15.0 kB view details)

Uploaded Source

Built Distribution

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

mcstastox-0.0.9-py3-none-any.whl (10.6 kB view details)

Uploaded Python 3

File details

Details for the file mcstastox-0.0.9.tar.gz.

File metadata

  • Download URL: mcstastox-0.0.9.tar.gz
  • Upload date:
  • Size: 15.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for mcstastox-0.0.9.tar.gz
Algorithm Hash digest
SHA256 4e4c744848af56da0e767a91ed3c3061085b420379520a7687d9249452a822ee
MD5 73927a1592a45d0a6bf73d66cfafe4ac
BLAKE2b-256 924e2aacb111bf0b405e1066e33101dfd566bdb5a17952bc046031d19f17a6df

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcstastox-0.0.9.tar.gz:

Publisher: pypi.yml on mccode-dev/McStasToX

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

File details

Details for the file mcstastox-0.0.9-py3-none-any.whl.

File metadata

  • Download URL: mcstastox-0.0.9-py3-none-any.whl
  • Upload date:
  • Size: 10.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.0.1 CPython/3.12.8

File hashes

Hashes for mcstastox-0.0.9-py3-none-any.whl
Algorithm Hash digest
SHA256 93cdd20829d577c55b346c4f0d226759dd5dfbfb38c29470c08038d6d519ed4a
MD5 a04641c06d8438599ae332111bb11192
BLAKE2b-256 3cd832b1c7d634c5af00c0b9bf0a32bc07a8cf838a699c5d9380b965a1c5c0e2

See more details on using hashes here.

Provenance

The following attestation bundles were made for mcstastox-0.0.9-py3-none-any.whl:

Publisher: pypi.yml on mccode-dev/McStasToX

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