moreniius 0.2.4__tar.gz → 0.3.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {moreniius-0.2.4/src/moreniius.egg-info → moreniius-0.3.0}/PKG-INFO +10 -4
- {moreniius-0.2.4 → moreniius-0.3.0}/pyproject.toml +11 -4
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius/mccode/instance.py +1 -1
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius/mccode/instr.py +26 -20
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius/mccode/orientation.py +1 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius/utils.py +19 -2
- {moreniius-0.2.4 → moreniius-0.3.0/src/moreniius.egg-info}/PKG-INFO +10 -4
- moreniius-0.3.0/src/moreniius.egg-info/requires.txt +4 -0
- moreniius-0.3.0/tests/test_motorized_positions.py +111 -0
- moreniius-0.2.4/src/moreniius.egg-info/requires.txt +0 -7
- moreniius-0.2.4/tests/test_motorized_positions.py +0 -24
- {moreniius-0.2.4 → moreniius-0.3.0}/.github/workflows/pip.yml +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/.github/workflows/wheels.yml +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/.gitignore +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/README.md +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/setup.cfg +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius/__init__.py +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius/additions.py +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius/mccode/__init__.py +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius/mccode/comp.py +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius/mccode/mccode.py +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius/moreniius.py +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius/nexus_structure.py +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius/nxoff.py +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius/writer.py +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius.egg-info/SOURCES.txt +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius.egg-info/dependency_links.txt +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius.egg-info/entry_points.txt +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/src/moreniius.egg-info/top_level.txt +0 -0
- {moreniius-0.2.4 → moreniius-0.3.0}/tests/test_nexus_structure.py +0 -0
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: moreniius
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Author-email: Gregory Tucker <gregory.tucker@ess.eu>
|
|
5
5
|
Classifier: License :: OSI Approved :: BSD License
|
|
6
6
|
Classifier: Development Status :: 2 - Pre-Alpha
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
7
14
|
Description-Content-Type: text/markdown
|
|
8
15
|
Requires-Dist: zenlog>=1.1
|
|
9
16
|
Requires-Dist: platformdirs>=3.11
|
|
10
|
-
Requires-Dist:
|
|
11
|
-
Requires-Dist: mccode-antlr[hdf5]>=0.7.1
|
|
17
|
+
Requires-Dist: mccode-antlr[hdf5]>=0.13.0
|
|
12
18
|
Requires-Dist: nexusformat>=1.0.6
|
|
13
19
|
|
|
14
20
|
# moreniius
|
|
@@ -7,8 +7,7 @@ name = "moreniius"
|
|
|
7
7
|
dependencies = [
|
|
8
8
|
'zenlog>=1.1',
|
|
9
9
|
'platformdirs>=3.11',
|
|
10
|
-
|
|
11
|
-
'mccode-antlr[hdf5]>=0.7.1',
|
|
10
|
+
'mccode-antlr[hdf5]>=0.13.0',
|
|
12
11
|
'nexusformat>=1.0.6'
|
|
13
12
|
]
|
|
14
13
|
readme = "README.md"
|
|
@@ -17,7 +16,14 @@ authors = [
|
|
|
17
16
|
]
|
|
18
17
|
classifiers = [
|
|
19
18
|
"License :: OSI Approved :: BSD License",
|
|
20
|
-
"Development Status :: 2 - Pre-Alpha"
|
|
19
|
+
"Development Status :: 2 - Pre-Alpha",
|
|
20
|
+
"Programming Language :: Python :: 3",
|
|
21
|
+
"Programming Language :: Python :: 3 :: Only",
|
|
22
|
+
"Programming Language :: Python :: 3.9",
|
|
23
|
+
"Programming Language :: Python :: 3.10",
|
|
24
|
+
"Programming Language :: Python :: 3.11",
|
|
25
|
+
"Programming Language :: Python :: 3.12",
|
|
26
|
+
"Programming Language :: Python :: 3.13",
|
|
21
27
|
]
|
|
22
28
|
dynamic = ["version"]
|
|
23
29
|
|
|
@@ -31,6 +37,7 @@ legacy_tox_ini = """
|
|
|
31
37
|
[tox]
|
|
32
38
|
min_version = 4.0
|
|
33
39
|
env_list =
|
|
40
|
+
py313
|
|
34
41
|
py312
|
|
35
42
|
py311
|
|
36
43
|
py310
|
|
@@ -40,7 +47,7 @@ legacy_tox_ini = """
|
|
|
40
47
|
[testenv]
|
|
41
48
|
deps =
|
|
42
49
|
pytest
|
|
43
|
-
|
|
50
|
+
mccode-to-kafka
|
|
44
51
|
commands = pytest tests
|
|
45
52
|
|
|
46
53
|
[testenv:type]
|
|
@@ -150,7 +150,7 @@ def register_translator(name, translator):
|
|
|
150
150
|
Your translator must be a function with one input, the NXInstance object, and one output, a NeXus object.
|
|
151
151
|
After you have defined your translator function, you can register it with this function.
|
|
152
152
|
|
|
153
|
-
>>> import
|
|
153
|
+
>>> import moreniius
|
|
154
154
|
>>>
|
|
155
155
|
>>> def my_translator(instance):
|
|
156
156
|
>>> from nexusformat.nexus import NXguide
|
|
@@ -2,7 +2,7 @@ from zenlog import log
|
|
|
2
2
|
from dataclasses import dataclass, field
|
|
3
3
|
from mccode_antlr.instr import Instr
|
|
4
4
|
from mccode_antlr.common import Expr
|
|
5
|
-
from nexusformat.nexus import NXfield, NXcollection
|
|
5
|
+
from nexusformat.nexus import NXfield, NXgroup, NXcollection
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
@dataclass
|
|
@@ -14,20 +14,21 @@ class NXInstr:
|
|
|
14
14
|
def __post_init__(self):
|
|
15
15
|
"""Start the C translation to ensure McCode-oddities are handled before any C-code parsing."""
|
|
16
16
|
from mccode_antlr.common import ShapeType, DataType, Value
|
|
17
|
-
from mccode_antlr
|
|
18
|
-
from mccode_antlr.translators.c import CTargetVisitor
|
|
17
|
+
from mccode_antlr import Flavor
|
|
18
|
+
from mccode_antlr.translators.c import CTargetVisitor
|
|
19
|
+
from mccode_antlr.translators.c_listener import CDeclarator
|
|
19
20
|
from mccode_antlr.translators.c_listener import evaluate_c_defined_expressions
|
|
20
21
|
config = dict(default_main=True, enable_trace=False, portable=False, include_runtime=True,
|
|
21
22
|
embed_instrument_file=False, verbose=False, output=None)
|
|
22
|
-
translator = CTargetVisitor(self.instr,
|
|
23
|
+
translator = CTargetVisitor(self.instr, flavor=Flavor.MCSTAS, config=config)
|
|
23
24
|
# translator.instrument_uservars is a list of `CDeclaration` objects, which are named tuples with
|
|
24
25
|
# fields: name type init is_pointer is_array orig
|
|
25
26
|
# translator.component_uservars is a dictionary of lists for each component type of `CDeclaration` objects.
|
|
26
27
|
|
|
27
28
|
# only worry about instrument level variables for the moment, and convert the CDeclarations into Expr objects
|
|
28
|
-
def c_declaration_to_expr(dec:
|
|
29
|
+
def c_declaration_to_expr(dec: CDeclarator) -> Expr:
|
|
29
30
|
expr = Expr(Value(None)) if dec.init is None else Expr.parse(dec.init)
|
|
30
|
-
expr.data_type = DataType.from_name(dec.
|
|
31
|
+
expr.data_type = DataType.from_name(dec.dtype)
|
|
31
32
|
if dec.is_pointer or dec.is_array:
|
|
32
33
|
expr.shape_type = ShapeType.vector
|
|
33
34
|
return expr
|
|
@@ -84,22 +85,27 @@ class NXInstr:
|
|
|
84
85
|
not_expr = [x for x in nx_args[0] if x != 'expression']
|
|
85
86
|
if len(not_expr) == 1:
|
|
86
87
|
not_expr_arg = nx_args[0][not_expr[0]]
|
|
87
|
-
if isinstance(not_expr_arg, NXfield):
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
88
|
+
# if isinstance(not_expr_arg, NXfield):
|
|
89
|
+
# # We have and want an NXfield, but it might be missing attributes specified in the nx_kwargs
|
|
90
|
+
# # Passing the keywords to the NXfield constructor versus this method is not identical,
|
|
91
|
+
# # since some keyword arguments are reserved (and only some of which are noted)
|
|
92
|
+
# # Explicit keywords, used in the constructor:
|
|
93
|
+
# # value, name, shape, dtype, group, attrs
|
|
94
|
+
# # Keywords extracted from the kwargs dict, if present (and all controlling HDF5 file attributes?):
|
|
95
|
+
# # chunks, compression, compression_opts, fillvalue, fletcher32, maxshape, scaleoffset, shuffle
|
|
96
|
+
# # For now, just assume all keywords provided here are _actually_ attributes for the NXfield
|
|
97
|
+
# # which is an extension of a dict, but can *not* use the update method, since the __setitem__
|
|
98
|
+
# # method is overridden to wrap inputs in NXattr objects :/
|
|
99
|
+
# for k, v in nx_kwargs.items():
|
|
100
|
+
# not_expr_arg.attrs[k] = v
|
|
101
|
+
# return not_expr_arg
|
|
101
102
|
|
|
102
103
|
# TODO make this return an nx_class once we're sure that nx_kwargs is parseable (no mccode_antlr.Expr)
|
|
104
|
+
if all(x in not_expr_arg for x in ('module', 'config')):
|
|
105
|
+
# This is a file-writer stream directive? So make a group
|
|
106
|
+
return NXgroup(entries={not_expr[0]: not_expr_arg}, **nx_kwargs)
|
|
107
|
+
print('!!')
|
|
108
|
+
print(not_expr_arg)
|
|
103
109
|
return nx_class(not_expr_arg, **nx_kwargs)
|
|
104
110
|
else:
|
|
105
111
|
raise RuntimeError('Not sure what I should do here')
|
|
@@ -18,6 +18,7 @@ class NXPart:
|
|
|
18
18
|
return self.instr.make_nx(nx_class, *args, **kwargs)
|
|
19
19
|
|
|
20
20
|
def make_translation(self, norm, vec, dep):
|
|
21
|
+
# if `norm` is a link or NXlog, we should make a group not an NXfield
|
|
21
22
|
return self.make_nx(NXfield, norm, vector=vec, depends_on=dep, transformation_type='translation', units='m')
|
|
22
23
|
|
|
23
24
|
def translations(self, dep: str, name: str) -> list[tuple[str, NXfield]]:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from mccode_antlr.instr import Instance
|
|
2
|
-
from nexusformat.nexus import NXevent_data
|
|
2
|
+
from nexusformat.nexus import NXevent_data, NXfield
|
|
3
3
|
|
|
4
4
|
class NotNXdict:
|
|
5
5
|
"""Wrapper class to prevent NXfield-parsing of the held dictionary"""
|
|
@@ -12,6 +12,10 @@ class NotNXdict:
|
|
|
12
12
|
def __repr__(self):
|
|
13
13
|
return f"NotNXdict<{self.value}>"
|
|
14
14
|
|
|
15
|
+
def __str__(self):
|
|
16
|
+
from json import dumps
|
|
17
|
+
return dumps(self.value)
|
|
18
|
+
|
|
15
19
|
|
|
16
20
|
def outer_transform_dependency(transformations):
|
|
17
21
|
"""For a NXtransformations group, find the most-dependent transformation name
|
|
@@ -36,7 +40,20 @@ def outer_transform_dependency(transformations):
|
|
|
36
40
|
obj = getattr(transformations, name)
|
|
37
41
|
if not hasattr(obj, 'depends_on'):
|
|
38
42
|
raise ValueError(f'{name} in {names} dependency chain missing "depends_on" attribute')
|
|
39
|
-
|
|
43
|
+
if isinstance(obj.depends_on, NXfield):
|
|
44
|
+
# obj.depends_on is an NXfield object; which has a number of properties
|
|
45
|
+
# nxgroup - the parent group
|
|
46
|
+
# dtype - string or numpy dtype
|
|
47
|
+
# shape - list or tuple of ints
|
|
48
|
+
# attrs - dict of attributes
|
|
49
|
+
# nxdata - a scalar or numpy array or string
|
|
50
|
+
# nxpath - string, where this object is in the tree
|
|
51
|
+
# nxroot - the root NXgroup object containing this object
|
|
52
|
+
# I _think_ we *always* want the data stored in this object
|
|
53
|
+
return obj.depends_on.nxdata
|
|
54
|
+
elif isinstance(obj.depends_on, str):
|
|
55
|
+
return obj.depends_on
|
|
56
|
+
raise ValueError(f"depends_on attribute of {name} is not an NXfield or str")
|
|
40
57
|
|
|
41
58
|
# depends = {name: getattr(transformations, name).depends_on for name in names}
|
|
42
59
|
depends = {name: depends_on_per(name) for name in names}
|
|
@@ -1,14 +1,20 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: moreniius
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.3.0
|
|
4
4
|
Author-email: Gregory Tucker <gregory.tucker@ess.eu>
|
|
5
5
|
Classifier: License :: OSI Approved :: BSD License
|
|
6
6
|
Classifier: Development Status :: 2 - Pre-Alpha
|
|
7
|
+
Classifier: Programming Language :: Python :: 3
|
|
8
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
9
|
+
Classifier: Programming Language :: Python :: 3.9
|
|
10
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
11
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
12
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
13
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
7
14
|
Description-Content-Type: text/markdown
|
|
8
15
|
Requires-Dist: zenlog>=1.1
|
|
9
16
|
Requires-Dist: platformdirs>=3.11
|
|
10
|
-
Requires-Dist:
|
|
11
|
-
Requires-Dist: mccode-antlr[hdf5]>=0.7.1
|
|
17
|
+
Requires-Dist: mccode-antlr[hdf5]>=0.13.0
|
|
12
18
|
Requires-Dist: nexusformat>=1.0.6
|
|
13
19
|
|
|
14
20
|
# moreniius
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
|
|
2
|
+
def make_motorized_instrument():
|
|
3
|
+
from mccode_antlr.assembler import Assembler
|
|
4
|
+
from mccode_antlr.reader import MCSTAS_REGISTRY, LocalRegistry
|
|
5
|
+
from mccode_to_kafka.writer import da00_dataarray_config, da00_variable_config
|
|
6
|
+
|
|
7
|
+
inst = Assembler('inst', registries=[MCSTAS_REGISTRY])
|
|
8
|
+
inst.parameter('double ex/"m"=0')
|
|
9
|
+
inst.parameter('double phi/"degree"=0')
|
|
10
|
+
|
|
11
|
+
inst.component('origin', 'Arm', at=(0, 0, 0))
|
|
12
|
+
inst.component('source', 'Source_simple', at=[(0, 0, 0), 'origin'])
|
|
13
|
+
inst.component('xpos', 'Arm', at=[('ex', 0, 0), 'source'])
|
|
14
|
+
inst.component('zrot', 'Arm', at=[(0, 0, 0), 'xpos'], rotate=[(0, 0, 'phi'), 'xpos'])
|
|
15
|
+
inst.component('aposrot', 'Arm', at=(1, 2, 3), rotate=(45, 55, 60))
|
|
16
|
+
|
|
17
|
+
return inst.instrument
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
def test_motorized_instrument():
|
|
21
|
+
import moreniius
|
|
22
|
+
motorized = make_motorized_instrument()
|
|
23
|
+
nx = moreniius.MorEniius.from_mccode(motorized, origin='origin', only_nx=False, absolute_depends_on=True)
|
|
24
|
+
assert nx is not None
|
|
25
|
+
#TODO add actual tests for the contents of, e.g., the dumped NeXus Structure
|
|
26
|
+
ns = nx.to_nexus_structure()
|
|
27
|
+
|
|
28
|
+
expected = {
|
|
29
|
+
'entry': {
|
|
30
|
+
'type': 'group',
|
|
31
|
+
'children': 1,
|
|
32
|
+
'next': 0,
|
|
33
|
+
'attributes': [{'name': 'NX_class', 'dtype': 'string', 'values': 'NXentry'}]
|
|
34
|
+
},
|
|
35
|
+
'instrument': {
|
|
36
|
+
'type': 'group',
|
|
37
|
+
'children': 7,
|
|
38
|
+
'next': 0,
|
|
39
|
+
'attributes': [{'name': 'NX_class', 'dtype': 'string', 'values': 'NXinstrument'}]
|
|
40
|
+
},
|
|
41
|
+
}
|
|
42
|
+
for name, has in expected.items():
|
|
43
|
+
assert 'children' in ns
|
|
44
|
+
assert len(ns['children']) >= has['next']
|
|
45
|
+
ns = ns['children'][has['next']]
|
|
46
|
+
assert all(x in ns for x in ('type', 'name', 'children', 'attributes'))
|
|
47
|
+
assert ns['name'] == name
|
|
48
|
+
assert ns['attributes'] == has['attributes']
|
|
49
|
+
assert len(ns['children']) == has['children']
|
|
50
|
+
|
|
51
|
+
xpos = ns['children'][3]
|
|
52
|
+
zrot = ns['children'][4]
|
|
53
|
+
aposrot = ns['children'][5]
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
from json import dumps
|
|
57
|
+
|
|
58
|
+
for cns in (xpos, zrot, aposrot):
|
|
59
|
+
assert 'children' in cns
|
|
60
|
+
assert 'transformations' in [c['name'] for c in cns['children'] if 'name' in c]
|
|
61
|
+
t = [c for c in cns['children'] if 'name' in c and c['name'] == 'transformations'][0]
|
|
62
|
+
assert 'children' in t
|
|
63
|
+
t = t['children']
|
|
64
|
+
for c in t:
|
|
65
|
+
# Each child can _either_ be a dataset, with 'module' at its top level
|
|
66
|
+
# Or a group, with 'name', etc. at its top level
|
|
67
|
+
|
|
68
|
+
if 'module' in c:
|
|
69
|
+
# this transformation is static, and a dataset
|
|
70
|
+
assert 'dataset' == c['module']
|
|
71
|
+
assert all(x in c for x in ('config', 'attributes'))
|
|
72
|
+
assert all(x in c['config'] for x in ('name', 'values', 'type'))
|
|
73
|
+
attrs = c['attributes']
|
|
74
|
+
assert len(attrs) == 4
|
|
75
|
+
assert all(all(x in a for x in ('name', 'values', 'dtype')) for a in attrs)
|
|
76
|
+
assert all(a['name'] in ('vector', 'depends_on', 'transformation_type', 'units') for a in attrs)
|
|
77
|
+
else:
|
|
78
|
+
# this transformation is dynamic and a group
|
|
79
|
+
assert all(x in c for x in ('name', 'type', 'children', 'attributes'))
|
|
80
|
+
assert 'group' == c['type']
|
|
81
|
+
attrs = c['attributes']
|
|
82
|
+
assert len(attrs) == 1
|
|
83
|
+
attr = attrs[0]
|
|
84
|
+
assert all(x in attr for x in ('name', 'dtype', 'values'))
|
|
85
|
+
assert 'NX_class' == attr['name']
|
|
86
|
+
assert 'NXgroup' == attr['values']
|
|
87
|
+
|
|
88
|
+
# The children should contain a link to the log ... is the order important?
|
|
89
|
+
# Must the number of children always be the same?
|
|
90
|
+
assert all('module' in cc for cc in c['children'])
|
|
91
|
+
assert sum('link' == cc['module'] for cc in c['children']) <= 1
|
|
92
|
+
for cc in c['children']:
|
|
93
|
+
if 'link' == cc['module']:
|
|
94
|
+
assert all(x in cc['config'] for x in ('name', 'source'))
|
|
95
|
+
else:
|
|
96
|
+
assert all(x in cc['config'] for x in ('name', 'values', 'type'))
|
|
97
|
+
assert cc['config']['name'] in ('vector', 'depends_on', 'transformation_type', 'units')
|
|
98
|
+
|
|
99
|
+
# for name, has in expected.items():
|
|
100
|
+
# print({x : list(ns[x]) for x in ns})
|
|
101
|
+
# assert all(x in ns for x in has)
|
|
102
|
+
# assert len(ns['children']) == 1
|
|
103
|
+
# assert ns['name'] == name
|
|
104
|
+
# ns = ns['children'][0]
|
|
105
|
+
|
|
106
|
+
#
|
|
107
|
+
# instr = ns['entry']['instrument']
|
|
108
|
+
# #
|
|
109
|
+
# print(dumps(xpos, indent=2))
|
|
110
|
+
# print(dumps(zrot, indent=1))
|
|
111
|
+
# print(dumps(aposrot, indent=1))
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
def make_motorized_instrument():
|
|
3
|
-
from mccode_antlr.assembler import Assembler
|
|
4
|
-
from mccode_antlr.reader import MCSTAS_REGISTRY, LocalRegistry
|
|
5
|
-
from mccode_to_kafka.writer import da00_dataarray_config, da00_variable_config
|
|
6
|
-
|
|
7
|
-
inst = Assembler('inst', registries=[MCSTAS_REGISTRY])
|
|
8
|
-
inst.parameter('double ex/"m"=0')
|
|
9
|
-
inst.parameter('double phi/"degree"=0')
|
|
10
|
-
|
|
11
|
-
inst.component('origin', 'Arm', at=(0, 0, 0))
|
|
12
|
-
inst.component('source', 'Source_simple', at=[(0, 0, 0), 'origin'])
|
|
13
|
-
inst.component('xpos', 'Arm', at=[('ex', 0, 0), 'source'])
|
|
14
|
-
inst.component('zrot', 'Arm', at=[(0, 0, 0), 'xpos'], rotate=[(0, 0, 'phi'), 'xpos'])
|
|
15
|
-
|
|
16
|
-
return inst.instrument
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
def test_motorized_instrument():
|
|
20
|
-
import moreniius
|
|
21
|
-
motorized = make_motorized_instrument()
|
|
22
|
-
nx = moreniius.MorEniius.from_mccode(motorized, origin='origin', only_nx=False, absolute_depends_on=True)
|
|
23
|
-
assert nx is not None
|
|
24
|
-
#TODO add actual tests for the contents of, e.g., the dumped NeXus Structure
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|