Skip to content

Conversation

cailafinn
Copy link
Contributor

@cailafinn cailafinn commented Apr 23, 2025

Description of work

Summary of work

Makes adjustments to SANSadd2 (the underlying code for the Sum Runs tab on the ISIS SANS interface) so that nexus files also have their sample metadata maintained like we do with raw files.

Fixes #39106

Report to: Diego

Further detail of work

This is from the end of a long mess of trying to understand how this metadata is stored and loaded at nexus file creation, loading, manipulation, and then saving. The short answer is that it is horribly inconsistent. See this discussion.

Trying to fix this inconsistency went beyond the scope of the problem, so this PR instead solves it only on the SANS end and tries to account for any confusion by manually setting the sample information before it's saved when summing.

Also fixes an issue where runs named "FLATPLATE" in the nexus file would appear as "Disc" due to the missing space.

Also adds unit tests that run quickly to track this behaviour rather than the full workflow ones that exist in the systest package.

To test:

  1. Open the ISIS SANS GUI
  2. Download USER_ZOOM_Su_8m_3Dmagnet_245H_large_BEAMSTOP.toml from IDAaaS (or just ask me)
  3. Set the downloaded file as the User File.
  4. Type 49179 in the first Sample Scatter box.
  5. Click the Sample Geometry checkbox.
  6. Click Process All. The run will fail, but the SampleShape box should now say "FlatPlate"
  7. Swap to Sum Runs
  8. Enter 49179 in the Runs to Sum field.
  9. Click Add
  10. Make sure the Save Directory is a) somewhere sensible and b) in your list of data directories.
  11. Click Sum
  12. Return to the Runs tab
  13. Enter the output name (Save File) from the Sum Runs tab in the Sample Scatter box.
  14. Click process all
  15. The new -add run should also have a "FlatPlate" SampleShape

Reviewer

Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Do the release notes conform to the release notes guide?

Functional Tests

  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

@cailafinn cailafinn added SANS Issues and pull requests related to SANS ISIS: LSS Issue and pull requests relating to SANS and Reflectometry (Large Scale Structures) at ISIS labels Apr 23, 2025
The unit test data isn't split up like the system test data, so remove
the leading directory in the test.

RE mantidproject#39106
@warunawickramasingha
Copy link
Contributor

Hi @cailafinn I couldn't find USER_ZOOM_Su_8m_3Dmagnet_245H_large_BEAMSTOP.toml file from IDAaaS. Could you please attach it here?
Thanks!

@warunawickramasingha
Copy link
Contributor

Having followed the test steps above, could you please confirm below observations are correct?

1- At Step 11, it did not generate any output files in the Save Directory
2- Is step 14 expected to fail the run similar to step 6, but still see SampleShape box as FlatPlate? Because that was the observation after entering the Save File name as ZOOM00049179-add or ZOOM00049179-add.nxs.

Thanks!

@cailafinn
Copy link
Contributor Author

2- Is step 14 expected to fail the run similar to step 6, but still see SampleShape box as FlatPlate? Because that was the observation after entering the Save File name as ZOOM00049179-add or ZOOM00049179-add.nxs.

This is the expectation, yes - that the SampleShape is the same after summing as it was the summing step.

1- At Step 11, it did not generate any output files in the Save Directory

I'm not sure how you'd be able to perform step 14 (which loads the -add file) without the Sum tab generating it in this step. Did it put it somewhere else or something?

@warunawickramasingha
Copy link
Contributor

I'm not sure how you'd be able to perform step 14 (which loads the -add file) without the Sum tab generating it in this step. Did it put it somewhere else or something?

To verify this, I just followed the test steps again as follows

1- In Manage User directories - removed all the user directories defined there and set the Search Data Archive as Off

image

2- Open the ISIS SANS GUI
3- Set USER_ZOOM_Su_8m_3Dmagnet_245H_large_BEAMSTOP.toml file as the User File.
4- Click the Sample Geometry checkbox.
5- Enter the Sample Scatter box as ZOOM00049179-add
6- Click process all to see below
image

Do you think this behaviour is correct?

@cailafinn
Copy link
Contributor Author

Ah, it may be getting it directly from the ADS instead. In that case that would seem to be the expected behaviour.

Copy link
Contributor

@warunawickramasingha warunawickramasingha left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code changes looks fine and I have followed the given test steps to get expected results. Happy approve!

@MialLewis MialLewis moved this from New to Done in ISIS LSS Sprint Planning May 20, 2025
@MialLewis MialLewis merged commit 601dd8b into mantidproject:main May 20, 2025
10 checks passed
peterfpeterson pushed a commit to peterfpeterson/mantid that referenced this pull request May 23, 2025
Makes adjustments to SANSadd2 (the underlying code for the Sum Runs tab
on the ISIS SANS interface) so that nexus files also have their sample
metadata maintained like we do with raw files.

Fixes mantidproject#39106
peterfpeterson added a commit that referenced this pull request May 26, 2025
This pulls the following into `ornl-next`
* #39234
* #39365

---------

Co-authored-by: Caila Finn <47181718+cailafinn@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ISIS: LSS Issue and pull requests relating to SANS and Reflectometry (Large Scale Structures) at ISIS SANS Issues and pull requests related to SANS
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

Adding file in SANS gui changes sample geometry
4 participants