trinidi.resolution#

Resolution Operator

Functions

equispaced_kernels(t_A, num_kernels, ...)

Generate a list of resolution function kernels.

lansce_fp5_kernel(t_A, Δt, flight_path_length)

Resolution function kernel based on [4].

Classes

ResolutionOperator(output_shape, t_A[, kernels])

ResolutionOperator Class

class trinidi.resolution.ResolutionOperator(output_shape, t_A, kernels=None)[source]#

Bases: object

ResolutionOperator Class

Initialize a ResolutionOperator object.

Parameters:
  • output_shape – Output shape of operator, i.e. measurement shape.

  • kernels (list of nd-arrays) – list of convolution kernels. None results in identity operator. Each kernel must sum to 1.

__call__(x)[source]#

Call self as a function.

single(x)[source]#

Call Resolution operator on an array of size (1, N_F).

call_on_any_array(array)[source]#

Call ResolutionOperator on an array of size (…, N_F).

Note: New ResolutionOperator object is created every time this function is called. Thus, is is not recommended to use this function when fast performance is required.

compute_t_F(t_A)[source]#

Finds time-of-flight array so that \(t_F^\top R \approx t_A^\top\).

Parameters:

t_A (array) – Time-of-arrival equi-spaced increasing array.

Returns:

t_F (array) – Time-of-flight equi-spaced increasing array.

plot_kernel_weights(ax)[source]#

Plot kernel weights as a function of t_F.

trinidi.resolution.lansce_fp5_kernel(t_A, Δt, flight_path_length)[source]#

Resolution function kernel based on [4].

Parameters:
  • t_A (scalar) – time-of-arrival of the neutron in \(\mathrm{μs}\).

  • Δt (scalar) – time sampling bin width in \(\mathrm{μs}\).

  • flight_path_length (scalar) – flight path length in \(\mathrm{m}\).

Returns:

Kernel array.

trinidi.resolution.equispaced_kernels(t_A, num_kernels, kernel_generator)[source]#

Generate a list of resolution function kernels.

Generate a list of resolution function kernels that correspond to equispaced time-of-flights and a given kernel_generator.

Parameters:
  • t_A (array) – time-of-arrival array of the neutrons in \(\mathrm{μs}\).

  • num_kernels (int) – Number of kernels to be generated. If 1, single kernel with average time-of-arrival is being generated.

  • kernel_generator (function) – Function with single argument that generates a kernel array based on the time-of-arrival.

Returns:

list of Kernel arrays.