scippneutron.tof.to_events.to_events#

scippneutron.tof.to_events.to_events(da, event_dim, events_per_bin=500)[source]#

Convert a histogrammed data array to an event list. Each dimension with a bin-edge coordinate is converted to an event coordinate. The contract is that if we re-histogram the event list with the same bin edges, we should get the original counts back. Masks on non-bin-edge dimensions are preserved. If there are masks on bin-edge dimensions, the masked values are zeroed out in the original data before the conversion to events.

Parameters:
  • da (DataArray) – DataArray to convert to events.

  • event_dim (str) – Name of the new event dimension.

  • events_per_bin (int, default: 500) – Number of events to generate per bin.

Return type:

DataArray