No project description provided
Project description
moreniius
A project to contain custom components required to use eniius to produce NeXus Structure JSON from mccode-antlr simulated instruments.
Simply, more eniius.
Features
Path-based Navigation for NeXus Structure JSON
The NexusStructureNavigator class provides convenient path-based access to NeXus Structure JSON objects, which have a verbose hierarchical format. It supports both path-based access and chainable navigation.
Without Navigator (verbose)
from moreniius import to_nexus_structure, load_instr
structure = to_nexus_structure(load_instr('instrument.instr'))
# Access requires nested dictionary lookups
component = structure['children'][0]['children'][0]['children'][12]
# Accessing attributes is even more verbose
attrs = structure['children'][0]['attributes']
nx_class = next(a for a in attrs if a['name'] == 'NX_class')
With Navigator (clean and chainable)
from moreniius import to_nexus_structure, load_instr, NexusStructureNavigator
structure = to_nexus_structure(load_instr('instrument.instr'))
nav = NexusStructureNavigator(structure)
# Path-based access (returns Navigator for groups)
component = nav['/entry/instrument/component_name']
field = nav['/entry/instrument/component_name/field']
# Chainable navigation - each group access returns a new Navigator!
component = nav['entry']['instrument']['component_name']
# Get the underlying dictionary
raw_dict = component.dict() # or component.structure
# Access attributes with '@' prefix (returns raw dict)
nx_class = nav['/entry/@NX_class']
vector = nav['/entry/instrument/something/@vector']
# Attributes can also be accessed from Navigator objects
nx_class = nav['entry']['instrument']['mon0']['@NX_class']
# Check if paths exist
if nav.exists('/entry/instrument/mon0'):
mon0 = nav['/entry/instrument/mon0']
# Get with default value
result = nav.get('/entry/instrument/missing', default=None)
# Find all elements with a given name
monitors = nav.find_all('mon0')
# Find all attributes with a given name
all_nx_classes = nav.find_all('NX_class', include_attributes=True)
# Reverse lookup - get path to an element (requires raw dict)
path = nav.get_path(component.structure) # Returns '/entry/instrument/component_name'
attr_path = nav.get_path(nx_class) # Returns '/entry/@NX_class'
Key behaviors:
- Accessing a group (has
children) returns aNexusStructureNavigatorfor chaining - Accessing an attribute (with
@), dataset, or link returns the raw dictionary - Use
.dict()or.structureto get the underlying dictionary from a Navigator
See examples/path_navigator_demo.py for a complete working example.
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 moreniius-0.8.5.tar.gz.
File metadata
- Download URL: moreniius-0.8.5.tar.gz
- Upload date:
- Size: 199.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77f6d2e46d3b49e31a4892ebf441e02eb18992a17c283945dc71104045efbd4c
|
|
| MD5 |
9c8329559440dc90bbbc0b68de6f6590
|
|
| BLAKE2b-256 |
c30d18b1892d0922279c413de6f02ddb03d507bd2b80c1ea95e73171035767b8
|
Provenance
The following attestation bundles were made for moreniius-0.8.5.tar.gz:
Publisher:
wheels.yml on g5t/moreniius
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moreniius-0.8.5.tar.gz -
Subject digest:
77f6d2e46d3b49e31a4892ebf441e02eb18992a17c283945dc71104045efbd4c - Sigstore transparency entry: 1005435996
- Sigstore integration time:
-
Permalink:
g5t/moreniius@ba030841b528bad9279d044b39f227599618279a -
Branch / Tag:
refs/tags/v0.8.5 - Owner: https://github.com/g5t
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@ba030841b528bad9279d044b39f227599618279a -
Trigger Event:
release
-
Statement type:
File details
Details for the file moreniius-0.8.5-py3-none-any.whl.
File metadata
- Download URL: moreniius-0.8.5-py3-none-any.whl
- Upload date:
- Size: 31.9 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 |
42da592538ed4792e85f8ace9d51aa2b732c93aaa65d954d1cefb32c2072e42a
|
|
| MD5 |
181cec51c3d17dab73e5d099d8d7074c
|
|
| BLAKE2b-256 |
a30ee7f32ad61c12ee360dfec1ca44e3a3214783b4475c4833d5d31ac84007b0
|
Provenance
The following attestation bundles were made for moreniius-0.8.5-py3-none-any.whl:
Publisher:
wheels.yml on g5t/moreniius
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
moreniius-0.8.5-py3-none-any.whl -
Subject digest:
42da592538ed4792e85f8ace9d51aa2b732c93aaa65d954d1cefb32c2072e42a - Sigstore transparency entry: 1005436031
- Sigstore integration time:
-
Permalink:
g5t/moreniius@ba030841b528bad9279d044b39f227599618279a -
Branch / Tag:
refs/tags/v0.8.5 - Owner: https://github.com/g5t
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
wheels.yml@ba030841b528bad9279d044b39f227599618279a -
Trigger Event:
release
-
Statement type: