Skip to content

Commit

Permalink
refs #8489. Common parameter init to base class.
Browse files Browse the repository at this point in the history
This has involved making some names common.
  • Loading branch information
OwenArnold committed Dec 13, 2013
1 parent 5340581 commit c7868e4
Show file tree
Hide file tree
Showing 5 changed files with 462 additions and 434 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@ namespace Mantid
OptionalDouble& stitchingDeltaQ, OptionalDouble& stitchingEndQ,
OptionalDouble& stitchingStartOverlapQ, OptionalDouble& stitchingEndOverlapQ) const;

/// Init common index inputs
void initIndexInputs();
/// Init common wavelength inputs
void initWavelengthInputs();
/// Init common stitching inputs
void initStitchingInputs();

private:

/// Validate the transmission correction property inputs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,76 +77,18 @@ namespace Mantid
inputValidator->add(boost::make_shared<WorkspaceUnitValidator>("TOF"));

declareProperty(
new WorkspaceProperty<MatrixWorkspace>("InputWorkspace", "", Direction::Input,
new WorkspaceProperty<MatrixWorkspace>("FirstTransmissionRun", "", Direction::Input,
PropertyMode::Mandatory, inputValidator->clone()),
"First transmission run, or the low wavelength transmision run if SecondTransmissionRun is also provided.");

declareProperty(
new WorkspaceProperty<MatrixWorkspace>("SecondTransmissionWorkspace", "", Direction::Input,
new WorkspaceProperty<MatrixWorkspace>("SecondTransmissionRun", "", Direction::Input,
PropertyMode::Optional, inputValidator->clone()),
"Second, high wavelength transmission run. Optional. Causes the InputWorkspace to be treated as the low wavelength transmission run.");

declareProperty(
new PropertyWithValue<double>("WavelengthMin", Mantid::EMPTY_DBL(),
boost::make_shared<MandatoryValidator<double> >(), Direction::Input),
"Wavelength minimum in angstroms");

declareProperty(
new PropertyWithValue<double>("WavelengthMax", Mantid::EMPTY_DBL(),
boost::make_shared<MandatoryValidator<double> >(), Direction::Input),
"Wavelength maximum in angstroms");

declareProperty(
new PropertyWithValue<double>("WavelengthStep", 0.05,
boost::make_shared<MandatoryValidator<double> >(), Direction::Input),
"Wavelength rebinning step in angstroms. Defaults to 0.05. Used for rebinning intermediate workspaces converted into wavelength.");

boost::shared_ptr<CompositeValidator> mandatoryWorkspaceIndex = boost::make_shared<
CompositeValidator>();
mandatoryWorkspaceIndex->add(boost::make_shared<MandatoryValidator<int> >());
auto boundedIndex = boost::make_shared<BoundedValidator<int> >();
boundedIndex->setLower(0);
mandatoryWorkspaceIndex->add(boundedIndex);

declareProperty(
new PropertyWithValue<int>("I0MonitorIndex", Mantid::EMPTY_INT(), mandatoryWorkspaceIndex),
"I0 monitor index");

declareProperty(
new PropertyWithValue<double>("MonitorBackgroundWavelengthMin", Mantid::EMPTY_DBL(),
boost::make_shared<MandatoryValidator<double> >(), Direction::Input),
"Wavelength minimum for monitor background in angstroms.");

declareProperty(
new PropertyWithValue<double>("MonitorBackgroundWavelengthMax", Mantid::EMPTY_DBL(),
boost::make_shared<MandatoryValidator<double> >(), Direction::Input),
"Wavelength maximum for monitor background in angstroms.");

declareProperty(
new PropertyWithValue<double>("MonitorIntegrationWavelengthMin", Mantid::EMPTY_DBL(),
boost::make_shared<MandatoryValidator<double> >(), Direction::Input),
"Wavelength minimum for integration in angstroms.");
declareProperty(
new PropertyWithValue<double>("MonitorIntegrationWavelengthMax", Mantid::EMPTY_DBL(),
boost::make_shared<MandatoryValidator<double> >(), Direction::Input),
"Wavelength maximum for integration in angstroms.");

declareProperty(new ArrayProperty<int>("WorkspaceIndexList"),
"Indices of the spectra in pairs (lower, upper) that mark the ranges that correspond to detectors of interest.");

declareProperty(
new ArrayProperty<double>("Params", boost::make_shared<RebinParamsValidator>(true)),
"A comma separated list of first bin boundary, width, last bin boundary. "
"These parameters are used for stitching together transmission runs. "
"Values are in q. This input is only needed if a SecondTransmission run is provided.");

declareProperty(
new PropertyWithValue<double>("StartOverlapQ", Mantid::EMPTY_DBL(), Direction::Input),
"Start Q for stitching transmission runs together");

declareProperty(
new PropertyWithValue<double>("EndOverlapQ", Mantid::EMPTY_DBL(), Direction::Input),
"End Q for stitching transmission runs together");
this->initStitchingInputs();
this->initIndexInputs();
this->initWavelengthInputs();

declareProperty(new WorkspaceProperty<MatrixWorkspace>("OutputWorkspace", "", Direction::Output),
"Output Workspace IvsQ.");
Expand All @@ -167,8 +109,29 @@ namespace Mantid
*/
void CreateTransmissionWorkspace::exec()
{
MatrixWorkspace_sptr firstTranmsission = getProperty("InputWorkspace");
setProperty("OutputWorkspace",firstTranmsission);
OptionalMatrixWorkspace_sptr firstTransmissionRun;
OptionalMatrixWorkspace_sptr secondTransmissionRun;
OptionalDouble stitchingStartQ;
OptionalDouble stitchingDeltaQ;
OptionalDouble stitchingEndQ;
OptionalDouble stitchingStartOverlapQ;
OptionalDouble stitchingEndOverlapQ;

getTransmissionRunInfo(firstTransmissionRun, secondTransmissionRun, stitchingStartQ,
stitchingDeltaQ, stitchingEndQ, stitchingStartOverlapQ, stitchingEndOverlapQ);

const MinMax wavelengthInterval = this->getMinMax("WavelengthMin", "WavelengthMax");
const double wavelengthStep = getProperty("WavelengthStep");
const MinMax monitorBackgroundWavelengthInterval = getMinMax("MonitorBackgroundWavelengthMin",
"MonitorBackgroundWavelengthMax");
const MinMax monitorIntegrationWavelengthInterval = getMinMax("MonitorIntegrationWavelengthMin",
"MonitorIntegrationWavelengthMax");

const WorkspaceIndexList indexList = getWorkspaceIndexList();

const int i0MonitorIndex = getProperty("I0MonitorIndex");

setProperty("OutputWorkspace", firstTransmissionRun.get());
}

} // namespace Algorithms
Expand Down
60 changes: 3 additions & 57 deletions Code/Mantid/Framework/Algorithms/src/ReflectometryReductionOne.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,52 +172,9 @@ namespace Mantid
declareProperty(new ArrayProperty<int>("RegionOfDirectBeam"),
"Indices of the spectra a pair (lower, upper) that mark the ranges that correspond to the direct beam in multi-detector mode.");

declareProperty(
new PropertyWithValue<double>("WavelengthMin", Mantid::EMPTY_DBL(),
boost::make_shared<MandatoryValidator<double> >(), Direction::Input),
"Wavelength minimum in angstroms");
declareProperty(
new PropertyWithValue<double>("WavelengthMax", Mantid::EMPTY_DBL(),
boost::make_shared<MandatoryValidator<double> >(), Direction::Input),
"Wavelength maximum in angstroms");

declareProperty(
new PropertyWithValue<double>("WavelengthStep", 0.05,
boost::make_shared<MandatoryValidator<double> >(), Direction::Input),
"Wavelength rebinning step in angstroms. Defaults to 0.05. Used for rebinning intermediate workspaces converted into wavelength.");

boost::shared_ptr<CompositeValidator> mandatoryWorkspaceIndex = boost::make_shared<
CompositeValidator>();
mandatoryWorkspaceIndex->add(boost::make_shared<MandatoryValidator<int> >());
auto boundedIndex = boost::make_shared<BoundedValidator<int> >();
boundedIndex->setLower(0);
mandatoryWorkspaceIndex->add(boundedIndex);

declareProperty(
new PropertyWithValue<int>("I0MonitorIndex", Mantid::EMPTY_INT(), mandatoryWorkspaceIndex),
"I0 monitor index");

declareProperty(
new PropertyWithValue<double>("MonitorBackgroundWavelengthMin", Mantid::EMPTY_DBL(),
boost::make_shared<MandatoryValidator<double> >(), Direction::Input),
"Wavelength minimum for monitor background in angstroms. Taken to be WavelengthMin if not provided.");
this->initIndexInputs();
this->initWavelengthInputs();

declareProperty(
new PropertyWithValue<double>("MonitorBackgroundWavelengthMax", Mantid::EMPTY_DBL(),
boost::make_shared<MandatoryValidator<double> >(), Direction::Input),
"Wavelength maximum for monitor background in angstroms. Taken to be WavelengthMax if not provided.");

declareProperty(
new PropertyWithValue<double>("MonitorIntegrationWavelengthMin", Mantid::EMPTY_DBL(),
boost::make_shared<MandatoryValidator<double> >(), Direction::Input),
"Wavelength minimum for integration in angstroms. Taken to be WavelengthMin if not provided.");
declareProperty(
new PropertyWithValue<double>("MonitorIntegrationWavelengthMax", Mantid::EMPTY_DBL(),
boost::make_shared<MandatoryValidator<double> >(), Direction::Input),
"Wavelength maximum for integration in angstroms. Taken to be WavelengthMax if not provided.");

declareProperty(new ArrayProperty<int>("WorkspaceIndexList"),
"Indices of the spectra in pairs (lower, upper) that mark the ranges that correspond to detectors of interest.");

declareProperty(new PropertyWithValue<std::string>("DetectorComponentName", "", Direction::Input),
"Name of the detector component i.e. point-detector. If these are not specified, the algorithm will attempt lookup using a standard naming convention.");
Expand Down Expand Up @@ -245,18 +202,7 @@ namespace Mantid
PropertyMode::Optional, inputValidator->clone()),
"Second, high wavelength transmission run. Optional. Causes the FirstTransmissionRun to be treated as the low wavelength transmission run.");

declareProperty(
new ArrayProperty<double>("Params", boost::make_shared<RebinParamsValidator>(true)),
"A comma separated list of first bin boundary, width, last bin boundary. "
"These parameters are used for stitching together transmission runs. "
"Values are in q. This input is only needed if a SecondTransmission run is provided.");

declareProperty(
new PropertyWithValue<double>("StartOverlapQ", Mantid::EMPTY_DBL(), Direction::Input),
"Start Q for stitching transmission runs together");
declareProperty(
new PropertyWithValue<double>("EndOverlapQ", Mantid::EMPTY_DBL(), Direction::Input),
"End Q for stitching transmission runs together");
this->initStitchingInputs();

setPropertyGroup("FirstTransmissionRun", "Transmission");
setPropertyGroup("SecondTransmissionRun", "Transmission");
Expand Down

0 comments on commit c7868e4

Please sign in to comment.