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.5.dev0.tar.gz (1.2 MB 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.5.dev0-py3-none-any.whl (12.8 kB view details)

Uploaded Python 3

File details

Details for the file mcstastox-0.0.5.dev0.tar.gz.

File metadata

  • Download URL: mcstastox-0.0.5.dev0.tar.gz
  • Upload date:
  • Size: 1.2 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for mcstastox-0.0.5.dev0.tar.gz
Algorithm Hash digest
SHA256 e0bd5d065b98500c8eeda52f16bfd1916f6b3fec9e7f3b949c84949db9e7bd6d
MD5 80d63cf1e1d45342dc40f8a564e1cfa5
BLAKE2b-256 7d7512204f350dbe62238cd9128b53e8f7ade6bf2ec78fe0fcdc4b1a95278d4d

See more details on using hashes here.

File details

Details for the file mcstastox-0.0.5.dev0-py3-none-any.whl.

File metadata

  • Download URL: mcstastox-0.0.5.dev0-py3-none-any.whl
  • Upload date:
  • Size: 12.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.12.8

File hashes

Hashes for mcstastox-0.0.5.dev0-py3-none-any.whl
Algorithm Hash digest
SHA256 6c6749ccb7e48e71b0e024737d3cc2104af7672adfa79fbacc04122f16c78ef0
MD5 bfdaa739dcf7bec6b32471b0cde98442
BLAKE2b-256 ea2116ab7e407a766e5be5fddabd494dae3a4a69649d29bc478e9902bd5bfcf5

See more details on using hashes here.

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