Skip to content

mmg_toolbox tests fail for evaluation #61

Description

@DanPorter

Running tests against the latests version of HdfMap fail:

Test

https://github.com/DiamondLightSource/mmg_toolbox/blob/49f5b2482320953d326890ca6026a2b35257d72c/tests/test_nexus_scan.py#L23

    f = DIR + '/i16/1109527.nxs'
    scan = NexusScan(f)
    ...
    assert scan('max(signal / Transmission / (rc/300.) / _t)') == approx(1215483134.5953412)

Error

Traceback (most recent call last):
  File "<input>", line 1, in <module>
  File "/scratch/grp66007/python/hdfmap/src/hdfmap/hdfmap_class.py", line 1086, in eval
    return eval_hdf(
        hdf_file=hdf_file,
    ...<6 lines>...
        raise_errors=raise_errors
    )
  File "/scratch/grp66007/python/hdfmap/src/hdfmap/eval_functions.py", line 483, in eval_hdf
    expression = prepare_expression_load_data(hdf_file, expression, hdf_namespace, data_namespace,
                                              replace_names, default, use_stored_data)
  File "/scratch/grp66007/python/hdfmap/src/hdfmap/eval_functions.py", line 433, in prepare_expression_load_data
    identifiers = find_identifiers(expression)
  File "/scratch/grp66007/python/hdfmap/src/hdfmap/eval_functions.py", line 239, in find_identifiers
    return [name for name in asteval.get_ast_names(ast.parse(expression))]
                                                   ~~~~~~~~~^^^^^^^^^^^^
  File "/dls/science/users/grp66007/.local/share/uv/python/cpython-3.14.5-linux-x86_64-gnu/lib/python3.14/ast.py", line 46, in parse
    return compile(source, filename, mode, flags,
                   _feature_version=feature_version, optimize=optimize)
  File "<unknown>", line 1
    max(signal / Transmission / (rc/300.) / count_time
       ^
SyntaxError: '(' was never closed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions