No project description provided
Project description
niess
Table of Contents
Installation
pip install niess
License
niess is distributed under the terms of the BSD-3-Clause license.
Motivation
This package is intended to hold information about the Neutron Insruments of the European Spallation Source for use in defining Monte Carlo ray-tracing simulations, file-layout information for use by the ESS file-writers, and other yet-undefined uses; in a use-agnostic approach.
The information required about an instrument for McStas and NeXusStructure is
similar but not identical -- the latter attempts to hold all information needed to
produce a valid NeXus file, which requires geometry information inspired by the
McCode implementation used by McStas.
The two uses each have their own vocabulary, and the vocabulary used here is more
closely in line with that of McCode. The basic building block of the two uses
is the Comp in McCode and the NXclass in NeXus; here the term 'component' is
used to refer to such a building block.
Since there are sometimes slight differences between the 'same' Comp and NXclass
in how equivalent information is stored, niess is intended to be component-aware as
a single translation between the two is not possible globally.
Rather than attempting to store one implementation or the other, niess components
are an independent low-level representation of the properties of a component.
This representation can be written as a dictionary with pre-defined keys, and
it is intended that serializing to and deserializing from such a representation can be
used to provide calibrated instrument information to McStas and NeXusStructure.
Use
Thus far only as-designed information is provided for the BIFROST indirect geometry
multiplexing spectrometer. You can load this information in a Python script, and use
them to define a niess representation of the primary and secondary spectrometers
from niess.bifrost.parameters import primary_parameters, known_channel_params
from niess.bifrost import Primary, Tank
primary = Primary.from_calibration(primary_parameters())
secondary = Tank.from_calibration(known_channel_params())
The primary spectrometer begins at the source, here located at the nominal position of the viewed moderator in the Instrument Specific Coordinate System (ISCS), and ends with the position of the sample in the same coordinate system.
The secondary spectrometer is defined in a coordinate system relative to the sample position.
It is possible to convert the niess representations of these instrument parts to
their McCode representation and insert them into a McStas instrument by leveraging
an Assembler from the mccode_antlr package.
from mccode_antlr import Flavor
from mccode_antlr.assembler import Assembler
from mccode_antlr.reader import GitHubRegistry
from niess.bifrost.parameters import primary_parameters, tank_parameters
from niess.bifrost import Primary, Tank
registries = ['mcstas-chopper-lib', 'mcstas-transformer', 'mcstas-detector-tubes',
'mcstas-epics-link', 'mcstas-frame-tof-monitor', 'mccode-mcpl-filter',
'mcstas-monochromator-rowland', 'mcstas-slit-radial']
registries = [GitHubRegistry(
name,
url=f'https://github.com/mcdotstar/{name}',
filename='pooch-registry.txt',
version='main'
) for name in registries]
assembler = Assembler('bifrost', registries=registries, flavor=Flavor.MCSTAS)
Primary.from_calibration(primary_parameters()).to_mccode(assembler)
Tank.from_calibration(tank_parameters()).to_mccode(assembler, 'sample_coordinates')
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 niess-0.1.2.tar.gz.
File metadata
- Download URL: niess-0.1.2.tar.gz
- Upload date:
- Size: 112.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6eb2af81722705e759be754995b06ba074c1045e3e46130105051ef0b3066fa7
|
|
| MD5 |
a87fa3f4e53334dd0291b36dc9368f04
|
|
| BLAKE2b-256 |
fbff78882f89e8e72bd1cf416ad706601f7023a5f08915a86ea4f57158053a05
|
Provenance
The following attestation bundles were made for niess-0.1.2.tar.gz:
Publisher:
build-and-publish.yml on g5t/niess
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
niess-0.1.2.tar.gz -
Subject digest:
6eb2af81722705e759be754995b06ba074c1045e3e46130105051ef0b3066fa7 - Sigstore transparency entry: 767501267
- Sigstore integration time:
-
Permalink:
g5t/niess@420a87c26b0a72cc5d3c10fe7f986140f2db287e -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/g5t
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-and-publish.yml@420a87c26b0a72cc5d3c10fe7f986140f2db287e -
Trigger Event:
release
-
Statement type:
File details
Details for the file niess-0.1.2-py3-none-any.whl.
File metadata
- Download URL: niess-0.1.2-py3-none-any.whl
- Upload date:
- Size: 81.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5eaf1adffa4c6270dd43174fcca8a741546e5ca4a84f72dd77b9f2a42d5ffe56
|
|
| MD5 |
bf47ced41785e31dfdc775b7a1ae8670
|
|
| BLAKE2b-256 |
d037025a2e86ebe6ce01bebeac8c2bc87012cc5312d98269899c74c26526e0bd
|
Provenance
The following attestation bundles were made for niess-0.1.2-py3-none-any.whl:
Publisher:
build-and-publish.yml on g5t/niess
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
niess-0.1.2-py3-none-any.whl -
Subject digest:
5eaf1adffa4c6270dd43174fcca8a741546e5ca4a84f72dd77b9f2a42d5ffe56 - Sigstore transparency entry: 767501271
- Sigstore integration time:
-
Permalink:
g5t/niess@420a87c26b0a72cc5d3c10fe7f986140f2db287e -
Branch / Tag:
refs/tags/v0.1.2 - Owner: https://github.com/g5t
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
build-and-publish.yml@420a87c26b0a72cc5d3c10fe7f986140f2db287e -
Trigger Event:
release
-
Statement type: