$$\renewcommand\AA{\unicode{x212B}}$$

# DetectorDiagnostic v1¶

## Summary¶

Identifies histograms and their detectors that have total numbers of counts over a user defined maximum or less than the user define minimum.

## Properties¶

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

Name of the integrated detector vanadium (white beam) workspace.

Input

MatrixWorkspace

A hard mask to apply to the inputworkspace

OutputWorkspace

Output

MatrixWorkspace

Mandatory

StartWorkspaceIndex

Input

number

0

The index number of the first spectrum to include in the calculation (default 0)

EndWorkspaceIndex

Input

number

Optional

The index number of the last spectrum to include in the calculation (default the last histogram)

RangeLower

Input

number

Optional

No bin with a boundary at an x value less than this will be used in the summation that decides if a detector is ‘bad’ (default: the start of each histogram)

RangeUpper

Input

number

Optional

No bin with a boundary at an x value higher than this value will be used in the summation that decides if a detector is ‘bad’ (default: the end of each histogram)

LowThreshold

Input

number

0

Spectra whose total number of counts are equal to or below this value will be marked bad (default 0)

HighThreshold

Input

number

Optional

Spectra whose total number of counts are equal to or above this value will be marked bad (default off)

LevelsUp

Input

number

0

Levels above pixel that will be used to compute the median. If no level is specified, or 0, the median is over the whole instrument.

SignificanceTest

Input

number

0

Error criterion as a multiple of error bar i.e. to fail the test, the magnitude of the difference with respect to the median value must also exceed this number of error bars

LowThresholdFraction

Input

number

0.1

Lower acceptable bound as fraction of median value

HighThresholdFraction

Input

number

1.5

Upper acceptable bound as fraction of median value

LowOutlier

Input

number

0.01

Lower bound defining outliers as fraction of median value

HighOutlier

Input

number

100

Upper bound defining outliers as fraction of median value

CorrectForSolidAngle

Input

boolean

False

Flag to correct for solid angle efficiency. False by default.

ExcludeZeroesFromMedian

Input

boolean

False

If false (default) zeroes will be included in the median calculation, otherwise they will not be included but they will be left unmasked

DetVanCompare

Input

MatrixWorkspace

Name of a matching second detector vanadium run from the same instrument. It must be treated in the same manner as the input detector vanadium.

DetVanRatioVariation

Input

number

1.1

Identify spectra whose total number of counts has changed by more than this factor of the median change between the two input workspaces

SampleTotalCountsWorkspace

Input

MatrixWorkspace

A sample workspace integrated over the full axis range.

SampleBackgroundWorkspace

Input

MatrixWorkspace

A sample workspace integrated over the background region.

SampleBkgLowAcceptanceFactor

Input

number

0

Low threshold for the background check MedianDetectorTest.

SampleBkgHighAcceptanceFactor

Input

number

5

High threshold for the background check MedianDetectorTest.

SampleBkgSignificanceTest

Input

number

3.3

Error criterion as a multiple of error bar i.e. to fail the test, the magnitude of the difference with respect to the median value must also exceed this number of error bars

SampleCorrectForSolidAngle

Input

boolean

False

Flag to correct for solid angle efficiency for background check MedianDetectorTest. False by default.

SampleWorkspace

Input

MatrixWorkspace

A sample workspace. This is used in the PSD Bleed calculation.

MaxTubeFramerate

Input

number

0

The maximum rate allowed for a tube in counts/us/frame.

NIgnoredCentralPixels

Input

number

80

The number of pixels about the centre to ignore.

NumberOfFailures

Output

number

## Description¶

This algorithm is a C++ replacement for the Python diagnostics.diagnose function located in the scripts/inelastic directory. The algorithm expects processed workspaces as input just as the other function did. The main functionality of the algorithm is to determine issues with detector vanadium runs and mask out bad pixels. The algorithms that are run on the detector vanadium are FindDetectorsOutsideLimits v1 and MedianDetectorTest v1. It also performs a second set of diagnostics on another detector vanadium run and DetectorEfficiencyVariation v1 on the two. The algorithm also checks processed sample workspaces (total counts and background) for bad pixels as well. The total counts workspace is tested with FindDetectorsOutsideLimits v1. The background workspace is run through MedianDetectorTest v1. A processed sample workspace can be given to perform and CreatePSDBleedMask v1 will be run on it.

### Workflow¶

Parameters for the child algorithms are not shown due to the sheer number. They are passed onto child algorithms that under the same name, except

• LowThreshold and HighThresold are not passed onto FindDetectorsOutsideLimits v1, but are set as 1.0e-10 and 1.0e100 respectively.

• LowOutLier, HighOutlier and ExcludeZeroesFromMedian are not passed onto MedianDetectorTest v1, but are set as 0.0, 1.0e100 and true respectively.

• DetVanRatioVariation is passed onto DetectorEfficiencyVariation v1 as Variation.

• SampleBkgLowAcceptanceFactor, SampleBkgHighAcceptanceFactor, SampleBkgSignificanceTest and SampleCorrectForSolidAngle are passed onto MedianDetectorTest v1 as LowThreshold, HighThreshold, SignicanceTest and CorrectForSolidAngle respectively.

Numerous uses of MaskDetectors v1 are not shown and can be taken be be executed whenever appropriate. Also the output property NumberOfFailures from the executed child algorithms are added together to form the NumberOfFailures output by the main algorithm.

Categories: AlgorithmIndex | Diagnostics | Workflow\Diagnostics