ess.reduce.live.raw.Histogrammer#

class ess.reduce.live.raw.Histogrammer(coords, edges)[source]#

Histogrammer for a detector view.

The histogrammer is used to project the detector data onto a different coordinate system. This class implements the common logic for different projections. For each concrete projection a setup mechanism computes relevant coordinates. This is done, e.g., in project_xy() and project_onto_cylinder().

__init__(coords, edges)[source]#

Methods

__init__(coords, edges)

apply_full(var)

Apply the histogrammer to a variable using all replicas.

from_coords(coords, resolution)

Create a histogrammer from coordinates and resolution.

input_indices()

Return an array with input indices corresponding to each histogram bin.

Attributes

replicas

apply_full(var)[source]#

Apply the histogrammer to a variable using all replicas.

This is used for one-off operations where the full data is needed, e.g., for transforming pixel weights. Compare to __call__(), which applies the histogrammer to a single replica for efficiency.

Return type:

DataArray

static from_coords(coords, resolution)[source]#

Create a histogrammer from coordinates and resolution.

Parameters:
  • coords (live.raw.ProjectedCoords (scipp.DataGroup)) – Coordinates to use for histogramming. May contain more than the dimensions used for histogramming.

  • resolution (live.raw.DetectorViewResolution (dict)) – Resolution to use for histogramming. The keys are the dimensions to histogram, and the values are the number of bins to use. The order of the dimensions is preserved in the output and thus controls which axis is which in a plot.

Return type:

Histogrammer

input_indices()[source]#

Return an array with input indices corresponding to each histogram bin.

Return type:

DataArray