scippneutron.normalization.compute_single_crystal_norm#
- scippneutron.normalization.compute_single_crystal_norm(*, trajectory_start, trajectory_stop, solid_angle, grid, incident_energy, n_threads=None, block_size=None)[source]#
Compute a normalization factor for single crystal data.
Attention
This function is a work in progress and will likely undergo breaking changes.
This function does not currently normalize by proton charge.
This function does not currently support elastic experiments.
This function implements a normalization algorithm that is equivalent to the one described in [SGA+22] and available in Mantid as MDNorm v1
The grid is defined as arrays of edges in \((h, k, l, \Delta E)\). Trajectories are defined as start end stop positions in \((h, k, l, k_f)\) and should have unit \(Å^{-1}\). (Careful! The grid uses \(\Delta E\) and trajectories use \(k_f\). The reason is that the grid is a user input and the trajectories are expected to be determined automatically.)
- Parameters:
trajectory_start (
Variable) – Start positions of each detector trajectory.trajectory_stop (
Variable) – Stop positions of each detector trajectory.solid_angle (
Variable) – The solid angle for each detector pixel as seen from the sample.grid (
tuple[Variable,Variable,Variable,Variable]) – The \(Q - \Delta E\) grid to compute the norm on.incident_energy (
Variable) – The incident energy \(E_i\).n_threads (
int|None, default:None) –Number of CPU threads to use. Both runtime and memory usage scale nearly linearly with the number of threads.
Defaults to the number of available CPU cores.
block_size (
int|None, default:None) –Number of trajectories to process together. When using multi-threading, trajectories are divided dynamically among threads in chunks of size
block_size.Defaults to a reasonable, experimentally determined number.
- Returns:
DataArray– The normalization denominator as a 4D data array containing a histogram ongrid.
Implementation#
The implementation of this function is in a separate Python package called
scippneutron_algorithms. The algorithm computes the same physical quantity as [SGA+22] but uses a different approach which does not require sorting intersections or frequent synchronization between threads. It has not been benchmarked against Mantid.