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
Change the default global_normalisation
from the maximum value of dose_reference
to dose_evaluation
#1604
Conversation
line 92, and line 253, change "dose_reference" to "dose_evaluation" as the default global_normalisation
@Matthew-Jennings, do you have any thoughts on this change? Do you happen to know what other Gamma software has implemented by default? |
@guanfada are you able to track down where the following test is within PyMedPhys and update the baseline value now that the default normalisation has changed: https://github.com/pymedphys/pymedphys/runs/4636766556?check_suite_focus=true#step:39:246 |
@pchlap might you have the chance to have a look at why the entire file is set as lines changed: https://github.com/pymedphys/pymedphys/pull/1604/files I suspect potentially there are different line endings being used. In that case we should add the following pre-commit hook to enforce https://github.com/pre-commit/pre-commit-hooks/pull/233/files What do you think? |
I think it's a good idea. I managed to approve the referenced pre commit PR without realising it was someone else's project. I have not looked at the PR here other than to note that it doesn't seem to have made it through the guantlet |
I don't understand why there is error for "tests/gamma/test_agnew_mcgarry.py:119: AssertionError" |
You're right, that is very odd. Might you be in a position to investigate where the issue may have cropped up? |
Sure, I will be on it. |
@SimonBiggs @Matthew-Jennings |
A downside of ignoring it and letting it change from commit to commit, is if a file did not change except for the line endings in some locations that would result in an entirely different hash for that file, resulting in an equivalent file needing to be re-saved within the git tree. I think I'd prefer to have a tool that simply forces the line endings to not have carriage returns. (git can be configured to silently remove all carriage returns within the commit, but leave the carriage returns within the file saved on disk, I believe it is the default when you install git on Windows). ...it's odd to me that GitHub doesn't do the same thing... |
@guanfada I've also found the language of "evaluation" and "reference" ambiguous. Within your comment (#1603 (comment)) you reference TG218. They use the language "planned" for evaluation and "measured" for reference. This use of evaluation and reference is also what Low used in his original paper (except he called it calculated and measured). I think there would be a benefit and a reduction of ambiguity (resulting in more consistency in the use of the library) if instances of the word evaluation were changed to "planned" and reference was changed to "measured". We would need to still keep the current API for backwards compatibility, however it would be marked deprecated, and when it is used a deprecated warning will be provided to the user. I think it would also be helpful when referring to these different dose distributions within the docs to make it clear that the planned/evaluation is the distribution being "searched over" and the measured/reference is the one from which the fixed points are being taken (and therefore the final gamma distribution matches that of the reference coords, not the evaluation coords). And also, when the planned/evaluation distribution is monte-carlo derived the noise within the planned distribution will result in the gamma search approach artificially inflating the passing rate. What is everyone's thoughts? |
I didn't intend to suggest that these should be ignored, but I also didn't want to start comparing specific diff tools. My preferred diff tool allows one to toggle between identifying 'minor' differences or not, which comes down to things like newline, tab, space, and carriage return. It's not intended for automation, but to ease the cognitive burden on the reviewer when the reviewer deems it appropriate. I am a big fan of lowering cognitive burden in code review (I spend nearly half my time doing code review...) Given how PyMedPhys is organised, I agree with the idea of enforcing the stripping of Carriage Return as part of pre-commit or commit. |
Yeah, that makes a massive amount of sense. (One of the reasons I really like black) |
I agree to your comments. @SimonBiggs |
Hi @guanfada, I've fixed the line-endings issue from prior, so this PR is a little more manageable. Might you be in a position to complete the following task?
|
global_normalisation
from the maximum value of dose_reference
to dose_evaluation
@SimonBiggs I will work on it this weekend. Thanks. |
Thanks @guanfada, No stress if you can't! :) Only if it's something you'd enjoy doing. (There are many other enjoyable things one can do on a weekend 🙂) |
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.
global_normalisation has been changed to np.max(dose_evaluation)
what should I do to complete this merge? Thanks @SimonBiggs |
If you pull the code locally and then run |
I just ran it locally. what's the next step? @SimonBiggs |
Next step is a bit of a problem solving one, one needs to work out why the tests are failing because of this change... and then fix either the tests or the code... |
Do I need to submit a new PR?
What commands do I need to do next?
I forgot those steps you told me.
Thanks.
… On Apr 3, 2022, at 2:41 AM, Simon Biggs ***@***.***> wrote:
I just ran it locally. poetry run pymedphys dev tests
what's the next step? @SimonBiggs
Next step is a bit of a problem solving one, one needs to work out why the tests are failing because of this change... and then fix either the tests or the code...
—
Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you were mentioned.
|
Hi @sjswerdloff or @pchlap, Might either of you be in a position to help here? (Or @Matthew-Jennings if you're available) |
@SimonBiggs |
Sure @SimonBiggs, I'll give it a try.
@guanfada, I'm not particularly familiar with this portion of the code, but perhaps we can figure this out together. As you mentioned above you aren't expecting this test to fail since your change should only affect the local gamma. However, the function modified runs for both local and global gamma. There is a parameter passed to indicate if The following would make the test pass.... But I am not familiar enough with local vs global gamma to know if this is what we actually want here or not. if global_normalisation is None:
if local_gamma:
global_normalisation = np.max(dose_reference)
else:
global_normalisation = np.max(dose_evaluation) What do you think? |
Hi all, I'm sorry I missed this discussion.
I strongly prefer the current nomenclature of "reference/evaluation" over "planned/measured". Not all applications of gamma represent comparisons between planned and measured dose distributions. Planned vs. planned is itself very common now. Moreover, the choice of whether a "planned" or "measured" dose distribution should represent the reference dose distribution is itself application-specific.
But I do agree with these two points, excluding the "planned/measured" nomenclature point. I'll quickly check which dose distribution Verisoft uses for global normalisation. Maybe FilmQApro too. (I'm now in a non-clinical role and don't recall). If there's inconsistency, it's not clear to me which distribution to choose as the default for normalisation. EDIT: Perhaps a compromise to address the ambiguity that @SimonBiggs describes is to include an example in the docs (likely @nlambriICH's tute!) that demonstrates a common scenario of comparing planned to measured doses. |
Let me know how you go on this front. I suspect it will be the decider on whether or not to move forward with this or close this PR. |
Will do. I'll try for Monday. |
@Matthew-Jennings @SimonBiggs |
Yes of course. Essentially just set the parameter |
As a note from above (which I had forgotten) @guanfada had already checked the Delta4 manual and it states that it normalises based on the evaluation grid (opposite to what is currently implemented here). |
@SimonBiggs Nevertheless, after my recent investigation, I feel it is best for us to just keep the global_normalisation as the maximum of dose_reference. My reasons are as follows: (5), this is the main reason that stops me to make changes. And then we show the results on the "reference" slices. In all, I would like to withdraw my request to change the default global normalisation factor. |
I'm okay with that 🙂. I think at the end of the day the best path forward might be what @Matthew-Jennings suggested:
Ideally we would empower users to make an informed sensible choice 🙂, while also providing sensible defaults 🙂. |
line 92, and line 253, change "dose_reference" to "dose_evaluation" as the default global_normalisation
Edit by @SimonBiggs
See #1603 (comment) for reasoning