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

CalculatePlaczekSelfScattering v2

../_images/CalculatePlaczekSelfScattering-v2_dlg.png

CalculatePlaczekSelfScattering dialog.

Summary

Calculates the Placzek self scattering correction of an incident spectrum

See Also

FitIncidentSpectrum, CalculatePlaczek

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.

IncidentSpecta

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

CrystalDensity

Input

number

Optional

The crystalographic density of the sample material.

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.

Note: Version 2 is simply a passthrough to CalculatePlaczek so that scripts still using this algorithm may benefit from the updated calculations.

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 = incidentSpectrum(
    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='fit_wksp',
    ChemicalFormula='Co')
CalculatePlaczekSelfScattering(
    InputWorkspace='incident_wksp',
    InputSpectra='fit_wksp',
    OutputWorkspace='placzek_scattering')

References

Categories: AlgorithmIndex | CorrectionFunctions

Source

C++ header: CalculatePlaczekSelfScattering2.h

C++ source: CalculatePlaczekSelfScattering2.cpp