moreniius 0.2.3__py3-none-any.whl → 0.2.4__py3-none-any.whl

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/mccode/instr.py CHANGED
@@ -83,8 +83,24 @@ class NXInstr:
83
83
  'expression' in nx_args[0]:
84
84
  not_expr = [x for x in nx_args[0] if x != 'expression']
85
85
  if len(not_expr) == 1:
86
+ not_expr_arg = nx_args[0][not_expr[0]]
87
+ if isinstance(not_expr_arg, NXfield):
88
+ # We have and want an NXfield, but it might be missing attributes specified in the nx_kwargs
89
+ # Passing the keywords to the NXfield constructor versus this method is not identical,
90
+ # since some keyword arguments are reserved (and only some of which are noted)
91
+ # Explicit keywords, used in the constructor:
92
+ # value, name, shape, dtype, group, attrs
93
+ # Keywords extracted from the kwargs dict, if present (and all controlling HDF5 file attributes?):
94
+ # chunks, compression, compression_opts, fillvalue, fletcher32, maxshape, scaleoffset, shuffle
95
+ # For now, just assume all keywords provided here are _actually_ attributes for the NXfield
96
+ # which is an extension of a dict, but can *not* use the update method, since the __setitem__
97
+ # method is overridden to wrap inputs in NXattr objects :/
98
+ for k, v in nx_kwargs.items():
99
+ not_expr_arg.attrs[k] = v
100
+ return not_expr_arg
101
+
86
102
  # TODO make this return an nx_class once we're sure that nx_kwargs is parseable (no mccode_antlr.Expr)
87
- return nx_class(nx_args[0][not_expr[0]], **nx_kwargs)
103
+ return nx_class(not_expr_arg, **nx_kwargs)
88
104
  else:
89
105
  raise RuntimeError('Not sure what I should do here')
90
106
  return nx_class(*nx_args, **nx_kwargs)
@@ -28,7 +28,6 @@ class NXPart:
28
28
  pos = self.o.position()
29
29
  if any(isinstance(c, (Expr, Value)) for c in (pos.x, pos.y, pos.z)):
30
30
  translations = []
31
- print(f'{pos.x=} {pos.y=} {pos.z=}')
32
31
  for n, c, v in (('x', pos.x, [1, 0, 0]), ('y', pos.y, [0, 1, 0]), ('z', pos.z, [0, 0, 1])):
33
32
  if c != Expr.parse('0'):
34
33
  next_name = f'{name}_{n}'
@@ -51,7 +50,6 @@ class NXPart:
51
50
  print(repr(self.o))
52
51
  raise NotImplementedError()
53
52
 
54
- # print(f'rotation {axis}, {angle}')
55
53
  # handle the case where angle is not a constant?
56
54
  return self.make_nx(NXfield, angle, vector=axis, depends_on=dep, transformation_type='rotation', units=angle_unit)
57
55
 
moreniius/writer.py CHANGED
@@ -113,7 +113,6 @@ class Writer:
113
113
  if absolute_depends_on and 'depends_on' == name and not obj.nxdata.startswith('/'):
114
114
  obj.nxdata = _to_absolute(top_obj.nxpath, obj.nxdata)
115
115
  if obj.nxclass == 'NXfield':
116
- # print(f'to_json_dict for NXfield {name=}')
117
116
  typ, val = convert_types(obj.nxdata, only_nx)
118
117
  # typ is None if obj.nxdata is a NotNXdict (such that val _is_ the contained dict)
119
118
  entry = dict(module='dataset', config=dict(name=name, values=val, type=typ)) if typ else val
@@ -123,7 +122,6 @@ class Writer:
123
122
  if len(list(obj)):
124
123
  entry['children'] = self._to_json_dict(obj, only_nx=only_nx, absolute_depends_on=absolute_depends_on)
125
124
  for n, v in obj.attrs.items():
126
- # print(f'to_json_dict for attribute of {name=}, named {n=}')
127
125
  typ, val = convert_types(v, only_nx)
128
126
  if absolute_depends_on and n == 'depends_on' and '/' != val[0]:
129
127
  val = _to_absolute(top_obj.nxpath, val)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: moreniius
