-
Notifications
You must be signed in to change notification settings - Fork 126
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
Update Unit Tests in PolarizationEffiency Cor #38458
Update Unit Tests in PolarizationEffiency Cor #38458
Conversation
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.
The reduction in code duplication is already looking really good. I have a few suggestions for ways that we might be able to continue to build on this. It would also be really good to try and make more use of constants where we can too.
- wrote unit tests to check that wildes method perform well when spinstates is added - wrote unit tests to check that fredrik method throws exception when tested with wildes-only properties spinstates and flippers - wrote unit tests to check that fredrikze method can take AddSpinStateToLog property - refactored unit tests for maintainability
4b77f47
to
9aec5e6
Compare
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.
This is looking much more maintainable than it was, thanks very much for the changes so far! There are a couple of further comments I had.
- created efficiency output workspace method to cater for duplication in createEfficiencyWorkspace - moved functions from setAlgorithmProperties to createAlgorithm method
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.
There are some really significant improvements in this test class now, thanks very much. There are just a couple more things I noticed, but those should be the last bits I think.
} | ||
|
||
MatrixWorkspace_sptr createEfficiencyOutputWorkspace(size_t size = 10, double endX = 10) { | ||
auto ws1 = createPointWS(size, 0, endX); |
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 think we need to pass through the kind
parameter from createEfficiencies
and use that to determine what type of workspaces to create. It looks like originally we would call createPointWs
for points
and point-short
, but if kind == "histo"
then we should be calling createHistoWS
.
alg->setProperty("InputWorkspaces", inputs); | ||
alg->execute(); | ||
WorkspaceGroup_sptr out = AnalysisDataService::Instance().retrieveWS<WorkspaceGroup>(OUTPUT_GRP_NAME); | ||
checkOutputWorkspaceGroupSize(4); | ||
|
||
for (size_t i = 0; i < out->size(); ++i) { |
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.
In test_points
and test_points_short
we're comparing the output and input workspaces using the CompareWorkspaces
algorithm. As the code for setting up and calling this algorithm is duplicated between the two tests, could we pull this into a helper method?
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.
This refactor has significantly reduced the code duplication and should make it much easier to maintain and extend the tests in future. All code review comments have been addressed and all tests are passing. Thanks very much @yusufjimoh for all your hard work on this one.
This is a squashed version of mantidproject#38458 Update Unit Tests in PolarizationEffiency Cor - wrote unit tests to check that wildes method perform well when spinstates is added - wrote unit tests to check that fredrik method throws exception when tested with wildes-only properties spinstates and flippers - wrote unit tests to check that fredrikze method can take AddSpinStateToLog property - refactored unit tests for maintainability updated hardcoded strings to use private variables refactored unit tests to reduce redudancies Simplify Tests based on code review suggestions - created efficiency output workspace method to cater for duplication in createEfficiencyWorkspace - moved functions from setAlgorithmProperties to createAlgorithm method remove duplication in test_point methods refactor createEfficiencyOutputWorkspace method
Description of work
Fixes #38287
To test:
This does not require release notes because it involves updating the unit tests