Adds a trust bar for size distribution result plots#4009
Conversation
cdd8c98 to
0e9cb10
Compare
butlerpd
left a comment
There was a problem hiding this comment.
This works very smoothly whether stretching the graph or changing scales. A GREAT addition that was desired from the beginning. I do have one question I do not fully comprehend though. While the right hand red trust line matches the new trust bar transition, the left hand red line seems to be well into the trust bar's red region instead of lined up with the transition. As far as I can tell both numbers are computed from the exact same code? but maybe used differently?
Otherwise of course those two kludgy trust lines that were created as an easy stop gap in lieu of the trustbar should be removed (see comment on code). Fortunately it was not done yet or I'd have missed the fact that the two do not match. That matching needs a bit more investigation.
Once they match and the red trust lines (trust_plot) are removed this should be good to go.
| # set the trust range for the size distribution plot | ||
| self.size_distr_plot.show_trust_bar = True | ||
| trust_range = self.logic.computeTrustRange(qmin_fit, qmax_fit) | ||
| self.size_distr_plot.trust_range = { | ||
| "d_low": trust_range[0], | ||
| "d_high": trust_range[1], | ||
| } |
There was a problem hiding this comment.
This code is in the wrong place. It in fact already exists in SizeDistributionlogic, The problem is that currently returns a 2 point plot as self.trust_plot (see line 639). the code in SizeDistributionlogic.newSizeDistrPlot can be considerably simplified by getting rid of all the complicated cruft used to kludge the two lines (the trust_plot) and just return d_low and d_high directly in lieu of the trust_plot which we no longer need. This also solves the problem of having the two kludgy trust lines on top of the nice trust bar we should have had to start.
I suspect that also would allow us to get rid of the DataRole.ROLE_SIZE_DISTRIBUTION specific role and all the infrastructure that depends on it. As I recall that was done specifically to deal with the vline 2 point data? One would need to do a search to make sure it is properly extracted.
|
I found a better way to implement this, which is much simpler and works much better with the log scale. Will change to that instead. |
7d5ee06 to
59d24f1
Compare
|
@butlerpd I have implemented a different approach to creating the trust bar, and it now aligns properly with the lines. Could you please test this one out and let me know if all looks good? I will then remove the lines. Also, I don't think the data role can be removed, as it is handling other things, not the lines. |
butlerpd
left a comment
There was a problem hiding this comment.
The bars now line up indeed. I also tried zooming on the plot and it worked as well. I see what you mean by the old method now. That was an image I guess? which explains a bit of why it shrank a bit differently on log vs linear scale?
As for the ROLE, you may be right. I'm vaguely remembering that it if a regular plot it was wanting to overlay the original data maybe on the plot by default? In which case it needs to stay.
I also so the changes you reverted so we could check how the lines matched the bar (thanks for doing that) and they looked right to me. So if you go ahead and reinstall them this should be ready to merge.
|
Changes checked and approved. I note that you opted to remove the calculation of the trust region from the logic.py completely and go back to your implementation in sizedistribution.py That works too. Feel free to merge at any time. Look forward to seeing all 3 size distribution improvements together. |
Description
Fixes #3271
This PR adds a Trust Bar to the Size Distribution perspective, inspired by IRENA-style plots. The bar visually indicates which diameter region is reliable based on the fitted Q-range, using a smooth red/yellow/green gradient.
Key changes
Adds a horizontal trust bar above the size distribution plot.
Uses two physical trust boundaries derived from the fit range as defined in
SizeDistributionLogic:Displays:
A small helper class (TrustBar) handles:
The bar stays aligned when the plot is zoomed or rescaled.
How Has This Been Tested?
Manually tested functionality.
Review Checklist:
Documentation
Installers
Licensing