Skip to main content

niess

PyPI - Version PyPI - Python Version


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

niess describes an instrument once, as calibration data, and emits it as a McStas instrument, ESS NeXus Structure JSON, or CAD geometry:

from mccode_antlr import Flavor
from mccode_antlr.assembler import Assembler
from niess.bifrost import Primary, Tank
from niess.bifrost.parameters import primary_parameters, tank_parameters
from niess.nexus import to_nexus_structure
from niess.nexus.bifrost import BIFROST_REGISTRY

assembler = Assembler('bifrost', flavor=Flavor.MCSTAS)
Primary.from_calibration(primary_parameters()).to_mccode(assembler)
Tank.from_calibration(tank_parameters()).to_mccode(assembler, 'sample_origin')

structure = to_nexus_structure(
    assembler.instrument, origin='sample_origin', registry=BIFROST_REGISTRY,
)

Full documentation, including how to translate an existing McStas .instr into a niess submodule and how to write your own NeXus translators, is at https://mcdotstar.github.io/niess/.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

niess-0.6.0.tar.gz (449.2 kB view details)

Uploaded Source

Built Distribution

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

niess-0.6.0-py3-none-any.whl (162.3 kB view details)

Uploaded Python 3

File details

Details for the file niess-0.6.0.tar.gz.

File metadata

  • Download URL: niess-0.6.0.tar.gz
  • Upload date:
  • Size: 449.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for niess-0.6.0.tar.gz
Algorithm Hash digest
SHA256 0fda14ab13471642560b02ef063aa8e985ec574a102697ea46f6df8c1e84d9f0
MD5 c46368f4d99693ef6a1c9df74fe1cf19
BLAKE2b-256 9208a9969b400cd230ea34ffd930bbbdd3354bf52d32eddfbf32f61402b37b7c

See more details on using hashes here.

Provenance

The following attestation bundles were made for niess-0.6.0.tar.gz:

Publisher: build-and-publish.yml on mcdotstar/niess

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

File details

Details for the file niess-0.6.0-py3-none-any.whl.

File metadata

  • Download URL: niess-0.6.0-py3-none-any.whl
  • Upload date:
  • Size: 162.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for niess-0.6.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d6d5e87aa046973d23c8ff3e7b91989313a0a6cd2480f2c2ed356a0025faa15d
MD5 62dcd6686863aede183569f786da592a
BLAKE2b-256 78cd52f833f7598c4f8446563c22c9b90844fece5edb5730176d9e53e7190c8d

See more details on using hashes here.

Provenance

The following attestation bundles were made for niess-0.6.0-py3-none-any.whl:

Publisher: build-and-publish.yml on mcdotstar/niess

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

Release history Release notifications | RSS feed

This release

0.6.0 This release

2 files

0.5.0

2 files

0.4.0

2 files

0.3.3

2 files

0.3.2

2 files

0.3.1

2 files

0.3.0

2 files

0.2.1

2 files

0.2.0

2 files

0.1.8

2 files

0.1.7

2 files

0.1.6

2 files

0.1.5

2 files

0.1.4

2 files

0.1.3

2 files

0.1.2

2 files

0.1.1

2 files

0.1.0

2 files

0.0.7

2 files

0.0.6

2 files

0.0.5

2 files

0.0.4

2 files

0.0.3

2 files

0.0.2

2 files

0.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page