-
Notifications
You must be signed in to change notification settings - Fork 127
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
Allow User-Configured Input Spin State Orders From The GUI & Parameter File #38783
base: main
Are you sure you want to change the base?
Allow User-Configured Input Spin State Orders From The GUI & Parameter File #38783
Conversation
65bed42
to
72f3e53
Compare
72f3e53
to
0fa794a
Compare
This is needed for batch saving/loading and for project recovery. RE mantidproject#37617
0fa794a
to
59cef31
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.
I have followed the testing instructions, I found an issue with the validation of the flipper setup in the idf file that maybe we should look into in a separate issue.
Aside that, the code changes look good and the GUI is behaving as expected. Thanks for updating the testing instructions too.
I have added some other minor comments.
self.declareProperty( | ||
"FredrikzePolarizationSpinStateOrder", | ||
"", | ||
"The spin state order of the workspaces in the workspace group to be passed to " |
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 description for this property is very nice.
We could maybe extend the documentation page of the Reflectometry Reduction One Auto
algorithm (adding couple of lines) being a bit more explicit on how the setting is added on the parameters file using the WildesFlipperConfig
field?
@@ -88,8 +88,9 @@ class MANTID_REFLECTOMETRY_DLL ReflectometryReductionOneAuto3 : public Reflectom | |||
const Mantid::Geometry::Instrument_const_sptr &instrument); | |||
std::string findPolarizationCorrectionMethod(const API::MatrixWorkspace_sptr &efficiencies); | |||
std::string findPolarizationCorrectionOption(const std::string &correctionMethod); | |||
std::string getFredrikzeInputSpinStateOrder(std::string const &correctionMethod); |
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 file is mostly written in West const convention, would it be possible to change it here to make it more homogeneous ?
// We're setting this to an invalid value to catch it on purpose later. | ||
input_group[0]->instrumentParameters().addString(input_group[0]->getInstrument()->getComponentID(), | ||
"WildesFlipperConfig", "01,01,10"); | ||
auto efficiencies = createPolarizationEfficienciesWorkspace("Wildes"); |
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 going to mention that the setup for these algorithms could be clustered into a separate method, but it seems most of the tests in this suite are prepared within the test method, maybe we should open an issue to refactor this test suite and reduce duplicate lines.
return getText(*m_ui.polCorrFredrikzeSpinStateEdit); | ||
} | ||
|
||
void QtExperimentView::setFredrikzeSpinStateOrder(const std::string &spinStates) { |
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 signature here is west const and in the method declaration is east const . Could you make them the same constness?
@@ -47,14 +47,17 @@ inline std::string polarizationCorrectionTypeToString(PolarizationCorrectionType | |||
class MANTIDQT_ISISREFLECTOMETRY_DLL PolarizationCorrections { | |||
public: | |||
explicit PolarizationCorrections(PolarizationCorrectionType correctionType, | |||
boost::optional<std::string> workspace = boost::none); | |||
boost::optional<std::string> workspace = boost::none, |
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.
Would it be possible to substitute the boost::optionals in this file for the std::optionals?
@@ -83,6 +83,10 @@ | |||
<value val="0.972762,0.001828,-0.000261,0.0"/> | |||
</parameter> | |||
|
|||
<parameter name="WildesFlipperConfig" type="string"> | |||
<value val="00,01,10,11" /> |
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.
See comment about the flippers , but currently this should be rewritten as :
<value val="00,01,10,11" /> | |
<value val="00, 01, 10, 11" /> |
@@ -56,8 +56,8 @@ void validate(const std::string &method) { | |||
namespace CorrectionOption { | |||
static const std::string PNR{"PNR"}; | |||
static const std::string PA{"PA"}; | |||
static const std::string FLIPPERS_NO_ANALYSER{"0, 1"}; | |||
static const std::string FLIPPERS_FULL{"00, 01, 10, 11"}; | |||
static const std::string DEFAULT_FLIPPERS_NO_ANALYSER{"0, 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.
I have found a problem with the input of the wildes flipper setup. PolarizedEfficiencyCorr
algorithm is validating against a list of strings, and the possible values for flipper configurations are adding a whitespace after the comma (as in here). But in other places of this pr, like the tests or the POLREF_parameters file the configuration is added as : "00,01,10,11" without whitespaces, which causes an error. This is not happening with fredrikze states because it uses a spin state validator.
We should maybe handle better the validation for flipper inputs so that users typing for example "0,1" don't get an error. But this maybe outside the scope of this pr. At least We should maybe add some more information in the documentation or the error message to let the user know what is the correct format.
auto input_group = retrieveOutWS(name); | ||
// We're setting this to an invalid value to catch it on purpose later. | ||
input_group[0]->instrumentParameters().addString(input_group[0]->getInstrument()->getComponentID(), | ||
"WildesFlipperConfig", "00,11,01,10"); |
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.
"WildesFlipperConfig", "00,11,01,10"); | |
"WildesFlipperConfig", "00, 11, 01, 10"); |
Description of work
Summary of work
Adds two adjacent features to support the polarised reduction through the reflectometry interface.
Wildes
Fredrikze
Fixes #37617
To test:
Wildes
eff_wildes
workspace from the Polarization Efficiencies dropdown00,01,10,11
to0,1
to see it succeed.Fredrikze
eff_fredrikze
workspace from the polarization efficiencies dropdownpa,ap,pp,aa
p, a
Reviewer
Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.
Code Review
Functional Tests
Does everything look good? Mark the review as Approve. A member of
@mantidproject/gatekeepers
will take care of it.Gatekeeper
If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.