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 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
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 mcstastox-0.0.11.tar.gz.
File metadata
- Download URL: mcstastox-0.0.11.tar.gz
- Upload date:
- Size: 1.4 MB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
334eb121d30b10a01fd306a80c94ce8194b223f6f17939fdbe32828f850aee78
|
|
| MD5 |
19bed3f0b0a65030539590117e2a4e88
|
|
| BLAKE2b-256 |
947c1e4cdde1c6cd9f5f8d7eb7ea30b94a96743b691ffcf21d39738bae8d523a
|
Provenance
The following attestation bundles were made for mcstastox-0.0.11.tar.gz:
Publisher:
pypi.yml on mccode-dev/McStasToX
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcstastox-0.0.11.tar.gz -
Subject digest:
334eb121d30b10a01fd306a80c94ce8194b223f6f17939fdbe32828f850aee78 - Sigstore transparency entry: 187708562
- Sigstore integration time:
-
Permalink:
mccode-dev/McStasToX@31db5abe860029af9435a6083dff5f227498e9f3 -
Branch / Tag:
refs/tags/v0.0.11 - Owner: https://github.com/mccode-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@31db5abe860029af9435a6083dff5f227498e9f3 -
Trigger Event:
push
-
Statement type:
File details
Details for the file mcstastox-0.0.11-py3-none-any.whl.
File metadata
- Download URL: mcstastox-0.0.11-py3-none-any.whl
- Upload date:
- Size: 12.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.12.8
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3930b1dde89d76d874c39a79174c54f5d6ffb7f30e0a5d98e202c0d3587dd306
|
|
| MD5 |
c5c989d51e66de33ededd5827d7ca168
|
|
| BLAKE2b-256 |
2c84bf52c544b5ff109054740473240824336b6cb82dfbe796a4c03d00b8b6cd
|
Provenance
The following attestation bundles were made for mcstastox-0.0.11-py3-none-any.whl:
Publisher:
pypi.yml on mccode-dev/McStasToX
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mcstastox-0.0.11-py3-none-any.whl -
Subject digest:
3930b1dde89d76d874c39a79174c54f5d6ffb7f30e0a5d98e202c0d3587dd306 - Sigstore transparency entry: 187708568
- Sigstore integration time:
-
Permalink:
mccode-dev/McStasToX@31db5abe860029af9435a6083dff5f227498e9f3 -
Branch / Tag:
refs/tags/v0.0.11 - Owner: https://github.com/mccode-dev
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi.yml@31db5abe860029af9435a6083dff5f227498e9f3 -
Trigger Event:
push
-
Statement type: