-
Notifications
You must be signed in to change notification settings - Fork 16
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
updates to multidimensional histo writer #166
Conversation
@mducle @RichardWaiteSTFC Hi guys I caught a bug in my MDH writer that did not handle the case where the cut started from something other than 0,0,0. also I improved the axis scaling. let me know if you have any comments. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #166 +/- ##
==========================================
+ Coverage 40.51% 40.52% +0.01%
==========================================
Files 240 240
Lines 15981 15985 +4
==========================================
+ Hits 6474 6478 +4
Misses 9507 9507 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Code looks ok, except for a comment...
Tested with this script:
spec = sw_egrid(spinwave(sw_model('triAF', 1), {[-3 -3 0], [1 1 0], 2000}));
spec = sw_instrument(spec, 'dE', 0.2);
proj = [[1 1 0]' [1 -1 0]' [0 0 1]'];
dproj = [1, 1e-6, 1e-6];
sw_spec2MDHisto(spec, proj, dproj, 'test.nxs');
And loaded the resulting test.nxs
in Mantid 6.8 and it plots fine - the q-direction scale goes from -3 to +1 as expected (rather than -4.24 to +1.41 as it would before this PR).
swfiles/sw_spec2MDHisto.m
Outdated
for idx=1:3 | ||
procjv = proj(:,idx)/norm(proj(:,idx)); | ||
|
||
qidx = idx; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this is needed since qidx
is always the same as idx
...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes the fix was so it would go from -3 to 1 as expected. I updated to remove the redundancy in the variable. I chose to keep qidx and remove idx as it is a more descriptive.
This should be good to go now. |
This updates the writing of spec to MDH file writer. So now the output along the x axis is scaled to the proj vector along it's direction rather than the norm of that vector this means a cut 0,0,0 to 1,1,0 would read 0 to 1 along the x axis rather than 0 1.41.
also a bug was fixed so it no properly writes things when q0 is something other than 0,0,0.
The tests were updated accordingly to ensure this bug is captured.