tof.InelasticSample#

class tof.InelasticSample(distance, name, delta_e)[source]#

An inelastic sample component changes the energy of the neutrons that pass through it, but does not block any.

Parameters:
  • distance (Variable) – The distance from the source to the inelastic sample.

  • name (str) – The name of the inelastic sample.

  • delta_e (Callable[[Variable], Variable]) – The change in energy applied to the neutrons as they pass through the inelastic sample. This should be a function or callable that takes the incident energy and returns the final energy.

__init__(distance, name, delta_e)[source]#

Methods

__init__(distance, name, delta_e)

apply(neutrons, time_limit)

Apply the change in energy to the given neutrons.

as_dict()

Return the inelastic sample as a dictionary.

as_json()

Return the inelastic sample as a JSON-serializable dictionary.

as_readonly(neutrons)

from_json(name, params)

Create an inelastic sample from a JSON-serializable dictionary.

plot(**kwargs)

Attributes

kind

apply(neutrons, time_limit)[source]#

Apply the change in energy to the given neutrons. The convention is that

\[\Delta E = E_i - E_f\]

where \(E_i\) is the initial energy and \(E_f\) is the final energy.

Parameters:
  • neutrons (DataArray) – The neutrons to which the inelastic sample will be applied.

  • time_limit (Variable) – The time limit for the neutrons to be considered as reaching the inelastic sample.

Return type:

tuple[DataArray, InelasticSampleReading]

as_dict()[source]#

Return the inelastic sample as a dictionary.

Return type:

dict

as_json()[source]#

Return the inelastic sample as a JSON-serializable dictionary. .. versionadded:: 26.03.0

Return type:

dict

classmethod from_json(name, params)[source]#

Create an inelastic sample from a JSON-serializable dictionary.

Return type:

InelasticSample