Ticket #7791 (closed: fixed)
Reorder by X-axis
Reported by: | Owen Arnold | Owned by: | Owen Arnold |
---|---|---|---|
Priority: | major | Milestone: | Release 3.0 |
Component: | Framework | Keywords: | |
Cc: | Blocked By: | ||
Blocking: | Tester: | Jay Rainey |
Description (last modified by Owen Arnold) (diff)
This relates to an issue reported by the user, where they have loaded ascii data in which the x-values are descending. It proves impossible to work with some features of mantid such as plotting if you do this.
The fix is simply to ensure that the x-axis is ordered smallest to largest, and that the y and e data also follow this ordering.
Using the data files attached and the following script, you can replicate this problem. Not that the plots generated do not graph the data properly as it is not ordered as expected.
# Load the text data. Note, the erors bars are 0.0 due to the way they were processed earlier. Load(Filename=DataDir+'polref8481.dat',OutputWorkspace='r8481',Unit='MomentumTransfer') Load(Filename=DataDir+'polref8483.dat',OutputWorkspace='r8483',Unit='MomentumTransfer') # Display the data to see what we're starting with plotSpectrum([mtd['r8481'],mtd['r8483']],0) # Notice that the default scaling is broken when the data has Rebin(InputWorkspace='r8481',OutputWorkspace='r8481',Params='0.009,-0.04,0.034',PreserveEvents='0') Rebin(InputWorkspace='r8483',OutputWorkspace='r8483',Params='0.027,-0.04,0.150',PreserveEvents='0')
Attachments
Change History
comment:3 Changed 7 years ago by Owen Arnold
refs #7791. New algorithm and tests.
New algorithm SortXAxis is part of Transform/Axes. Unit tests show this algorithm working.
Changeset: 1480afa0e672ce3b9f7ce6a7f98a2af16f24b7dd
comment:4 Changed 7 years ago by Owen Arnold
- Status changed from inprogress to verify
- Resolution set to fixed
Tester: Follow the script, but run the algorithms
r8481=SortXAxis(InputWorkspace=r8481) r8483=SortXAxis(InputWorkspace=r8483)
directly after the load steps. You should then see the plots generated properly. You may also plot the ascii data directly in excel (for example) to compare against.
comment:6 Changed 7 years ago by Jay Rainey
- Status changed from verify to verifying
- Tester set to Jay Rainey
comment:7 Changed 7 years ago by Jay Rainey
- Status changed from verifying to reopened
- Resolution fixed deleted
comment:8 Changed 7 years ago by Jay Rainey
It appears you forgot to do git finish as your branch is not on github.
comment:9 Changed 7 years ago by Owen Arnold
- Status changed from reopened to verify
- Resolution set to fixed
comment:11 Changed 7 years ago by Jay Rainey
- Status changed from verifying to closed
Merge remote-tracking branch 'origin/feature/7791_sort_x_axis'
comment:12 Changed 7 years ago by Jay Rainey
Testing
- Tested on Ubuntu 12.04.
- X-axis is now ordered smallest to largest allowing graphs to be produced.
- All unit tests pass.
Code review
- Well written and documented code, especially the unit test.
comment:13 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 8636