-
Notifications
You must be signed in to change notification settings - Fork 5
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
Adds code to ensure parameter array indices are valid #236
Conversation
qzshiftArray, scalefactorArray, bulkInArray, bulkOutArray, resolutionParamArray,... | ||
domainRatioArray, dataPresent, nParams, params, ~, resample,... | ||
contrastBackgroundActions, cCustFiles, useImaginary] = extractProblemParams(problemStruct); | ||
|
||
checkIndices(contrastBackgroundIndices, contrastQzshiftIndices,... |
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.
Is it possible to do this check earlier maybe in parseClassToStructs
? This should reduce duplication and any chance of affecting performance. The function can take problemStruct as input also
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 was cautious owing to the fact that the reflectivity calculation is performed numerous times within the minimisers, with changes to problemStruct. Having looked through carefully though, it seems like the changes made in unpackParams cannot affect the length of the parameter arrays, so we should be ok. Let me know if you can think of anything that might be affected though.
API/projectClass/contrastsClass.m
Outdated
@@ -71,7 +71,7 @@ | |||
contrastBackgroundActions = cell(1,nContrasts); | |||
contrastBulkIns = ones(1,nContrasts); | |||
contrastBulkOuts = ones(1,nContrasts); | |||
contrastDomainRatios = zeros(1,nContrasts); | |||
contrastDomainRatios = ones(1,nContrasts); |
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 am not sure why this is changed?
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 for consistency with the rest of the arrays and tests now that each entry is filled in or set to -1
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 cautious we don't break something by changing the default. Is it possible one of the contrast does not have a domain ratio property but the value defaults to 1 now instead of the original 0?
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.
A few lines further down, we loop through each contrast and set the value if the contrast has a domain ratio, or set it to -1. I therefore can't see any issue with this change. Having said that, I take your point that there is potential for problems with this default, so I'll change back. I'm inclined to think, especially with the check indices routine now present, that setting all of these to a default of zero is the better option. One to talk over on Monday maybe?
No description provided.