Saving and Loading a workspace makes it subtly different

I thought I’d make a “unit test” for one of my programs, where I have a saved copy of what the output ought to be, and can compare with the results of running it later. However I’ve run into a subtle bug: if I have a workspace where I’ve replaced the Y axis with a user supplied numeric one, and Save it to Nexus and reload it, it fails to compare equal with “CheckWorkspacesMatch”. See the script below. If I comment out the line “ws.replaceAxis(1,na)” it does compare equal. And if I reload the file twice the two loaded copies compare equal too. What’s wrong?

Looking at the workspace numeric windows or the 2D Color plots, there’s no visible difference.

SaveLoadMismatch.py (1.4 KB)

James,

It looks like this is a bug in loading code for this situation. I’ve created an issue: Bug in LoadNexusProcessed for workspaces with non-spectra Axes · Issue #14838 · mantidproject/mantid · GitHub

The up axis has been replaced so that it no longer holds the spectrum numbers. Despite the correct numbers being saved in the file, as shown by hdfview, they are not loaded correctly in the case where the up axis has been replaced by a general one.

Usually when the up axis has been replaced then the spectrum numbers are no longer useful so in actuality everything will still work as expected but the failing comparison is confusing so we’ll plug that gap.