Skip to content

Commit 91c0420

Browse files
committed
Small nxdata handling improvements
1 parent 827f80c commit 91c0420

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

pynxtools/dataconverter/validation.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -213,7 +213,11 @@ def get_field_attributes(name: str, keys: Mapping[str, Any]) -> Mapping[str, Any
213213

214214
def handle_nxdata(node: NexusGroup, keys: Mapping[str, Any], prev_path: str):
215215
def check_nxdata():
216-
data = keys.get(signal) if signal is not None else None
216+
data = (
217+
keys.get(f"DATA[{signal}]")
218+
if f"DATA[{signal}]" in keys
219+
else keys.get(signal)
220+
)
217221
if data is None:
218222
collector.collect_and_log(
219223
f"{prev_path}/{signal}",
@@ -234,14 +238,16 @@ def check_nxdata():
234238
handle_field(
235239
node.search_child_with_name((signal, "DATA")),
236240
keys,
237-
prev_path=f"{prev_path}",
241+
prev_path=prev_path,
238242
)
239243

240244
for i, axis in enumerate(axes):
241245
if axis == ".":
242246
continue
243247
index = keys.get(f"{axis}_indices", i)
244248

249+
if f"AXISNAME[{axis}]" in keys:
250+
axis = f"AXISNAME[{axis}]"
245251
axis_data = _follow_link(keys.get(axis), prev_path)
246252
if axis_data is None:
247253
collector.collect_and_log(
@@ -264,7 +270,7 @@ def check_nxdata():
264270
handle_field(
265271
node.search_child_with_name((axis, "AXISNAME")),
266272
keys,
267-
prev_path=f"{prev_path}",
273+
prev_path=prev_path,
268274
)
269275
if isinstance(data, np.ndarray) and data.shape[index] != len(axis_data):
270276
collector.collect_and_log(
@@ -296,7 +302,7 @@ def check_nxdata():
296302
recurse_tree(
297303
node,
298304
remaining_keys,
299-
prev_path=f"{prev_path}",
305+
prev_path=prev_path,
300306
ignore_names=[
301307
"DATA",
302308
"AXISNAME",

0 commit comments

Comments
 (0)