Ticket #438 (closed: fixed)
Correct handling of distributions
Reported by: | Nick Draper | Owned by: | Russell Taylor |
---|---|---|---|
Priority: | critical | Milestone: | Iteration 21 |
Component: | Keywords: | ||
Cc: | Blocked By: | ||
Blocking: | Tester: |
Description
Attachments
Change History
comment:2 Changed 11 years ago by Nick Draper
- Milestone changed from Iteration 16 to Iteration 17
Batch move of tickets to Iteration 17
comment:3 Changed 11 years ago by Nick Draper
- Milestone changed from Iteration 17 to Iteration 18
Moved as part of iteration end
comment:4 Changed 11 years ago by Nick Draper
- Milestone changed from Iteration 18 to Iteration 19
Moved as part of iteration 18 end
comment:5 Changed 11 years ago by Nick Draper
We encountered an issue in the GEM analysis where once the data was corrected against vanadium with a divide the data was essentially a distribution without being marked as one. In this state rebin commands led to unexpedted shifting of the data.
Should divide mark the workspace as a distribution if the units match?
comment:6 Changed 11 years ago by Nick Draper
- Milestone changed from Iteration 19 to Iteration 20
Moved as part of the end of Iteration 19
comment:7 Changed 11 years ago by Russell Taylor
(In [3573]) The rebinNonDispersive was found to be buggy in the context it was being used in the SANS analysis. In fact, the rebin function does the same job if the data are flagged as a distribution so change to using that instead (and modify the rebin function to work with cumulative rebinning as the rebinHistogram one does). Re #438.
comment:10 Changed 11 years ago by Russell Taylor
- Status changed from new to accepted
That should have been revision [3591].
comment:11 Changed 11 years ago by Russell Taylor
- Status changed from accepted to testing
- Resolution set to fixed
I think I understand why what we're doing in the SANS analysis is OK now....
comment:12 Changed 11 years ago by Russell Taylor
- Status changed from testing to reopened
- Priority changed from minor to critical
- type changed from enhancement to defect
- Resolution fixed deleted
- Summary changed from SANS: Correct handling of distributions to Correct handling of distributions
OK, we still have an issue to sort out here, and I think I know what it is. Basically, there are (at least) two 'kinds' of distribution: one where the data's been divided by the bin width and another where it's dimensionless (e.g. after a divide). Our rebin gets things right, but ConvertUnits doesn't. Genie accounts for this in it's unit conversion routine (it doesn't multiply by the bin width if it's dimensionless).
So there are several things we need to do:
- Fix ConvertUnits
- Perhaps enhance our YUnit to be more than just a string
- Enhance Divide (& multiply?) to adjust the Y unit and distribution flag in the general case.
This all follow from the following from Rob Dalgliesh:
I've been trying replicate data extraction I can do in openGenie using
Mantid and have come across a show stopper....
The script below illustrates the problem I have.
Essentially if I take a data set full of 1s I should be able to convert
to Q in distribution form and still get a straight line.
This isn't the case (plot "test1" to see). It looks like the division by bin size is wrong as you get a logarithmic increase in the data.
###################################################################### #Python Script Generated by Algorithm History Display ###################################################################### LoadRaw(Filename="W:/RawFiles/OFFSPEC00005588.raw",OutputWorkspace="OFFSPEC00005588",LoadLogFiles="0") ConvertUnits(InputWorkspace="OFFSPEC00005588",OutputWorkspace="5588lambda",Target="Wavelength") CropWorkspace(InputWorkspace="5588lambda",OutputWorkspace="5588spec113",StartWorkspaceIndex="113",EndWorkspaceIndex="113") Divide(LHSWorkspace="5588spec113",RHSWorkspace="5588spec113",OutputWorkspace="unitywksp") ReplaceSpecialValues(InputWorkspace="unitywksp",OutputWorkspace="unitywksp",NaNValue="1",NaNError="1",InfinityValue="1",InfinityError="1") ConvertUnits(InputWorkspace="unitywksp",OutputWorkspace="unityQ",Target="MomentumTransfer") Rebin(InputWorkspace="unityQ",OutputWorkspace="test1",Params="0.007,-0.01,5") ConvertToDistribution(Workspace="test1")
comment:14 Changed 11 years ago by Russell Taylor
comment:15 Changed 11 years ago by Russell Taylor
(In [3730]) Changes so that we handle distributions better. In particular, Divide now changes its output workspace to be a dimensionless distribution if the inputs have the same YUnit. ConvertUnits handles dimensionless distributions correctly. A new field is added to MatrixWorkspace (YUnitLabel) which holds a descriptive string for plotting. m_YUnit should only really be Counts or nothing. Re #438.
comment:16 Changed 11 years ago by Russell Taylor
comment:17 Changed 11 years ago by Russell Taylor
comment:18 Changed 11 years ago by Russell Taylor
Changed 11 years ago by Russell Taylor
- Attachment rob-distributionproblem.py added
The file showing the problem. Should end up with a flat line - didn't used to.
comment:19 Changed 11 years ago by Russell Taylor
- Status changed from accepted to testing
- Resolution set to fixed
comment:21 Changed 5 years ago by Stuart Campbell
This ticket has been transferred to github issue 1286