Table of Contents
Name | Direction | Type | Default | Description |
---|---|---|---|---|
InputWorkspace | Input | MatrixWorkspace | Mandatory | |
DarkRun | Input | MatrixWorkspace | Mandatory | |
OutputWorkspace | Output | MatrixWorkspace | Mandatory | The corrected SANS workspace. |
NormalizationRatio | Input | number | 1 | Number to scale the dark run in orderto make it comparable to the SANS run |
Mean | Input | boolean | False | If True then a mean value of all spectra is used to calculate the value to subtract |
Uniform | Input | boolean | True | If True then we treat the treat the tim ebins a |
ApplyToDetectors | Input | boolean | True | If True then we apply the correction to the detector pixels |
ApplyToMonitors | Input | boolean | False | If True then we apply the correction to the monitors |
SelectedMonitors | Input | int list | List of selected detector IDs of monitors to which the correction should be applied. If empty, all monitors will be corrected, if ApplyToMonitors has been selected. |
This algorithm subtracts a dark run from a workspace. InputWorkspace and DarkRun have to be of type Workspace2D and need to contain the same spectra. The user can choose to either subtract spectra which are assoicated with detecors (ApplyToDetectors) and/or monitors (ApplyToMonitors). In the case of monitors, the user can select specific monitors (SelectedMonitors) according to their detecotor IDs.
The NormalizationRatio is used to scale the signal values of the DarkRun workspace before subtraction.
The background subtraction can be performed in several ways.
**Example - SANSDarkRunBackgroundCorrection for **
# Create sample workspaces. Note that the dark run is here the same as the sample run
ws_sample = CreateSampleWorkspace()
ws_dark_run = CloneWorkspace(ws_sample)
out_ws = SANSDarkRunBackgroundCorrection(InputWorkspace = ws_sample,
DarkRun = ws_dark_run,
NormalizationRatio = 0.5,
Uniform = False,
Mean = False,
ApplyToDetectors = True,
ApplyToMonitors = False)
# We should have effectively halfed the data values
in_y = ws_sample.dataY(0)
out_y = out_ws.dataY(0)
print "The first bin of the first spectrum of the input was " + str(in_y[0])
print "After the dark run correction it is " + str(out_y[0])
Output:
The first bin of the first spectrum of the input was 0.3
After the dark run correction it is 0.15
Categories: Algorithms | Workflow\SANS\UsesPropertyManager