\(\renewcommand\AA{\unicode{x212B}}\)

PowerLawCorrection v1

../_images/PowerLawCorrection-v1_dlg.png

PowerLawCorrection dialog.

Summary

Corrects the data and error values on a workspace by the value of an exponential function which is evaluated at the X value of each data point: c0*x^C1. The data and error values are multiplied by the value of this function.

Properties

Name Direction Type Default Description
InputWorkspace Input MatrixWorkspace Mandatory The name of the input workspace
OutputWorkspace Output MatrixWorkspace Mandatory The name to use for the output workspace (can be the same as the input one).
C0 Input number 1 The value by which the entire calculation is multiplied
C1 Input number 1 The power by which the x value is raised

Description

This algorithm corrects the data and error values on a workspace by the value of an function of the form \(C0 \times x^{C1}\). This formula is calculated for each data point, with the value of x being the mid-point of the bin in the case of histogram data. The data and error values are multiplied by the value of this function.

Usage

Example - A sample correction

# a sample workspace with a sample instrument
ws = CreateSampleWorkspace(Function="Flat background")

#Now we are ready to run the correction
wsCorrected = PowerLawCorrection(ws,C0=3,C1=2)

print("The correction counts and errors are multiplied by function 3*x^2")
for i in range(0,wsCorrected.blocksize(),10):
  print ("The correct value in bin {} is {:.2f} compared to {:.2f}".format(i, wsCorrected.readY(0)[i], ws.readY(0)[i]))

Output:

The correction counts and errors are multiplied by function 3*x^2
The correct value in bin 0 is 30000.00 compared to 1.00
The correct value in bin 10 is 13230000.00 compared to 1.00
The correct value in bin 20 is 50430000.00 compared to 1.00
The correct value in bin 30 is 111630000.00 compared to 1.00
The correct value in bin 40 is 196830000.00 compared to 1.00
The correct value in bin 50 is 306030000.00 compared to 1.00
The correct value in bin 60 is 439230000.00 compared to 1.00
The correct value in bin 70 is 596430000.00 compared to 1.00
The correct value in bin 80 is 777630000.00 compared to 1.00
The correct value in bin 90 is 982830000.00 compared to 1.00

Categories: AlgorithmIndex | CorrectionFunctions

Source

C++ header: PowerLawCorrection.h (last modified: 2020-03-20)

C++ source: PowerLawCorrection.cpp (last modified: 2020-03-20)