Fix Parameter Loading Bug for conflicted names#41380
Open
andy-bridger wants to merge 4 commits into
Open
Conversation
bbcde68 to
519cee5
Compare
Contributor
warunawickramasingha
left a comment
There was a problem hiding this comment.
Code changes look good and tested to be giving the results as described. Only a couple of doubts to clarify.
- I can see some differences in fitting parameter vales in the two tables from the main branch and this branch. Is that expected?
- Are the new methods in the
ParameterMapsupposed to be thread safe?
Comment on lines
+1276
to
+1278
| const auto lastNonSpace = fittingFunction.find_last_not_of(" \t"); | ||
| if (firstNonSpace != std::string::npos) | ||
| fittingFunction = fittingFunction.substr(firstNonSpace, lastNonSpace - firstNonSpace + 1); |
Contributor
There was a problem hiding this comment.
To save the second scan incase of an empty string
Suggested change
| const auto lastNonSpace = fittingFunction.find_last_not_of(" \t"); | |
| if (firstNonSpace != std::string::npos) | |
| fittingFunction = fittingFunction.substr(firstNonSpace, lastNonSpace - firstNonSpace + 1); | |
| if (firstNonSpace != std::string::npos) { | |
| const auto lastNonSpace = fittingFunction.find_last_not_of(" \t"); | |
| fittingFunction = fittingFunction.substr(firstNonSpace, lastNonSpace - firstNonSpace + 1); | |
| } |
| if (existing->type() == "fitting" && strcasecmp(existing->nameAsCString(), name.c_str()) == 0) { | ||
| try { | ||
| if (existing->value<FitParameter>().getFunction() == fittingFunction) { | ||
| std::atomic_store(&(itr->second), param); |
Contributor
There was a problem hiding this comment.
Is this addFittingParameter method supposed to be thread safe?
Contributor
|
👋 Hi, @andy-bridger, Conflicts have been detected against the base branch. Please rebase your branch against the base branch. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of work
Currently there is a bug for loading default fitting parameters from Parameters files which is that the parameter is cached in the IDF, not by name and function, just by name. This can cause functions with identical parameter names to overwrite in the cache e.g.
Bk2BkExpConvPV:GammaandIkedaCarpenterPV:Gamma.Additionally this is stored in the parameter map only as the name (so had both survived the first step they would be lost here)
When the parameter is loaded by being found by
paramMap.getRecursive(detector, "Gamma", "fitting")IFunction will find the first reference to Gamma, check that the function name matches and if it doesn't (because it has been overwritten) loading is skipped and the parameter hints are not used.The change has been:
Closes #xxxx.
To test:
ENGINX_305738_361838_bank_dSpacing.nxs.txt
You can run the following script on main and this branch:
Main results:
This branch:
Reviewer
Your comments will be used as part of the gatekeeper process. Comment clearly on what you have checked and tested during your review. Provide an audit trail for any changes requested.
As per the review guidelines:
mantid-developersormantid-contributorsteams, add a review commentrerun cito authorize/rerun the CIGatekeeper
As per the gatekeeping guidelines: