Skip to content

Commit

Permalink
Correct for Solid Angle option in DgsReduction diagnostic. Refs #7787
Browse files Browse the repository at this point in the history
Also fixed SaveVanadium option to be visible in the auto-generated gui
  • Loading branch information
AndreiSavici committed Aug 21, 2013
1 parent 22bd7bf commit 39d2187
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
9 changes: 9 additions & 0 deletions Code/Mantid/Framework/Algorithms/src/DetectorDiagnostic.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,8 @@ namespace Mantid
this->setPropertyGroup("LowOutlier", medianDetTestGrp);
this->declareProperty("HighOutlier", 100., "Upper bound defining outliers as fraction of median value");
this->setPropertyGroup("HighOutlier", medianDetTestGrp);
this->declareProperty("CorrectForSolidAngle", false, "Flag to correct for solid angle efficiency. False by default.");
this->setPropertyGroup("CorrectForSolidAngle", medianDetTestGrp);
this->declareProperty("ExcludeZeroesFromMedian", false, "If false (default) zeroes will be included in "
"the median calculation, otherwise they will not be included but they will be left unmasked");
this->setPropertyGroup("ExcludeZeroesFromMedian", medianDetTestGrp);
Expand Down Expand Up @@ -163,6 +165,9 @@ namespace Mantid
"Error criterion as a multiple of error bar i.e. to fail the test, the magnitude of the\n"
"difference with respect to the median value must also exceed this number of error bars");
this->setPropertyGroup("SampleBkgSignificanceTest", backgroundCheck);
this->declareProperty("SampleCorrectForSolidAngle", false,
"Flag to correct for solid angle efficiency for background check MedianDetectorTest. False by default.");
this->setPropertyGroup("SampleCorrectForSolidAngle",backgroundCheck);

string psdBleedMaskGrp("Create PSD Bleed Mask");
this->declareProperty(new WorkspaceProperty<>("SampleWorkspace", "",
Expand Down Expand Up @@ -298,6 +303,7 @@ namespace Mantid
double significanceTest = this->getProperty("SampleBkgSignificanceTest");
double lowThreshold = this->getProperty("SampleBkgLowAcceptanceFactor");
double highThreshold = this->getProperty("SampleBkgHighAcceptanceFactor");
bool correctSA=this->getProperty("SampleCorrectForSolidAngle");

// run the ChildAlgorithm
IAlgorithm_sptr alg = this->createChildAlgorithm("MedianDetectorTest",
Expand All @@ -312,6 +318,7 @@ namespace Mantid
alg->setProperty("LowOutlier", 0.0);
alg->setProperty("HighOutlier", 1.0e100);
alg->setProperty("ExcludeZeroesFromMedian", true);
alg->setProperty("CorrectForSolidAngle",correctSA);
alg->executeAsChildAlg();
MatrixWorkspace_sptr localMaskWS = alg->getProperty("OutputWorkspace");
applyMask(inputWS, localMaskWS);
Expand Down Expand Up @@ -411,6 +418,7 @@ namespace Mantid
double lowOutlier = this->getProperty("LowOutlier");
double highOutlier = this->getProperty("HighOutlier");
bool excludeZeroes = this->getProperty("ExcludeZeroesFromMedian");
bool correctforSA = this->getProperty("CorrectForSolidAngle");

// MedianDetectorTest
// apply mask to what we are going to input
Expand All @@ -432,6 +440,7 @@ namespace Mantid
mdt->setProperty("LowOutlier", lowOutlier);
mdt->setProperty("HighOutlier", highOutlier);
mdt->setProperty("ExcludeZeroesFromMedian", excludeZeroes);
mdt->setProperty("CorrectForSolidAngle",correctforSA);
mdt->executeAsChildAlg();
localMask = mdt->getProperty("OutputWorkspace");
localFails = mdt->getProperty("NumberOfFailures");
Expand Down
3 changes: 3 additions & 0 deletions Code/Mantid/Framework/WorkflowAlgorithms/src/DgsDiagnose.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,8 @@ namespace Mantid
reductionManager, "diag_samp_zero", detVanWS);
const bool createPsdBleed = getBoolPropOrParam("PsdBleed",
reductionManager, "diag_bleed_test", detVanWS);
const bool vanSA = getBoolPropOrParam("MediantestCorectForSolidAngle",
reductionManager, "diag_correct_solid_angle", detVanWS);

// Numeric properties
const double huge = getDblPropOrParam("HighCounts",
Expand Down Expand Up @@ -306,6 +308,7 @@ namespace Mantid
diag->setProperty("LowThresholdFraction", vanLo);
diag->setProperty("HighThresholdFraction", vanHi);
diag->setProperty("LevelsUp",vanLevelsUp);
diag->setProperty("CorrectForSolidAngle",vanSA);
diag->setProperty("SignificanceTest", vanSigma);
diag->setProperty("DetVanRatioVariation", variation);
diag->setProperty("SampleBkgLowAcceptanceFactor", samLo);
Expand Down
9 changes: 7 additions & 2 deletions Code/Mantid/Framework/WorkflowAlgorithms/src/DgsReduction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ namespace Mantid
this->declareProperty("SaveProcessedDetVan", false,
"Save the processed detector vanadium workspace");
this->setPropertySettings("SaveProcessedDetVan",
new VisibleWhenProperty("SaveProcessedDetVan", IS_EQUAL_TO, "1"));
new VisibleWhenProperty("DetectorVanadiumInputFile", IS_NOT_EQUAL_TO, ""));
this->declareProperty(new FileProperty("SaveProcDetVanFilename", "",
FileProperty::OptionalSave, ".nxs"),
"Provide a filename for saving the processed detector vanadium.");
Expand Down Expand Up @@ -253,6 +253,10 @@ namespace Mantid
"Mask detectors below this threshold.");
this->setPropertySettings("MedianTestLevelsUp",
new VisibleWhenProperty("DetectorVanadiumInputFile", IS_NOT_EQUAL_TO, ""));
this->declareProperty("MedianTestCorrectForSolidAngle", false,
"Flag to correct for solid angle efficiency.");
this->setPropertySettings("MedianTestCorrectForSolidAngle",
new VisibleWhenProperty("DetectorVanadiumInputFile", IS_NOT_EQUAL_TO, ""));
this->declareProperty("ErrorBarCriterion", EMPTY_DBL(), mustBePositive,
"Some selection criteria for the detector tests.");
this->setPropertySettings("ErrorBarCriterion",
Expand Down Expand Up @@ -311,7 +315,8 @@ namespace Mantid
this->setPropertyGroup("HighOutlier", findBadDets);
this->setPropertyGroup("MedianTestHigh", findBadDets);
this->setPropertyGroup("MedianTestLow", findBadDets);
this->setPropertyGroup("MediantestLevelsUp", findBadDets);
this->setPropertyGroup("MedianTestLevelsUp", findBadDets);
this->setPropertyGroup("MedianTestCorrectForSolidAngle", findBadDets);
this->setPropertyGroup("ErrorBarCriterion", findBadDets);
this->setPropertyGroup("DetectorVanadium2InputFile", findBadDets);
this->setPropertyGroup("DetectorVanadium2InputWorkspace", findBadDets);
Expand Down

0 comments on commit 39d2187

Please sign in to comment.