3
- Version: 0.2.3
3
+ Version: 0.2.4
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
@@ -4,15 +4,15 @@ moreniius/moreniius.py,sha256=cU3CrfMC1kOnHO77yq5sZfDqRuA38G5kA3RUXFNGP2U,1455
4
4
  moreniius/nexus_structure.py,sha256=i9CxYwJl4eKP9IIYR80MI3f54Yh0RPDFviZaulE5IOc,1709
5
5
  moreniius/nxoff.py,sha256=WHp9wYNn_4Hcx8Nzi9rpX1p8_iwI-AdgTQouSAEG8N4,3288
6
6
  moreniius/utils.py,sha256=3ix8lLQwzwdx_nm-YEoD17z7s4h4CGda5lzVdD8M8lA,8386
7
- moreniius/writer.py,sha256=DOwzpDqoXiDXdtV-hRZVtF5lNBBoYy0UO5_bq89d1lc,6325
7
+ moreniius/writer.py,sha256=rZSOpSmCAiY1KS3YAWKBXZUWTJFLyrkZT-zeZfyENV8,6178
8
8
  moreniius/mccode/__init__.py,sha256=1QiZdh90G3gp_WlVpdJB_ZGauoW0GJEQ13Nelaqa5JE,151
9
9
  moreniius/mccode/comp.py,sha256=uR1L5nLfYPHhMKd3XnDbqf5xhkfwfPLRnttREc3jqBg,7382
10
10
  moreniius/mccode/instance.py,sha256=4nqJ3ne6yXCEvsa3FIKUcGDYP_z7cAr46JhakDTB6qs,8055
11
- moreniius/mccode/instr.py,sha256=8Thl4RuMi2X4ruNtI8-l8S_2OHtW_38F2Pv_FisuImc,4505
11
+ moreniius/mccode/instr.py,sha256=jzEtWJSNR-01zOUJ0jJpdXgjq4C0rzaPgcoECTOEnS8,5747
12
12
  moreniius/mccode/mccode.py,sha256=6NEXovuG-6itzlPgPklNOiZQ-MlldKF20p4TxV8n4BA,3228
13
- moreniius/mccode/orientation.py,sha256=kfOTiHgG68huQdh_ojd2NXxyAxFQoCn6FavwSOulh5E,3923
14
- moreniius-0.2.3.dist-info/METADATA,sha256=RlDqZin-stzGUdk_yKxBbxIFtYzLmSfnAsm7Rtwimpw,625
15
- moreniius-0.2.3.dist-info/WHEEL,sha256=uCRv0ZEik_232NlR4YDw4Pv3Ajt5bKvMH13NUU7hFuI,91
16
- moreniius-0.2.3.dist-info/entry_points.txt,sha256=Ga3k4P4fyBt5_dJ03Oapic2Qlgqv9jufQGdxWiz_j2A,63
17
- moreniius-0.2.3.dist-info/top_level.txt,sha256=RzMo23UfVhgQeuOYeS5P9I0qVbxx4Gbe6Roc29Mr02c,10
18
- moreniius-0.2.3.dist-info/RECORD,,
13
+ moreniius/mccode/orientation.py,sha256=TNELNqI_IVnxVUvdMR3qHnIulu-T456ZGgZYWXtkAbk,3829
14
+ moreniius-0.2.4.dist-info/METADATA,sha256=ZxkwxDOWQfFPVRp1qHcEwELKlpaGK6vpwlAN-9ttuBk,625
15
+ moreniius-0.2.4.dist-info/WHEEL,sha256=cVxcB9AmuTcXqmwrtPhNK88dr7IR_b6qagTj0UvIEbY,91
16
+ moreniius-0.2.4.dist-info/entry_points.txt,sha256=Ga3k4P4fyBt5_dJ03Oapic2Qlgqv9jufQGdxWiz_j2A,63
17
+ moreniius-0.2.4.dist-info/top_level.txt,sha256=RzMo23UfVhgQeuOYeS5P9I0qVbxx4Gbe6Roc29Mr02c,10
18
+ moreniius-0.2.4.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (74.1.1)
2
+ Generator: setuptools (74.1.2)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5