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

CalculatePlaczekSelfScattering v1

Summary

Calculates the Placzek self scattering correction of an incident spectrum

See Also

FitIncidentSpectrum

Properties

Name

Direction

Type

Default

Description

InputWorkspace

Input

MatrixWorkspace

Mandatory

Raw diffraction data workspace for associated correction to be calculated for. Workspace must have instrument and sample data.

IncidentSpectra

Input

MatrixWorkspace

Mandatory

Workspace of fitted incident spectrum with it’s first derivative. Must be in units of Wavelength.

OutputWorkspace

Output

MatrixWorkspace

Mandatory

Workspace with the Self scattering correction, in the same unit as the InputWorkspace.

CrystalDensity

Input

number

Optional

The crystalographic density of the sample material.

ScaleByPackingFraction

Input

boolean

True

Scale the correction value by packing fraction.

Description

This algorithm takes an incident spectrum function and it’s derivative, along with the workspace containing spectrum info and calculates the time-of-flight Placzek scattering correction from the workspaces material sample and detector info. [1] [2] [3] For obtaining the incident spectrum from a measurement (ie beam monitors or calibrant sample), the FitIncidentSpectrum can provide the necessary inputs.

Usage

Example: calculate Placzek self scattering correction using a sample detector setup [4]

from mantid.simpleapi import *
import matplotlib.pyplot as plt
import numpy as np

# Create the workspace to hold the already corrected incident spectrum
incident_wksp_name = 'incident_spectrum_wksp'
binning_incident = "0.1,0.02,5.0"
binning_for_calc = "0.2,0.02,4.0"
binning_for_fit = "0.15,0.02,4.5"
incident_wksp = CreateSampleWorkspace(
    OutputWorkspace=incident_wksp_name,
    NumBanks=10,
    XMin=0.1,
    XMax=5.0,
    BinWidth=0.002,
    Xunit='Wavelength')
incident_wksp = ConvertToPointData(InputWorkspace=incident_wksp)

# Spectrum function given in Milder et al. Eq (5)
def incident_spectrum(wavelengths, phi_max, phi_epi, alpha, lambda_1, lambda_2,
                     lamda_t):
    delta_term = 1. / (1. + np.exp((wavelengths - lambda_1) / lambda_2))
    term_1 = phi_max * (
        lambda_t**4. / wavelengths**5.) * np.exp(-(lambda_t / wavelengths)**2.)
    term_2 = phi_epi * delta_term / (wavelengths**(1 + 2 * alpha))
    return term_1 + term_2

# Variables for polyethlyene moderator at 300K
phi_max = 6324
phi_epi = 786
alpha = 0.099
lambda_1 = 0.67143
lambda_2 = 0.06075
lambda_t = 1.58

# Add the incident spectrum to the workspace
corrected_spectrum = incident_spectrum(
    incident_wksp.readX(0), phi_max, phi_epi, alpha, lambda_1, lambda_2, lambda_t)
incident_wksp.setY(0, corrected_spectrum)

incident_spectrum = FitIncidentSpectrum(
    InputWorkspace='incident_wksp',
    OutputWorkspace='fit_wksp',
    BinningForCalc=binning_for_calc,
    BinningForFit=binning_for_fit)
SetSampleMaterial(
    InputWorkspace='incident_wksp',
    ChemicalFormula='Co')
CalculatePlaczekSelfScattering(
    InputWorkspace='incident_wksp',
    IncidentSpecta='fit_wksp',
    OutputWorkspace='placzek_scattering',
    Version=1)

References

Categories: AlgorithmIndex | CorrectionFunctions

Source

C++ header: CalculatePlaczekSelfScattering.h

C++ source: CalculatePlaczekSelfScattering.cpp