Home > Scripts > Treatment > Sqw > Sqw_dynamic_range.m

# iFit/Sqw_dynamic_range

## PURPOSE

[sqw_Ei,sphiw]=Sqw_dynamic_range(s,Ei): crop the S(|q|,w) to the available dynamic range

## SYNOPSIS

function [s, sphi] = Sqw_dynamic_range(s, Ei, angles, options)

## DESCRIPTION

``` [sqw_Ei,sphiw]=Sqw_dynamic_range(s,Ei): crop the S(|q|,w) to the available dynamic range
for given incident neutron energy.

The S(q,w) is a dynamic structure factor aka scattering function.

The dynamic range is defined from the momwntum and energy conservation laws:
Ef         = Ei - w                                is positive
cos(theta) = (Ki.^2 + Kf.^2 - q.^2) ./ (2*Ki.*Kf)  is within [-1:1]

The incident neutron energy can be computed using:
Ei = 2.0721*Ki^2 = 81.8042/lambda^2 with Ki in [Angs-1] and lambda in [Angs]

conventions:
omega = Ei-Ef = energy lost by the neutron
omega > 0, neutron looses energy, can not be higher than Ei (Stokes)
omega < 0, neutron gains energy, anti-Stokes

The scattering angle phi can be restricted to match a detection area
with the syntax:
sqw_Ei=Sqw_dynamic_range(s, Ei, [angles])

The syntax:
[sqw_Ei, sphiw] = Sqw_dynamic_range(s,...)
also returns the S(phi,w) data set, which shows the detected signal vs scattering
angle and energy transfer.

input:
s:  Sqw data set, e.g. 2D data set with w as 1st axis (rows, meV), q as 2nd axis (Angs-1).
Ei: incoming neutron energy [meV]
angles: detection range in [deg] as a vector. Min and Max values are used.
output:
sqw:   S(q,w)   cropped to dynamic range for incident energy Ei.
sphiw: S(phi,w) angular dynamic structure factor for incident energy Ei.

Example: Sqw_dynamic_range(s, 14.8, [-20 135])