Ticket #11877 (closed: fixed)

Opened 5 years ago

Last modified 5 years ago

SaveNexusProcessed/LoadNexusProcessed round trip bug

Reported by: Raquel Alvarez Banos Owned by: Raquel Alvarez Banos
Priority: major Milestone: Release 3.5
Component: Framework Keywords:
Cc: Blocked By:
Blocking: #5406 Tester: Dan Nixon

Description

Run the following script to reproduce the issue:

X = [0,1,2,3,4,5] + [0,10,20,30,40,50] + [0,100,200,300,400,500]
Y = [0,1,2,3,4,5] + [0,10,20,30,40,50] + [0,100,200,300,400,500]
ws = CreateWorkspace(DataX=X,DataY=Y,NSpec=3)

SaveNexusProcessed(InputWorkspace=ws,Filename='test.nxs')
ows = LoadNexusProcessed(Filename='test.nxs')
print CheckWorkspacesMatch(ws,ows)

ws and ows do not match because ws is a point-like workspace (n x values and n y values) but LoadNexusProcessed is assuming a histogram workspace and loading n+1 x values.

Change History

comment:1 Changed 5 years ago by Raquel Alvarez Banos

This other script works fine:

X = [0,1,2,3,4,5]+[0, 1, 2, 3, 4, 5]+[0,  1,  2,  3,  4,  5]
Y = [0,1,2,3,4,5]+[0,10,20,30,40,50]+[0,100,200,300,400,500]
ws = CreateWorkspace(DataX=X,DataY=Y,NSpec=3)
SaveNexusProcessed(InputWorkspace=ws,Filename='test.nxs')
ows = LoadNexusProcessed(Filename='test.nxs')
print CheckWorkspacesMatch(ws,ows)

It seems that the problem arises when ws is a point-like workspace and the X values are not shared by all the spectra.

comment:2 Changed 5 years ago by Raquel Alvarez Banos

The bug is caused by line 1951 in LoadNexusProcessed.cpp:

  const int64_t nxbins(nchannels + 1);

I think the number of X values should be read from xbins.dim1()

comment:3 Changed 5 years ago by Raquel Alvarez Banos

  • Status changed from new to inprogress

comment:4 Changed 5 years ago by Raquel Alvarez Banos

Re #11877 Add a couple of unit tests

Changeset: dfb8cd9db7b2029cc7e209e108e8b125dc839d8e

comment:5 Changed 5 years ago by Raquel Alvarez Banos

comment:6 Changed 5 years ago by Raquel Alvarez

  • Status changed from inprogress to verify
  • Resolution set to fixed

This is being verified as pull request #832.

comment:7 Changed 5 years ago by Raquel Alvarez Banos

  • Blocking 5406 added

(In #5406) Before writing the system test I first need to solve #11877

comment:8 Changed 5 years ago by Dan Nixon

  • Status changed from verify to verifying
  • Tester set to Dan Nixon

comment:9 Changed 5 years ago by Dan Nixon

The change seems to be fine, I'll run the doctests locally and if they pass there I'll merge it.

comment:10 Changed 5 years ago by Dan Nixon

  • Status changed from verifying to closed

Merge pull request #832 from mantidproject/11877_SaveNexusProcessedLoadNexusProcessed_round_trip

Fix LoadNexusProcessed bug

Full changeset: 6d19154e9f85cd1a22ec3869e01bf792a8cc828f

comment:11 Changed 5 years ago by Stuart Campbell

This ticket has been transferred to github issue 12715

Note: See TracTickets for help on using tickets.