Skip to content

[defect] drtSANS will load the wrong sample data file when processing old NeXus files #32

@glass-ships

Description

@glass-ships

Problem Description:

It turns out for older version of NeXus files, drtSANS will reprocess the (for example) EQSANS_54060_event.nxs file and save the processed file into the local folder (where the script is running) as for example EQSANS_54060.nxs. When you run drtSANS again, the script will use (erroneously) the local one since the local one has the file name of a new file format and will be located first !

Then an error will be thrown when Mantid is trying to load this processed EQSANS_54060.nxs which is not in an event workspace data format.

Steps to Reproduce:

The script in /SNS/EQSANS/IPTS-12471/shared/july2022/

Run

drtsans ipts12471_porasil.py

The first time it will pass, then if the local EQSANS_54060.nxs file is generated from the first run, and you run it again, it will fail with error messages as follows,

Traceback (most recent call last):
  File "/opt/anaconda/envs/sans/lib/python3.8/site-packages/mantid/simpleapi.py", line 1058, in __call__
    algm.execute()
RuntimeError: NXopengroup(entry, NXentry) failed

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "/SNS/EQSANS/shared/script/eqsanstools/eqsans_reduction.py", line 43, in <module>
    reduce_eqsans_configuration(reduction_input)
  File "/SNS/EQSANS/shared/script/eqsanstools/eqsans_reduction.py", line 22, in reduce_eqsans_configuration
    loaded = load_all_files(input_config)
  File "/opt/anaconda/envs/sans/lib/python3.8/site-packages/drtsans/settings.py", line 49, in wrapper
    res = func(*args, **kwargs)
  File "/opt/anaconda/envs/sans/lib/python3.8/site-packages/drtsans/tof/eqsans/api.py", line 260, in load_all_files
    loaded_sample_tup = load_events_and_histogram(
  File "/opt/anaconda/envs/sans/lib/python3.8/site-packages/drtsans/settings.py", line 49, in wrapper
    res = func(*args, **kwargs)
  File "/opt/anaconda/envs/sans/lib/python3.8/site-packages/drtsans/tof/eqsans/load.py", line 297, in load_events_and_histogram
    ws = load_events(
  File "/opt/anaconda/envs/sans/lib/python3.8/site-packages/drtsans/tof/eqsans/load.py", line 160, in load_events
    output_workspace = generic_load_events(
  File "/opt/anaconda/envs/sans/lib/python3.8/site-packages/drtsans/load.py", line 153, in load_events
    LoadEventNexus(
  File "/opt/anaconda/envs/sans/lib/python3.8/site-packages/mantid/simpleapi.py", line 1065, in __call__
    raise RuntimeError(msg) from e
RuntimeError: LoadEventNexus-v1: NXopengroup(entry, NXentry) failed

Investigation/Analysis Results:

The processed file has to be renamed to a more explanatory name such as EQSANS_54060.nxs or put in an enclosed folder.

To elaborate the case, the code actually finding the location of the sample data file is

https://code.ornl.gov/sns-hfir-scse/sans/sans-backend/-/blob/next/drtsans/load.py#L120

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions