Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
glass-ships opened this issue Dec 17, 2024 · 1 comment

Comments

@glass-ships
Copy link
Member

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

@glass-ships
Copy link
Member Author

This issue was migrated from code.ornl.gov.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant