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

NormaliseByCurrent v1

../_images/ImageNotFound.png

Enable screenshots using DOCS_SCREENSHOTS in CMake

Summary

Normalises a workspace by the proton charge.

See Also

Divide

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

Name of the input workspace

OutputWorkspace

Output

MatrixWorkspace

Mandatory

Name of the output workspace

RecalculatePCharge

Input

boolean

False

Re-integrates the proton charge. This will modify the gd_prtn_chrg. Does nothing for multi-period data

Description

Normalises a workspace according to the good proton charge figure taken from the Input Workspace log data, which is stored in the workspace’s run object. Every data point (and its error) is divided by that number. The good proton charge value is added to the normalized workspace as the value of NormalizationFactor log.

ISIS Calculation Details

The good proton charge gd_prtn_chrg is an summed value that applies across all periods. It is therefore suitable to run NormaliseByProtonCharge for single-period workspaces, but gives incorrect normalisation for multi-period workspaces. If the algorithm detects the presences of a multi-period workspace, it calculates the normalisation slightly differently. It uses the current_period log property to index into the proton_charge_by_period log data array property.

EventWorkspaces

If the input workspace is an EventWorkspace, then the output will be as well. Weighted events are used to scale by the current (see the Divide v1 algorithm, which is a child algorithm being used).

Usage

Example - Normalise by Current simple workspace

# Create two workspaces
ws = CreateWorkspace(DataX=range(0,3), DataY=(17,12))

# Add Good Proton Charge Log
AddSampleLog(Workspace=ws, LogName='gd_prtn_chrg', LogText='10.0', LogType='Number')

# Fetch the generated logs
run1 = ws.getRun()
log_p = run1.getLogData('gd_prtn_chrg')

# Print the log value
print("Good Proton Charge = {}".format(log_p.value))

#Run the Algorithm
wsN = NormaliseByCurrent(ws)
norm_factor = wsN.getRun().getLogData('NormalizationFactor').value

#Print results
print("Before normalisation {}".format(ws.readY(0)))
print("After normalisation  {}".format(wsN.readY(0)))
print("Normalisation factor {}".format(norm_factor))

Output:

Good Proton Charge = 10.0
Before normalisation [ 17.  12.]
After normalisation  [ 1.7  1.2]
Normalisation factor 10.0

Categories: AlgorithmIndex | CorrectionFunctions\NormalisationCorrections

Source

C++ header: NormaliseByCurrent.h

C++ source: NormaliseByCurrent.cpp