tof.Result#

class tof.Result(source, choppers, detectors)[source]#

Result of a simulation.

Parameters:
__init__(source, choppers, detectors)[source]#

Methods

__init__(source, choppers, detectors)

plot([visible_rays, blocked_rays, figsize, ...])

Plot the time-distance diagram for the instrument, including the rays of neutrons that make it to the furthest detector.

to_nxevent_data([key])

Convert a detector reading to event data that resembles event data found in a NeXus file.

Attributes

choppers

The choppers in the model.

detectors

The detectors in the model.

source

The source of neutrons.

property choppers: mappingproxy[str, ChopperReading]#

The choppers in the model.

property detectors: mappingproxy[str, DetectorReading]#

The detectors in the model.

plot(visible_rays=1000, blocked_rays=0, figsize=None, ax=None, cax=None, cbar=True, cmap='gist_rainbow_r')[source]#

Plot the time-distance diagram for the instrument, including the rays of neutrons that make it to the furthest detector. As plotting many lines can be slow, the number of rays to plot can be limited by setting visible_rays. In addition, it is possible to also plot the rays that are blocked by choppers along the flight path by setting blocked_rays > 0.

Parameters:
  • visible_rays (int, default: 1000) – Maximum number of rays to plot.

  • blocked_rays (int, default: 0) – Number of blocked rays to plot.

  • figsize (Optional[tuple[float, float]], default: None) – Figure size.

  • ax (Optional[Axes], default: None) – Axes to plot on.

  • cax (Optional[Axes], default: None) – Axes to use for the colorbar.

  • cbar (bool, default: True) – Show a colorbar for the wavelength if True.

  • cmap (str, default: 'gist_rainbow_r') – Colormap to use for the wavelength colorbar.

Return type:

Plot

property source: SourceParameters#

The source of neutrons.

to_nxevent_data(key=None)[source]#

Convert a detector reading to event data that resembles event data found in a NeXus file.

Parameters:

key (Optional[str], default: None) – Name of the detector. If None, all detectors are included.

Return type:

DataArray