iData_Sqw2D: dynamic_range: crop the S(|q|,w) to the available dynamic range for given incident neutron energy. The dynamic range is defined from the momentum 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 p.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=dynamic_range(s, Ei, [angles]) The syntax: [sqw_Ei, sphiw] = dynamic_range(s,...) also returns the S(phi,w) data set, which shows the detected signal vs scattering angle and energy transfer. Input arguments can be given in order, or with name-value pairs, or as a structure with named fields. In addition to Ei, one can specify 'lambda' or 'Ki' e.g.: sqw_Ei=dynamic_range(s, 'lambda', 2.36); sqw_Ei=dynamic_range(s, 'Ki', 2.665); syntax: sqw_Ei =dynamic_range(s, Ei) [sqw_Ei,sphiw]=dynamic_range(s, Ei) [sqw_Ei,sphiw]=dynamic_range(s, Ei, [min_angle max_angle]) [sqw_Ei,sphiw]=dynamic_range(s, 'Ei', Ei, 'angles', [min_angle max_angle]) [sqw_Ei,sphiw]=dynamic_range(s, 'lambda', lambda) 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: scattering detection range in [deg] as a vector. Min and Max values are used. 'lambda','Ki': additional named arguments to specify the incident energy output: sqw_Ei: S(q,w) cropped to dynamic range for incident energy Ei. sphiw: S(phi,w) angular dynamic structure factor for incident energy Ei. Example: s=iData_Sqw2D('SQW_coh_lGe.nc'); dynamic_range(s, 14.8, [-20 135]) See also: iData_Sqw2D/Bosify, iData_Sqw2D/deBosify, iData_Sqw2D/symmetrize, iData_Sqw2D/scattering_cross_section (c) E.Farhi, ILL. License: EUPL.