-
Notifications
You must be signed in to change notification settings - Fork 17
More usability improvements sw fitpowder #210
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
More usability improvements sw fitpowder #210
Conversation
Didn't break a test as bg is all zeros in unit test - have now added a constant bg so this bug would have been caught.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #210 +/- ##
==========================================
+ Coverage 43.29% 43.42% +0.13%
==========================================
Files 243 243
Lines 16383 16552 +169
==========================================
+ Hits 7093 7188 +95
- Misses 9290 9364 +74 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Test Results 4 files ± 0 124 suites ±0 5m 44s ⏱️ +45s Results for commit 6ae56d9. ± Comparison against base commit eacac5a. This pull request removes 3 and adds 22 tests. Note that renamed tests count towards both.♻️ This comment has been updated with latest results. |
Also use same method to cut data in plotting 1D cuts of 2D data as when replacing data with 1D cuts. Updated tests
Now pfit and SigP have same shape
This is done so that there is always an E0 label regardless of background strategy
8ee1d09 to
016b604
Compare
mducle
left a comment
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.
Looks good but I've got some change requests!
I really like the new parameter name setter and printer and the background region plotting options.
Also, do you think it might be better to split tutorial 39 into two? One with the basic fitting and another going into more depth about the background estimation?
| out.set_bg_parameters(2, 11, 1); % intercept = 4*2 + 3 for cut 1 | ||
| out.set_bg_parameters(2, 13, 2); % intercept = 5*2 + 3 for cut 2 |
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.
According to the comment in line 85, the intercept index is 3 - but here you're changing parameter index 2 (which should slope_q, right?)
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.
Thanks, just checked this and the comment on line 85 refers to the equivalent planar background (which are checked on line 91). The parameters being set here are for the individual 1D cuts - i.e. parameter 2 corresponds to E0 - this is what disp_params gives
---
BACKGROUND
---
Label Index Cut Index Initial
E1 1 1 1
E0 2 1 11
E1 1 2 1
E0 2 2 13
I will update the comment on line 85 to be clearer
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.
@RichardWaiteSTFC bump...
| fbg_planar = @(en, modQ, p, npoly_modQ) polyval(p(npoly_modQ+1:end), en(:)) + ... | ||
| polyval([reshape(p(1:npoly_modQ),1,[]), 0], modQ(:)'); % q^n,..q^1, en^n,...en^1, const |
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.
Just from a code-reading perspective, I think it's a bit more obvious if this is changed to have two separate vectors of coefficients for the E- and Q-dependence rather than one vector and an offset, e.g.:
fbg_planar = @(en, modQ, poly_E, poly_modQ) polyval(poly_E, en(:)) + ...
polyval([poly_modQ(:)', 0], modQ(:)'); % q^n,..q^1, en^n,...en^1, constwhere the constant value is in poly_E.
This would then need changes to lines 257:
obj.fbg = @(en, modQ, p) obj.fbg_planar(en, modQ, p(end-obj.npoly_en+1:end), p(1:numel(p)-obj.npoly_en));
and 281:
intercepts = obj.fbg_planar(0, modQs, bg_pars(obj.npoly_modQ+1:end), bg_pars(1:obj.npoly_modQ));
The lines using this function are more verbose though... so it's up to you!
PS. I'm not sure the code in line 257 is correct - see comment below.
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.
Yep I think you're right, but would it be OK to address this in a separate PR?
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.
Sure, I've created an issue for it so we don't forget...
This is only valid in some cases
mducle
left a comment
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.
Just the change to comments in the unit test... (and possibly the qs thing...) otherwise good to go!
| fbg_planar = @(en, modQ, p, npoly_modQ) polyval(p(npoly_modQ+1:end), en(:)) + ... | ||
| polyval([reshape(p(1:npoly_modQ),1,[]), 0], modQ(:)'); % q^n,..q^1, en^n,...en^1, const |
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.
Sure, I've created an issue for it so we don't forget...
| out.set_bg_parameters(2, 11, 1); % intercept = 4*2 + 3 for cut 1 | ||
| out.set_bg_parameters(2, 13, 2); % intercept = 5*2 + 3 for cut 2 |
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.
@RichardWaiteSTFC bump...
mducle
left a comment
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.
Looks good now. Thanks.
Description
Various bugs and small features:
To Test
(1) Run tutorial 39 file