diff --git a/Framework/Algorithms/src/ReflectometryReductionOneAuto3.cpp b/Framework/Algorithms/src/ReflectometryReductionOneAuto3.cpp index 3600916e36df280cd5d0bcbd9b5d69a10ceb4e3e..3a5d955cab2f2c7b7251e19a6584ac0e99ec2003 100644 --- a/Framework/Algorithms/src/ReflectometryReductionOneAuto3.cpp +++ b/Framework/Algorithms/src/ReflectometryReductionOneAuto3.cpp @@ -5,9 +5,9 @@ // & Institut Laue - Langevin // SPDX - License - Identifier: GPL - 3.0 + #include "MantidAlgorithms/ReflectometryReductionOneAuto3.h" +#include "MantidAPI/BoostOptionalToAlgorithmProperty.h" #include "MantidAPI/MatrixWorkspace.h" #include "MantidAPI/WorkspaceGroup.h" -#include "MantidAlgorithms/BoostOptionalToAlgorithmProperty.h" #include "MantidKernel/ArrayProperty.h" #include "MantidKernel/CompositeValidator.h" #include "MantidKernel/EnabledWhenProperty.h" @@ -15,7 +15,6 @@ #include "MantidKernel/MandatoryValidator.h" #include "MantidKernel/RegexStrings.h" #include "MantidKernel/Strings.h" -#include "MantidKernel/make_unique.h" #include <boost/lexical_cast.hpp> #include <boost/regex.hpp> @@ -246,7 +245,7 @@ void ReflectometryReductionOneAuto3::init() { // Input ws declareProperty( - make_unique<WorkspaceProperty<MatrixWorkspace>>( + std::make_unique<WorkspaceProperty<MatrixWorkspace>>( "InputWorkspace", "", Direction::Input, PropertyMode::Mandatory), "Input run in TOF or wavelength"); @@ -264,7 +263,7 @@ void ReflectometryReductionOneAuto3::init() { Direction::Input); // Processing instructions - declareProperty(make_unique<PropertyWithValue<std::string>>( + declareProperty(std::make_unique<PropertyWithValue<std::string>>( "ProcessingInstructions", "", Direction::Input), "Grouping pattern of spectrum numbers to yield only the" " detectors of interest. See GroupDetectors for syntax."); @@ -279,8 +278,8 @@ void ReflectometryReductionOneAuto3::init() { // Whether to correct detectors declareProperty( - make_unique<PropertyWithValue<bool>>("CorrectDetectors", true, - Direction::Input), + std::make_unique<PropertyWithValue<bool>>("CorrectDetectors", true, + Direction::Input), "Moves detectors to twoTheta if ThetaIn or ThetaLogName is given"); // Detector position correction type @@ -297,7 +296,7 @@ void ReflectometryReductionOneAuto3::init() { "should be shifted vertically or rotated around the sample position.", Direction::Input); setPropertySettings("DetectorCorrectionType", - make_unique<Kernel::EnabledWhenProperty>( + std::make_unique<Kernel::EnabledWhenProperty>( "CorrectDetectors", IS_EQUAL_TO, "1")); // Wavelength limits @@ -319,8 +318,8 @@ void ReflectometryReductionOneAuto3::init() { initMomentumTransferProperties(); // Polarization correction - declareProperty(make_unique<PropertyWithValue<bool>>("PolarizationAnalysis", - false, Direction::Input), + declareProperty(std::make_unique<PropertyWithValue<bool>>( + "PolarizationAnalysis", false, Direction::Input), "Apply polarization corrections"); // Flood correction @@ -332,7 +331,7 @@ void ReflectometryReductionOneAuto3::init() { "workspace, ParameterFile - use parameters in the parameter " "file to construct and apply flood correction workspace."); declareProperty( - make_unique<WorkspaceProperty<MatrixWorkspace>>( + std::make_unique<WorkspaceProperty<MatrixWorkspace>>( "FloodWorkspace", "", Direction::Input, PropertyMode::Optional), "A flood workspace to apply; if empty and FloodCorrection is " "'Workspace' then no correction is applied."); @@ -341,19 +340,19 @@ void ReflectometryReductionOneAuto3::init() { initDebugProperties(); // Output workspace in Q - declareProperty(make_unique<WorkspaceProperty<MatrixWorkspace>>( + declareProperty(std::make_unique<WorkspaceProperty<MatrixWorkspace>>( "OutputWorkspaceBinned", "", Direction::Output, PropertyMode::Optional), "Output workspace in Q (rebinned workspace)"); // Output workspace in Q (unbinned) declareProperty( - make_unique<WorkspaceProperty<MatrixWorkspace>>( + std::make_unique<WorkspaceProperty<MatrixWorkspace>>( "OutputWorkspace", "", Direction::Output, PropertyMode::Optional), "Output workspace in Q (native binning)"); // Output workspace in wavelength - declareProperty(make_unique<WorkspaceProperty<MatrixWorkspace>>( + declareProperty(std::make_unique<WorkspaceProperty<MatrixWorkspace>>( "OutputWorkspaceWavelength", "", Direction::Output, PropertyMode::Optional), "Output workspace in wavelength"); diff --git a/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/BatchPresenter.cpp b/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/BatchPresenter.cpp index 1cf1fb02c5add5db84fa3f469e2995b3a9d4484c..73d946eceb352fb7e73f2bcbda64f4fe37554354 100644 --- a/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/BatchPresenter.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/BatchPresenter.cpp @@ -289,6 +289,13 @@ Mantid::Geometry::Instrument_const_sptr BatchPresenter::instrument() const { return m_instrument; } +std::string BatchPresenter::instrumentName() const { + if (m_instrument) + return m_instrument->getName(); + + return std::string(); +} + void BatchPresenter::settingsChanged() { m_runsPresenter->settingsChanged(); } /** diff --git a/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/BatchPresenter.h b/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/BatchPresenter.h index f2a56ba7ff72ea139ba30d2eb66941d81436168a..1f0f273ea09a80f9a3a966d64233d5ac5ea00559 100644 --- a/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/BatchPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/BatchPresenter.h @@ -70,6 +70,7 @@ public: bool isAutoreducing() const override; bool isAnyBatchAutoreducing() const override; Mantid::Geometry::Instrument_const_sptr instrument() const override; + std::string instrumentName() const override; int percentComplete() const override; AlgorithmRuntimeProps rowProcessingProperties() const override; diff --git a/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/IBatchPresenter.h b/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/IBatchPresenter.h index 6e611e487f5b07cce90c1565c75dda6378ac2b46..963e81315a6f1d9bbbf45bce6e6e138d21e3e9a4 100644 --- a/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/IBatchPresenter.h +++ b/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/IBatchPresenter.h @@ -50,6 +50,7 @@ public: virtual AlgorithmRuntimeProps rowProcessingProperties() const = 0; virtual Mantid::Geometry::Instrument_const_sptr instrument() const = 0; + virtual std::string instrumentName() const = 0; }; } // namespace CustomInterfaces } // namespace MantidQt diff --git a/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/RowProcessingAlgorithm.cpp b/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/RowProcessingAlgorithm.cpp index 32bd6076f5dbb810e15f5e358ada2af5b8f1c779..6835be161bd6786abb6e97207d898f8b3a5ab81e 100644 --- a/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/RowProcessingAlgorithm.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/GUI/Batch/RowProcessingAlgorithm.cpp @@ -87,18 +87,7 @@ void updatePolarizationCorrectionProperties( if (corrections.correctionType() == PolarizationCorrectionType::None) return; - AlgorithmProperties::update( - "PolarizationAnalysis", - polarizationCorrectionTypeToString(corrections.correctionType()), - properties); - - if (corrections.correctionType() == PolarizationCorrectionType::PA || - corrections.correctionType() == PolarizationCorrectionType::PNR) { - AlgorithmProperties::update("CRho", corrections.cRho(), properties); - AlgorithmProperties::update("CAlpha", corrections.cRho(), properties); - AlgorithmProperties::update("CAp", corrections.cRho(), properties); - AlgorithmProperties::update("CPp", corrections.cRho(), properties); - } + AlgorithmProperties::update("PolarizationAnalysis", true, properties); } void updateFloodCorrectionProperties(AlgorithmRuntimeProps &properties, diff --git a/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentPresenter.cpp b/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentPresenter.cpp index f93a8a154d282858abdbad42b10a20444839b3e8..a93ee13aa6765c748cd75b9053ee138addf8591f 100644 --- a/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentPresenter.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentPresenter.cpp @@ -133,26 +133,12 @@ void ExperimentPresenter::restoreDefaults() { } PolarizationCorrections ExperimentPresenter::polarizationCorrectionsFromView() { - auto const correctionType = polarizationCorrectionTypeFromString( - m_view->getPolarizationCorrectionType()); - - if (polarizationCorrectionRequiresInputs(correctionType)) { - return PolarizationCorrections(correctionType, m_view->getCRho(), - m_view->getCAlpha(), m_view->getCAp(), - m_view->getCPp()); - } - + auto const correctionType = m_view->getPolarizationCorrectionOption() + ? PolarizationCorrectionType::ParameterFile + : PolarizationCorrectionType::None; return PolarizationCorrections(correctionType); } -void ExperimentPresenter::updatePolarizationCorrectionEnabledState() { - if (polarizationCorrectionRequiresInputs( - m_model.polarizationCorrections().correctionType())) - m_view->enablePolarizationCorrectionInputs(); - else - m_view->disablePolarizationCorrectionInputs(); -} - FloodCorrections ExperimentPresenter::floodCorrectionsFromView() { auto const correctionType = floodCorrectionTypeFromString(m_view->getFloodCorrectionType()); @@ -164,6 +150,19 @@ FloodCorrections ExperimentPresenter::floodCorrectionsFromView() { return FloodCorrections(correctionType); } +void ExperimentPresenter::updatePolarizationCorrectionEnabledState() { + // We could generalise which instruments polarization corrections are + // applicable for but for now it's not worth it, so just hard code the + // instrument names. + auto const instrumentName = m_mainPresenter->instrumentName(); + if (instrumentName == "INTER" || instrumentName == "SURF") { + m_view->setPolarizationCorrectionOption(false); + m_view->disablePolarizationCorrections(); + } else { + m_view->enablePolarizationCorrections(); + } +} + void ExperimentPresenter::updateFloodCorrectionEnabledState() { if (floodCorrectionRequiresInputs( m_model.floodCorrections().correctionType())) @@ -309,8 +308,9 @@ void ExperimentPresenter::updateViewFromModel() { m_model.transmissionStitchOptions().rebinParameters()); m_view->setTransmissionScaleRHSWorkspace( m_model.transmissionStitchOptions().scaleRHS()); - m_view->setPolarizationCorrectionType(polarizationCorrectionTypeToString( - m_model.polarizationCorrections().correctionType())); + m_view->setPolarizationCorrectionOption( + m_model.polarizationCorrections().correctionType() != + PolarizationCorrectionType::None); m_view->setFloodCorrectionType( floodCorrectionTypeToString(m_model.floodCorrections().correctionType())); if (m_model.floodCorrections().workspace()) diff --git a/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentView.cpp b/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentView.cpp index e23c5870f1df3e56cf6751f33cda7e1ca42e830f..14e3da059ed359210e9c5a2befd8cc4a036dba6a 100644 --- a/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentView.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentView.cpp @@ -208,11 +208,7 @@ void ExperimentView::setEnabledStateForAllWidgets(bool enabled) { m_ui.endOverlapEdit->setEnabled(enabled); m_ui.transStitchParamsEdit->setEnabled(enabled); m_ui.transScaleRHSCheckBox->setEnabled(enabled); - m_ui.polCorrComboBox->setEnabled(enabled); - m_ui.CRhoEdit->setEnabled(enabled); - m_ui.CAlphaEdit->setEnabled(enabled); - m_ui.CApEdit->setEnabled(enabled); - m_ui.CPpEdit->setEnabled(enabled); + m_ui.polCorrCheckBox->setEnabled(enabled); stitchOptionsLineEdit().setEnabled(enabled); m_ui.reductionTypeComboBox->setEnabled(enabled); m_ui.summationTypeComboBox->setEnabled(enabled); @@ -238,11 +234,7 @@ void ExperimentView::registerExperimentSettingsWidgets( registerSettingWidget(*m_ui.endOverlapEdit, "EndOverlap", alg); registerSettingWidget(*m_ui.transStitchParamsEdit, "Params", alg); registerSettingWidget(*m_ui.transScaleRHSCheckBox, "ScaleRHSWorkspace", alg); - registerSettingWidget(*m_ui.polCorrComboBox, "PolarizationAnalysis", alg); - registerSettingWidget(*m_ui.CRhoEdit, "cRho", alg); - registerSettingWidget(*m_ui.CAlphaEdit, "cAlpha", alg); - registerSettingWidget(*m_ui.CApEdit, "cAp", alg); - registerSettingWidget(*m_ui.CPpEdit, "cPp", alg); + registerSettingWidget(*m_ui.polCorrCheckBox, "PolarizationAnalysis", alg); registerSettingWidget(stitchOptionsLineEdit(), "Params", alg); registerSettingWidget(*m_ui.reductionTypeComboBox, "ReductionType", alg); registerSettingWidget(*m_ui.summationTypeComboBox, "SummationType", alg); @@ -262,11 +254,7 @@ void ExperimentView::connectExperimentSettingsWidgets() { connectSettingsChange(*m_ui.endOverlapEdit); connectSettingsChange(*m_ui.transStitchParamsEdit); connectSettingsChange(*m_ui.transScaleRHSCheckBox); - connectSettingsChange(*m_ui.polCorrComboBox); - connectSettingsChange(*m_ui.CRhoEdit); - connectSettingsChange(*m_ui.CAlphaEdit); - connectSettingsChange(*m_ui.CApEdit); - connectSettingsChange(*m_ui.CPpEdit); + connectSettingsChange(*m_ui.polCorrCheckBox); connectSettingsChange(stitchOptionsLineEdit()); connectSettingsChange(*m_ui.reductionTypeComboBox); connectSettingsChange(*m_ui.includePartialBinsCheckBox); @@ -283,11 +271,7 @@ void ExperimentView::disconnectExperimentSettingsWidgets() { disconnectSettingsChange(*m_ui.endOverlapEdit); disconnectSettingsChange(*m_ui.transStitchParamsEdit); disconnectSettingsChange(*m_ui.transScaleRHSCheckBox); - disconnectSettingsChange(*m_ui.polCorrComboBox); - disconnectSettingsChange(*m_ui.CRhoEdit); - disconnectSettingsChange(*m_ui.CAlphaEdit); - disconnectSettingsChange(*m_ui.CApEdit); - disconnectSettingsChange(*m_ui.CPpEdit); + disconnectSettingsChange(*m_ui.polCorrCheckBox); disconnectSettingsChange(stitchOptionsLineEdit()); disconnectSettingsChange(*m_ui.reductionTypeComboBox); disconnectSettingsChange(*m_ui.includePartialBinsCheckBox); @@ -430,34 +414,18 @@ void ExperimentView::setChecked(QCheckBox &checkBox, bool checked) { } void ExperimentView::enablePolarizationCorrections() { - m_ui.polCorrComboBox->setEnabled(true); - enablePolarizationCorrectionInputs(); + m_ui.polCorrCheckBox->setEnabled(true); + m_ui.polCorrLabel->setEnabled(true); } void ExperimentView::disablePolarizationCorrections() { - m_ui.polCorrComboBox->setEnabled(false); - disablePolarizationCorrectionInputs(); - // Set polarization corrections text to 'None' when disabled - setSelected(*m_ui.polCorrComboBox, "None"); - // Clear all parameters as well - m_ui.CRhoEdit->clear(); - m_ui.CAlphaEdit->clear(); - m_ui.CApEdit->clear(); - m_ui.CPpEdit->clear(); + m_ui.polCorrCheckBox->setEnabled(false); + m_ui.polCorrLabel->setEnabled(false); } -void ExperimentView::enablePolarizationCorrectionInputs() { - m_ui.CRhoEdit->setEnabled(true); - m_ui.CAlphaEdit->setEnabled(true); - m_ui.CApEdit->setEnabled(true); - m_ui.CPpEdit->setEnabled(true); -} - -void ExperimentView::disablePolarizationCorrectionInputs() { - m_ui.CRhoEdit->setEnabled(false); - m_ui.CAlphaEdit->setEnabled(false); - m_ui.CApEdit->setEnabled(false); - m_ui.CPpEdit->setEnabled(false); +void ExperimentView::disableFloodCorrectionInputs() { + m_ui.floodWorkspaceWsSelector->setEnabled(false); + m_ui.floodWorkspaceWsSelectorLabel->setEnabled(false); } void ExperimentView::enableFloodCorrectionInputs() { @@ -465,11 +433,6 @@ void ExperimentView::enableFloodCorrectionInputs() { m_ui.floodWorkspaceWsSelectorLabel->setEnabled(true); } -void ExperimentView::disableFloodCorrectionInputs() { - m_ui.floodWorkspaceWsSelector->setEnabled(false); - m_ui.floodWorkspaceWsSelectorLabel->setEnabled(false); -} - void ExperimentView::onPerAngleDefaultsChanged(int row, int column) { m_notifyee->notifyPerAngleDefaultsChanged(row, column); } @@ -565,24 +528,6 @@ void ExperimentView::createStitchHints( m_ui.expSettingsGrid->addWidget(m_stitchEdit, row, col + colSpan, 1, 3); } -double ExperimentView::getCRho() const { return m_ui.CRhoEdit->value(); } - -void ExperimentView::setCRho(double cRho) { m_ui.CRhoEdit->setValue(cRho); } - -double ExperimentView::getCAlpha() const { return m_ui.CAlphaEdit->value(); } - -void ExperimentView::setCAlpha(double cAlpha) { - m_ui.CAlphaEdit->setValue(cAlpha); -} - -double ExperimentView::getCAp() const { return m_ui.CApEdit->value(); } - -void ExperimentView::setCAp(double cAp) { m_ui.CApEdit->setValue(cAp); } - -double ExperimentView::getCPp() const { return m_ui.CPpEdit->value(); } - -void ExperimentView::setCPp(double cPp) { m_ui.CPpEdit->setValue(cPp); } - std::string ExperimentView::getFloodCorrectionType() const { return getText(*m_ui.floodCorComboBox); } @@ -744,12 +689,12 @@ void ExperimentView::showTransmissionStitchParamsInvalid() { showAsInvalid(*m_ui.transStitchParamsEdit); } -void ExperimentView::setPolarizationCorrectionType(std::string const &type) { - setSelected(*m_ui.polCorrComboBox, type); +void ExperimentView::setPolarizationCorrectionOption(bool enable) { + setChecked(*m_ui.polCorrCheckBox, enable); } -std::string ExperimentView::getPolarizationCorrectionType() const { - return getText(*m_ui.polCorrComboBox); +bool ExperimentView::getPolarizationCorrectionOption() const { + return m_ui.polCorrCheckBox->isChecked(); } std::string ExperimentView::getStitchOptions() const { diff --git a/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentView.h b/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentView.h index ccb2405bcc49af78c2db3949b722ccb3dd0e26cc..006b1124fbd0a664df18626846e594f3ac8b585f 100644 --- a/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentView.h +++ b/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentView.h @@ -75,16 +75,8 @@ public: void showTransmissionStitchParamsInvalid() override; void showTransmissionStitchParamsValid() override; - std::string getPolarizationCorrectionType() const override; - void setPolarizationCorrectionType(std::string const &type) override; - double getCRho() const override; - void setCRho(double cRho) override; - double getCAlpha() const override; - void setCAlpha(double cAlpha) override; - double getCAp() const override; - void setCAp(double cAp) override; - double getCPp() const override; - void setCPp(double cPp) override; + bool getPolarizationCorrectionOption() const override; + void setPolarizationCorrectionOption(bool enable) override; std::string getFloodCorrectionType() const override; void setFloodCorrectionType(std::string const &correction) override; @@ -106,9 +98,6 @@ public: void enablePolarizationCorrections() override; void disablePolarizationCorrections() override; - void enablePolarizationCorrectionInputs() override; - void disablePolarizationCorrectionInputs() override; - void enableFloodCorrectionInputs() override; void disableFloodCorrectionInputs() override; diff --git a/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentWidget.ui b/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentWidget.ui index 729249a5af4a0aacd1fab6be79b4dddd6c5e24f9..87ce5f4fc24be8be5c7d8acd1319b56240a3c498 100644 --- a/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentWidget.ui +++ b/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/ExperimentWidget.ui @@ -40,7 +40,7 @@ <number>5</number> </property> <item> - <layout class="QGridLayout" name="expSettingsGrid" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" columnstretch="0,1,0,1,0"> + <layout class="QGridLayout" name="expSettingsGrid" rowstretch="0,0,0,0,0,0,0,0,0,0,0,0,0,0,0" columnstretch="0,0,0,0"> <property name="leftMargin"> <number>10</number> </property> @@ -53,8 +53,21 @@ <property name="bottomMargin"> <number>10</number> </property> - <item row="10" column="0"> - <widget class="QLabel" name="polCorrLabel"> + <item row="9" column="3"> + <widget class="QCheckBox" name="transScaleRHSCheckBox"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="13" column="0"> + <widget class="QLabel" name="stitchLabel"> <property name="minimumSize"> <size> <width>117</width> @@ -62,12 +75,12 @@ </size> </property> <property name="text"> - <string>Polarisation Corrections</string> + <string>Output Stitch Params</string> </property> </widget> </item> - <item row="8" column="0"> - <widget class="QLabel" name="startOverlapLabel"> + <item row="1" column="2"> + <widget class="QLabel" name="debugLabel"> <property name="minimumSize"> <size> <width>117</width> @@ -75,33 +88,76 @@ </size> </property> <property name="text"> - <string>Transmission Run Overlap Start</string> + <string>Debug</string> </property> </widget> </item> - <item row="13" column="2"> - <widget class="QLabel" name="floodWorkspaceWsSelectorLabel"> + <item row="2" column="0"> + <widget class="QLabel" name="summationTypeLabel"> + <property name="minimumSize"> + <size> + <width>117</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>SummationType</string> + </property> + </widget> + </item> + <item row="14" column="3"> + <widget class="QPushButton" name="getExpDefaultsButton"> <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> + <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> <property name="minimumSize"> <size> - <width>117</width> - <height>0</height> + <width>71</width> + <height>32</height> </size> </property> + <property name="layoutDirection"> + <enum>Qt::RightToLeft</enum> + </property> <property name="text"> - <string>Flood Workspace</string> + <string>Restore Defaults</string> + </property> + <property name="fixedWidth" stdset="0"> + <number>70</number> + </property> + <property name="fixedHeight" stdset="0"> + <number>100</number> </property> + <layout class="QHBoxLayout" name="getExpDefaultsButtonLayout"/> </widget> </item> - <item row="3" column="3"> - <widget class="QCheckBox" name="includePartialBinsCheckBox"> - <property name="enabled"> - <bool>false</bool> + <item row="10" column="1"> + <widget class="QCheckBox" name="polCorrCheckBox"> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="8" column="1"> + <widget class="QDoubleSpinBox" name="startOverlapEdit"> + <property name="decimals"> + <number>5</number> + </property> + <property name="maximum"> + <double>100000.000000000000000</double> + </property> + </widget> + </item> + <item row="11" column="3"> + <widget class="MantidQt::MantidWidgets::WorkspaceSelector" name="floodWorkspaceWsSelector"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> </property> <property name="minimumSize"> <size> @@ -109,13 +165,10 @@ <height>0</height> </size> </property> - <property name="text"> - <string/> - </property> </widget> </item> - <item row="9" column="2"> - <widget class="QLabel" name="transmissionScaleRHSLabel"> + <item row="11" column="0"> + <widget class="QLabel" name="floodCorLabel"> <property name="minimumSize"> <size> <width>117</width> @@ -123,15 +176,12 @@ </size> </property> <property name="text"> - <string>Scale RHS Transmission</string> + <string>Flood Correction</string> </property> </widget> </item> - <item row="3" column="1"> - <widget class="QComboBox" name="reductionTypeComboBox"> - <property name="enabled"> - <bool>false</bool> - </property> + <item row="1" column="1"> + <widget class="QComboBox" name="analysisModeComboBox"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> @@ -140,34 +190,16 @@ </property> <item> <property name="text"> - <string>Normal</string> - </property> - </item> - <item> - <property name="text"> - <string>DivergentBeam</string> + <string>PointDetectorAnalysis</string> </property> </item> <item> <property name="text"> - <string>NonFlatSample</string> + <string>MultiDetectorAnalysis</string> </property> </item> </widget> </item> - <item row="13" column="0"> - <widget class="QLabel" name="floodCorLabel"> - <property name="minimumSize"> - <size> - <width>117</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Flood Correction</string> - </property> - </widget> - </item> <item row="8" column="3"> <widget class="QDoubleSpinBox" name="endOverlapEdit"> <property name="minimumSize"> @@ -181,34 +213,36 @@ </property> </widget> </item> - <item row="8" column="1"> - <widget class="QDoubleSpinBox" name="startOverlapEdit"> - <property name="decimals"> - <number>5</number> + <item row="8" column="0"> + <widget class="QLabel" name="startOverlapLabel"> + <property name="minimumSize"> + <size> + <width>117</width> + <height>0</height> + </size> </property> - <property name="maximum"> - <double>100000.000000000000000</double> + <property name="text"> + <string>Transmission Run Overlap Start</string> </property> </widget> </item> - <item row="1" column="1"> - <widget class="QComboBox" name="analysisModeComboBox"> + <item row="11" column="2"> + <widget class="QLabel" name="floodWorkspaceWsSelectorLabel"> <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Preferred"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <item> - <property name="text"> - <string>PointDetectorAnalysis</string> - </property> - </item> - <item> - <property name="text"> - <string>MultiDetectorAnalysis</string> - </property> - </item> + <property name="minimumSize"> + <size> + <width>117</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Flood Workspace</string> + </property> </widget> </item> <item row="7" column="1"> @@ -230,47 +264,209 @@ </property> </widget> </item> - <item row="13" column="3"> - <widget class="MantidQt::MantidWidgets::WorkspaceSelector" name="floodWorkspaceWsSelector"> + <item row="10" column="0"> + <widget class="QLabel" name="polCorrLabel"> + <property name="minimumSize"> + <size> + <width>117</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Polarisation Corrections</string> + </property> + </widget> + </item> + <item row="3" column="1"> + <widget class="QComboBox" name="reductionTypeComboBox"> + <property name="enabled"> + <bool>false</bool> + </property> <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> + <item> + <property name="text"> + <string>Normal</string> + </property> + </item> + <item> + <property name="text"> + <string>DivergentBeam</string> + </property> + </item> + <item> + <property name="text"> + <string>NonFlatSample</string> + </property> + </item> + </widget> + </item> + <item row="3" column="3"> + <widget class="QCheckBox" name="includePartialBinsCheckBox"> + <property name="enabled"> + <bool>false</bool> + </property> <property name="minimumSize"> <size> <width>50</width> <height>0</height> </size> </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="1" column="0"> + <widget class="QLabel" name="analysisModeLabel"> + <property name="minimumSize"> + <size> + <width>117</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>AnalysisMode</string> + </property> </widget> </item> - <item row="4" column="1" rowspan="3" colspan="3"> - <widget class="QTableWidget" name="optionsTable"> + <item row="2" column="1"> + <widget class="QComboBox" name="summationTypeComboBox"> <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding"> + <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> + <item> + <property name="text"> + <string>SumInLambda</string> + </property> + </item> + <item> + <property name="text"> + <string>SumInQ</string> + </property> + </item> + </widget> + </item> + <item row="8" column="2"> + <widget class="QLabel" name="endOverlapLabel"> <property name="minimumSize"> <size> - <width>600</width> + <width>117</width> <height>0</height> </size> </property> - <property name="toolTip"> - <string>Specify options based on the run angle. Leave the angle empty to specify defaults for all runs.</string> - </property> - <property name="whatsThis"> - <string>This table allows you to specify default values for runs that do not have values specified on the Runs tab. You can specify these on a per-angle basis, where the angle from the Runs table will be looked up in the this table and those options will be used where a match is found. You may also leave the angle blank in this table to specify the default options that should be used for all runs.</string> - </property> - <property name="alternatingRowColors"> - <bool>true</bool> + <property name="text"> + <string>Overlap End</string> </property> - <property name="sortingEnabled"> - <bool>true</bool> + </widget> + </item> + <item row="9" column="0"> + <widget class="QLabel" name="transmissionStitchParamsLabel"> + <property name="minimumSize"> + <size> + <width>117</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Transmission Stitch Params</string> + </property> + </widget> + </item> + <item row="4" column="0"> + <widget class="QLabel" name="perAngleTableLabel"> + <property name="minimumSize"> + <size> + <width>117</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>Per-angle defaults</string> + </property> + <property name="alignment"> + <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> + </property> + </widget> + </item> + <item row="11" column="1"> + <widget class="QComboBox" name="floodCorComboBox"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <item> + <property name="text"> + <string>Workspace</string> + </property> + </item> + <item> + <property name="text"> + <string>ParameterFile</string> + </property> + </item> + </widget> + </item> + <item row="3" column="0"> + <widget class="QLabel" name="reductionTypeLabel"> + <property name="minimumSize"> + <size> + <width>117</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string>ReductionType</string> + </property> + </widget> + </item> + <item row="1" column="3"> + <widget class="QCheckBox" name="debugCheckBox"> + <property name="minimumSize"> + <size> + <width>50</width> + <height>0</height> + </size> + </property> + <property name="text"> + <string/> + </property> + </widget> + </item> + <item row="4" column="1" rowspan="3" colspan="3"> + <widget class="QTableWidget" name="optionsTable"> + <property name="sizePolicy"> + <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding"> + <horstretch>0</horstretch> + <verstretch>0</verstretch> + </sizepolicy> + </property> + <property name="minimumSize"> + <size> + <width>600</width> + <height>0</height> + </size> + </property> + <property name="toolTip"> + <string>Specify options based on the run angle. Leave the angle empty to specify defaults for all runs.</string> + </property> + <property name="whatsThis"> + <string>This table allows you to specify default values for runs that do not have values specified on the Runs tab. You can specify these on a per-angle basis, where the angle from the Runs table will be looked up in the this table and those options will be used where a match is found. You may also leave the angle blank in this table to specify the default options that should be used for all runs.</string> + </property> + <property name="alternatingRowColors"> + <bool>true</bool> + </property> + <property name="sortingEnabled"> + <bool>true</bool> </property> <property name="rowCount"> <number>3</number> @@ -355,21 +551,8 @@ </column> </widget> </item> - <item row="1" column="3"> - <widget class="QCheckBox" name="debugCheckBox"> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="11" column="2"> - <widget class="QLabel" name="CAlphaLabel"> + <item row="9" column="2"> + <widget class="QLabel" name="transmissionScaleRHSLabel"> <property name="minimumSize"> <size> <width>117</width> @@ -377,17 +560,7 @@ </size> </property> <property name="text"> - <string>CAlpha</string> - </property> - </widget> - </item> - <item row="9" column="1"> - <widget class="QLineEdit" name="transStitchParamsEdit"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> + <string>Scale RHS Transmission</string> </property> </widget> </item> @@ -404,326 +577,14 @@ </property> </widget> </item> - <item row="3" column="0"> - <widget class="QLabel" name="reductionTypeLabel"> - <property name="minimumSize"> - <size> - <width>117</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>ReductionType</string> - </property> - </widget> - </item> - <item row="12" column="0"> - <widget class="QLabel" name="CApLabel"> - <property name="minimumSize"> - <size> - <width>117</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>CAp</string> - </property> - </widget> - </item> - <item row="13" column="1"> - <widget class="QComboBox" name="floodCorComboBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="MinimumExpanding" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <item> - <property name="text"> - <string>Workspace</string> - </property> - </item> - <item> - <property name="text"> - <string>ParameterFile</string> - </property> - </item> - </widget> - </item> - <item row="1" column="0"> - <widget class="QLabel" name="analysisModeLabel"> - <property name="minimumSize"> - <size> - <width>117</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>AnalysisMode</string> - </property> - </widget> - </item> - <item row="12" column="1"> - <widget class="QDoubleSpinBox" name="CApEdit"> - <property name="decimals"> - <number>5</number> - </property> - <property name="maximum"> - <double>100000.000000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="1"> - <widget class="QComboBox" name="summationTypeComboBox"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <item> - <property name="text"> - <string>SumInLambda</string> - </property> - </item> - <item> - <property name="text"> - <string>SumInQ</string> - </property> - </item> - </widget> - </item> - <item row="10" column="1"> - <widget class="QComboBox" name="polCorrComboBox"> + <item row="9" column="1"> + <widget class="QLineEdit" name="transStitchParamsEdit"> <property name="sizePolicy"> <sizepolicy hsizetype="Minimum" vsizetype="Fixed"> <horstretch>0</horstretch> <verstretch>0</verstretch> </sizepolicy> </property> - <item> - <property name="text"> - <string>None</string> - </property> - </item> - <item> - <property name="text"> - <string>PA</string> - </property> - </item> - <item> - <property name="text"> - <string>PNR</string> - </property> - </item> - <item> - <property name="text"> - <string>ParameterFile</string> - </property> - </item> - </widget> - </item> - <item row="11" column="0"> - <widget class="QLabel" name="CRhoLabel"> - <property name="minimumSize"> - <size> - <width>117</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>CRho</string> - </property> - </widget> - </item> - <item row="11" column="1"> - <widget class="QDoubleSpinBox" name="CRhoEdit"> - <property name="decimals"> - <number>5</number> - </property> - <property name="maximum"> - <double>100000.000000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - <item row="8" column="2"> - <widget class="QLabel" name="endOverlapLabel"> - <property name="minimumSize"> - <size> - <width>117</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Overlap End</string> - </property> - </widget> - </item> - <item row="4" column="0"> - <widget class="QLabel" name="perAngleTableLabel"> - <property name="minimumSize"> - <size> - <width>117</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Per-angle defaults</string> - </property> - <property name="alignment"> - <set>Qt::AlignLeading|Qt::AlignLeft|Qt::AlignTop</set> - </property> - </widget> - </item> - <item row="12" column="2"> - <widget class="QLabel" name="CPpLabel"> - <property name="minimumSize"> - <size> - <width>117</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>CPp</string> - </property> - </widget> - </item> - <item row="9" column="0"> - <widget class="QLabel" name="transmissionStitchParamsLabel"> - <property name="minimumSize"> - <size> - <width>117</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Transmission Stitch Params</string> - </property> - </widget> - </item> - <item row="15" column="0"> - <widget class="QLabel" name="stitchLabel"> - <property name="minimumSize"> - <size> - <width>117</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Output Stitch Params</string> - </property> - </widget> - </item> - <item row="9" column="3"> - <widget class="QCheckBox" name="transScaleRHSCheckBox"> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string/> - </property> - </widget> - </item> - <item row="1" column="2"> - <widget class="QLabel" name="debugLabel"> - <property name="minimumSize"> - <size> - <width>117</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>Debug</string> - </property> - </widget> - </item> - <item row="11" column="3"> - <widget class="QDoubleSpinBox" name="CAlphaEdit"> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="decimals"> - <number>5</number> - </property> - <property name="maximum"> - <double>100000.000000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - <item row="2" column="0"> - <widget class="QLabel" name="summationTypeLabel"> - <property name="minimumSize"> - <size> - <width>117</width> - <height>0</height> - </size> - </property> - <property name="text"> - <string>SummationType</string> - </property> - </widget> - </item> - <item row="12" column="3"> - <widget class="QDoubleSpinBox" name="CPpEdit"> - <property name="minimumSize"> - <size> - <width>50</width> - <height>0</height> - </size> - </property> - <property name="decimals"> - <number>5</number> - </property> - <property name="maximum"> - <double>100000.000000000000000</double> - </property> - <property name="value"> - <double>1.000000000000000</double> - </property> - </widget> - </item> - <item row="16" column="3"> - <widget class="QPushButton" name="getExpDefaultsButton"> - <property name="sizePolicy"> - <sizepolicy hsizetype="Fixed" vsizetype="Fixed"> - <horstretch>0</horstretch> - <verstretch>0</verstretch> - </sizepolicy> - </property> - <property name="minimumSize"> - <size> - <width>71</width> - <height>32</height> - </size> - </property> - <property name="layoutDirection"> - <enum>Qt::RightToLeft</enum> - </property> - <property name="text"> - <string>Restore Defaults</string> - </property> - <property name="fixedWidth" stdset="0"> - <number>70</number> - </property> - <property name="fixedHeight" stdset="0"> - <number>100</number> - </property> - <layout class="QHBoxLayout" name="getExpDefaultsButtonLayout"/> </widget> </item> </layout> diff --git a/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/IExperimentView.h b/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/IExperimentView.h index 74ff1ae326c7389cc44676bec53cc4a23c1f515c..7442bd0dabcecf8b043960571c6e325fcace6b35 100644 --- a/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/IExperimentView.h +++ b/qt/scientific_interfaces/ISISReflectometry/GUI/Experiment/IExperimentView.h @@ -76,9 +76,6 @@ public: virtual void enablePolarizationCorrections() = 0; virtual void disablePolarizationCorrections() = 0; - virtual void enablePolarizationCorrectionInputs() = 0; - virtual void disablePolarizationCorrectionInputs() = 0; - virtual void enableFloodCorrectionInputs() = 0; virtual void disableFloodCorrectionInputs() = 0; @@ -95,16 +92,8 @@ public: virtual void showTransmissionStitchParamsInvalid() = 0; virtual void showTransmissionStitchParamsValid() = 0; - virtual std::string getPolarizationCorrectionType() const = 0; - virtual void setPolarizationCorrectionType(std::string const &type) = 0; - virtual double getCRho() const = 0; - virtual void setCRho(double cRho) = 0; - virtual double getCAlpha() const = 0; - virtual void setCAlpha(double cAlpha) = 0; - virtual double getCAp() const = 0; - virtual void setCAp(double cAp) = 0; - virtual double getCPp() const = 0; - virtual void setCPp(double cPp) = 0; + virtual bool getPolarizationCorrectionOption() const = 0; + virtual void setPolarizationCorrectionOption(bool enable) = 0; virtual std::string getFloodCorrectionType() const = 0; virtual void setFloodCorrectionType(std::string const &correction) = 0; diff --git a/qt/scientific_interfaces/ISISReflectometry/Reduction/PolarizationCorrections.cpp b/qt/scientific_interfaces/ISISReflectometry/Reduction/PolarizationCorrections.cpp index 7667a7bda9e966e04cd460bb2209a54482d4473c..c49cc0e5931a6906aec46a73803f858d0d04627f 100644 --- a/qt/scientific_interfaces/ISISReflectometry/Reduction/PolarizationCorrections.cpp +++ b/qt/scientific_interfaces/ISISReflectometry/Reduction/PolarizationCorrections.cpp @@ -9,26 +9,13 @@ namespace MantidQt { namespace CustomInterfaces { PolarizationCorrections::PolarizationCorrections( - PolarizationCorrectionType correctionType, boost::optional<double> CRho, - boost::optional<double> CAlpha, boost::optional<double> CAp, - boost::optional<double> CPp) - : m_correctionType(correctionType), m_cRho(CRho), m_cAlpha(CAlpha), - m_cAp(CAp), m_cPp(CPp) {} + PolarizationCorrectionType correctionType) + : m_correctionType(correctionType) {} PolarizationCorrectionType PolarizationCorrections::correctionType() const { return m_correctionType; } -boost::optional<double> PolarizationCorrections::cRho() const { return m_cRho; } - -boost::optional<double> PolarizationCorrections::cAlpha() const { - return m_cAlpha; -} - -boost::optional<double> PolarizationCorrections::cAp() const { return m_cAp; } - -boost::optional<double> PolarizationCorrections::cPp() const { return m_cPp; } - bool operator!=(PolarizationCorrections const &lhs, PolarizationCorrections const &rhs) { return !(lhs == rhs); @@ -36,9 +23,7 @@ bool operator!=(PolarizationCorrections const &lhs, bool operator==(PolarizationCorrections const &lhs, PolarizationCorrections const &rhs) { - return lhs.correctionType() == rhs.correctionType() && - lhs.cRho() == rhs.cRho() && lhs.cAlpha() == rhs.cAlpha() && - lhs.cAp() == rhs.cAp() && lhs.cPp() == rhs.cPp(); + return lhs.correctionType() == rhs.correctionType(); } } // namespace CustomInterfaces } // namespace MantidQt diff --git a/qt/scientific_interfaces/ISISReflectometry/Reduction/PolarizationCorrections.h b/qt/scientific_interfaces/ISISReflectometry/Reduction/PolarizationCorrections.h index a99f4af679e04862edf74b64dd9d23887459ad03..a4b8ace5121b4e11169a8930e820171e723d3921 100644 --- a/qt/scientific_interfaces/ISISReflectometry/Reduction/PolarizationCorrections.h +++ b/qt/scientific_interfaces/ISISReflectometry/Reduction/PolarizationCorrections.h @@ -12,16 +12,12 @@ #include <string> namespace MantidQt { namespace CustomInterfaces { -enum class PolarizationCorrectionType { None, PA, PNR, ParameterFile }; +enum class PolarizationCorrectionType { None, ParameterFile }; inline PolarizationCorrectionType polarizationCorrectionTypeFromString(std::string const &correctionType) { if (correctionType == "None") return PolarizationCorrectionType::None; - else if (correctionType == "PA") - return PolarizationCorrectionType::PA; - else if (correctionType == "PNR") - return PolarizationCorrectionType::PNR; else if (correctionType == "ParameterFile") return PolarizationCorrectionType::ParameterFile; else @@ -33,10 +29,6 @@ polarizationCorrectionTypeToString(PolarizationCorrectionType correctionType) { switch (correctionType) { case PolarizationCorrectionType::None: return "None"; - case PolarizationCorrectionType::PA: - return "PA"; - case PolarizationCorrectionType::PNR: - return "PNR"; case PolarizationCorrectionType::ParameterFile: return "ParameterFile"; } @@ -45,35 +37,25 @@ polarizationCorrectionTypeToString(PolarizationCorrectionType correctionType) { inline bool polarizationCorrectionRequiresInputs( PolarizationCorrectionType correctionType) { - return (correctionType == PolarizationCorrectionType::PA || - correctionType == PolarizationCorrectionType::PNR); + UNUSED_ARG(correctionType); + return false; } /** @class PoliarizationCorrections - The PoliarizationCorrections model holds information about what polarization - corrections should be done during reduction + The PoliarizationCorrections model holds information about what + polarization corrections should be done during reduction. Currently there + are just two options (namely, apply or don't apply corrections) but this + may be expanded to include more cases in the future. */ class MANTIDQT_ISISREFLECTOMETRY_DLL PolarizationCorrections { public: - PolarizationCorrections(PolarizationCorrectionType correctionType, - boost::optional<double> CRho = boost::none, - boost::optional<double> CAlpha = boost::none, - boost::optional<double> CAp = boost::none, - boost::optional<double> CPp = boost::none); + explicit PolarizationCorrections(PolarizationCorrectionType correctionType); PolarizationCorrectionType correctionType() const; - boost::optional<double> cRho() const; - boost::optional<double> cAlpha() const; - boost::optional<double> cAp() const; - boost::optional<double> cPp() const; private: PolarizationCorrectionType m_correctionType; - boost::optional<double> m_cRho; - boost::optional<double> m_cAlpha; - boost::optional<double> m_cAp; - boost::optional<double> m_cPp; }; MANTIDQT_ISISREFLECTOMETRY_DLL bool diff --git a/qt/scientific_interfaces/test/ISISReflectometry/Batch/RowProcessingAlgorithmTest.h b/qt/scientific_interfaces/test/ISISReflectometry/Batch/RowProcessingAlgorithmTest.h index 23db231401e44073522712ae0c2ce7c3856ccc06..df28c1028e2fa2af31ccddd130fb81e2c72b478b 100644 --- a/qt/scientific_interfaces/test/ISISReflectometry/Batch/RowProcessingAlgorithmTest.h +++ b/qt/scientific_interfaces/test/ISISReflectometry/Batch/RowProcessingAlgorithmTest.h @@ -39,7 +39,7 @@ public: TS_ASSERT_EQUALS(result["SummationType"], "SumInQ"); TS_ASSERT_EQUALS(result["IncludePartialBins"], "1"); TS_ASSERT_EQUALS(result["Debug"], "1"); - TS_ASSERT_EQUALS(result["PolarizationAnalysis"], "ParameterFile"); + TS_ASSERT_EQUALS(result["PolarizationAnalysis"], "1"); TS_ASSERT_EQUALS(result["FloodCorrection"], "Workspace"); TS_ASSERT_EQUALS(result["FloodWorkspace"], "test_workspace"); TS_ASSERT_EQUALS(result["StartOverlap"], "7.500000"); @@ -57,7 +57,7 @@ public: TS_ASSERT_EQUALS(result["SummationType"], "SumInQ"); TS_ASSERT_EQUALS(result["IncludePartialBins"], "1"); TS_ASSERT_EQUALS(result["Debug"], "1"); - TS_ASSERT_EQUALS(result["PolarizationAnalysis"], "ParameterFile"); + TS_ASSERT_EQUALS(result["PolarizationAnalysis"], "1"); TS_ASSERT_EQUALS(result["FloodCorrection"], "Workspace"); TS_ASSERT_EQUALS(result["FloodWorkspace"], "test_workspace"); TS_ASSERT_EQUALS(result["StartOverlap"], "7.500000"); diff --git a/qt/scientific_interfaces/test/ISISReflectometry/Experiment/ExperimentPresenterTest.h b/qt/scientific_interfaces/test/ISISReflectometry/Experiment/ExperimentPresenterTest.h index bd9af59ea34aa823d2b0e68762ba74330b0f31dd..c8ba44b8a182e4577f37c73abfb0fb6e664314c9 100644 --- a/qt/scientific_interfaces/test/ISISReflectometry/Experiment/ExperimentPresenterTest.h +++ b/qt/scientific_interfaces/test/ISISReflectometry/Experiment/ExperimentPresenterTest.h @@ -161,38 +161,6 @@ public: verifyAndClear(); } - void testSetPolarizationCorrectionsUpdatesModel() { - auto presenter = makePresenter(); - PolarizationCorrections polCorr(PolarizationCorrectionType::PA, 1.2, 1.3, - 2.4, 2.5); - - EXPECT_CALL(m_view, getPolarizationCorrectionType()).WillOnce(Return("PA")); - EXPECT_CALL(m_view, getCRho()).WillOnce(Return(polCorr.cRho().get())); - EXPECT_CALL(m_view, getCAlpha()).WillOnce(Return(polCorr.cAlpha().get())); - EXPECT_CALL(m_view, getCAp()).WillOnce(Return(polCorr.cAp().get())); - EXPECT_CALL(m_view, getCPp()).WillOnce(Return(polCorr.cPp().get())); - presenter.notifySettingsChanged(); - - TS_ASSERT_EQUALS(presenter.experiment().polarizationCorrections(), polCorr); - verifyAndClear(); - } - - void testSettingPolarizationCorrectionsToNoneDisablesInputs() { - runWithPolarizationCorrectionInputsDisabled("None"); - } - - void testSetPolarizationCorrectionsToParameterFileDisablesInputs() { - runWithPolarizationCorrectionInputsDisabled("ParameterFile"); - } - - void testSettingPolarizationCorrectionsToPAEnablesInputs() { - runWithPolarizationCorrectionInputsEnabled("PA"); - } - - void testSettingPolarizationCorrectionsToPNREnablesInputs() { - runWithPolarizationCorrectionInputsEnabled("PNR"); - } - void testSetFloodCorrectionsUpdatesModel() { auto presenter = makePresenter(); FloodCorrections floodCorr(FloodCorrectionType::Workspace, @@ -636,8 +604,7 @@ public: FloodCorrections(FloodCorrectionType::ParameterFile)); auto defaultOptions = expectDefaults(model); auto presenter = makePresenter(std::move(defaultOptions)); - EXPECT_CALL(m_view, setPolarizationCorrectionType("ParameterFile")) - .Times(1); + EXPECT_CALL(m_view, setPolarizationCorrectionOption(true)).Times(1); EXPECT_CALL(m_view, setFloodCorrectionType("ParameterFile")).Times(1); presenter.notifyRestoreDefaultsRequested(); verifyAndClear(); @@ -667,6 +634,26 @@ public: verifyAndClear(); } + void testPolarizationCorrectionsDisabledForINTER() { + runTestThatPolarizationCorrectionsAreDisabledForInstrument("INTER"); + } + + void testPolarizationCorrectionsDisabledForSURF() { + runTestThatPolarizationCorrectionsAreDisabledForInstrument("SURF"); + } + + void testPolarizationCorrectionsEnabledForOFFSPEC() { + runTestThatPolarizationCorrectionsAreEnabledForInstrument("OFFSPEC"); + } + + void testPolarizationCorrectionsEnabledForPOLREF() { + runTestThatPolarizationCorrectionsAreEnabledForInstrument("POLREF"); + } + + void testPolarizationCorrectionsEnabledForCRISP() { + runTestThatPolarizationCorrectionsAreEnabledForInstrument("CRISP"); + } + private: NiceMock<MockExperimentView> m_view; NiceMock<MockBatchPresenter> m_mainPresenter; @@ -784,29 +771,28 @@ private: return defaultOptions; } - void runWithPolarizationCorrectionInputsDisabled(std::string const &type) { + void runTestThatPolarizationCorrectionsAreEnabledForInstrument( + std::string const &instrument) { auto presenter = makePresenter(); - EXPECT_CALL(m_view, getPolarizationCorrectionType()).WillOnce(Return(type)); - EXPECT_CALL(m_view, disablePolarizationCorrectionInputs()).Times(1); - EXPECT_CALL(m_view, getCRho()).Times(0); - EXPECT_CALL(m_view, getCAlpha()).Times(0); - EXPECT_CALL(m_view, getCAp()).Times(0); - EXPECT_CALL(m_view, getCPp()).Times(0); + EXPECT_CALL(m_mainPresenter, instrumentName()) + .Times(1) + .WillOnce(Return(instrument)); + EXPECT_CALL(m_view, enablePolarizationCorrections()).Times(1); presenter.notifySettingsChanged(); verifyAndClear(); } - void runWithPolarizationCorrectionInputsEnabled(std::string const &type) { + void runTestThatPolarizationCorrectionsAreDisabledForInstrument( + std::string const &instrument) { auto presenter = makePresenter(); - EXPECT_CALL(m_view, getPolarizationCorrectionType()).WillOnce(Return(type)); - EXPECT_CALL(m_view, enablePolarizationCorrectionInputs()).Times(1); - EXPECT_CALL(m_view, getCRho()).Times(1); - EXPECT_CALL(m_view, getCAlpha()).Times(1); - EXPECT_CALL(m_view, getCAp()).Times(1); - EXPECT_CALL(m_view, getCPp()).Times(1); + EXPECT_CALL(m_mainPresenter, instrumentName()) + .Times(1) + .WillOnce(Return(instrument)); + EXPECT_CALL(m_view, setPolarizationCorrectionOption(false)).Times(1); + EXPECT_CALL(m_view, disablePolarizationCorrections()).Times(1); presenter.notifySettingsChanged(); verifyAndClear(); diff --git a/qt/scientific_interfaces/test/ISISReflectometry/Experiment/MockExperimentView.h b/qt/scientific_interfaces/test/ISISReflectometry/Experiment/MockExperimentView.h index 15fa3f3f1ccda4ec23c1392fc4b6a026e497b6c5..f6fdd955f30ccea69bdd4db7f0e244329ad99df9 100644 --- a/qt/scientific_interfaces/test/ISISReflectometry/Experiment/MockExperimentView.h +++ b/qt/scientific_interfaces/test/ISISReflectometry/Experiment/MockExperimentView.h @@ -21,8 +21,8 @@ public: ON_CALL(*this, getSummationType()) .WillByDefault(testing::Return("SumInLambda")); ON_CALL(*this, getReductionType()).WillByDefault(testing::Return("Normal")); - ON_CALL(*this, getPolarizationCorrectionType()) - .WillByDefault(testing::Return("None")); + ON_CALL(*this, getPolarizationCorrectionOption()) + .WillByDefault(testing::Return(false)); ON_CALL(*this, getFloodCorrectionType()) .WillByDefault(testing::Return("Workspace")); ON_CALL(*this, getDebugOption()).WillByDefault(testing::Return(false)); @@ -59,8 +59,6 @@ public: MOCK_METHOD0(showStitchParametersInvalid, void()); MOCK_METHOD0(enablePolarizationCorrections, void()); MOCK_METHOD0(disablePolarizationCorrections, void()); - MOCK_METHOD0(enablePolarizationCorrectionInputs, void()); - MOCK_METHOD0(disablePolarizationCorrectionInputs, void()); MOCK_METHOD0(enableFloodCorrectionInputs, void()); MOCK_METHOD0(disableFloodCorrectionInputs, void()); MOCK_CONST_METHOD0(getTransmissionStartOverlap, double()); @@ -75,16 +73,8 @@ public: MOCK_METHOD0(showTransmissionRangeInvalid, void(void)); MOCK_METHOD0(showTransmissionStitchParamsValid, void(void)); MOCK_METHOD0(showTransmissionStitchParamsInvalid, void(void)); - MOCK_CONST_METHOD0(getPolarizationCorrectionType, std::string()); - MOCK_METHOD1(setPolarizationCorrectionType, void(std::string const &)); - MOCK_CONST_METHOD0(getCRho, double()); - MOCK_METHOD1(setCRho, void(double)); - MOCK_CONST_METHOD0(getCAlpha, double()); - MOCK_METHOD1(setCAlpha, void(double)); - MOCK_CONST_METHOD0(getCAp, double()); - MOCK_METHOD1(setCAp, void(double)); - MOCK_CONST_METHOD0(getCPp, double()); - MOCK_METHOD1(setCPp, void(double)); + MOCK_CONST_METHOD0(getPolarizationCorrectionOption, bool()); + MOCK_METHOD1(setPolarizationCorrectionOption, void(bool)); MOCK_CONST_METHOD0(getFloodCorrectionType, std::string()); MOCK_METHOD1(setFloodCorrectionType, void(std::string const &)); MOCK_CONST_METHOD0(getFloodWorkspace, std::string()); diff --git a/qt/scientific_interfaces/test/ISISReflectometry/ReflMockObjects.h b/qt/scientific_interfaces/test/ISISReflectometry/ReflMockObjects.h index e12fbea64036a571981df59cdf02b94defaa68d9..879fbc4dd87b841a300eaa2940f71cdff99c28a0 100644 --- a/qt/scientific_interfaces/test/ISISReflectometry/ReflMockObjects.h +++ b/qt/scientific_interfaces/test/ISISReflectometry/ReflMockObjects.h @@ -87,6 +87,7 @@ public: MOCK_CONST_METHOD0(rowProcessingProperties, AlgorithmRuntimeProps()); MOCK_CONST_METHOD0(requestClose, bool()); MOCK_CONST_METHOD0(instrument, Mantid::Geometry::Instrument_const_sptr()); + MOCK_CONST_METHOD0(instrumentName, std::string()); // Calls we don't care about void acceptMainPresenter(IMainWindowPresenter *) override{};