trinidi.util#
Some util functions.
Functions
|
Convert energy to time-of-flight of the neutron. |
|
Return x/y, with 0 instead of NaN where y is 0. |
|
Convert time-of-flight to energy of the neutron. |
- trinidi.util.time2energy(time, flight_path_length)[source]#
Convert time-of-flight to energy of the neutron.
\[E = \frac{1}{2} m \left( \frac{L}{t} \right) \; ,\]where \(E\) is the energy, \(m\) is the mass, \(t\) is the time-of-flight of the neutron, and \(L\) is the flight path length.
- Parameters:
time – Time-of-flight in \(\mathrm{μs}\).
flight_path_length – flight path length in \(\mathrm{m}\).
- Returns:
Energy of the neutron in \(\mathrm{eV}\).
- trinidi.util.energy2time(energy, flight_path_length)[source]#
Convert energy to time-of-flight of the neutron.
\[t = L \sqrt{ \frac{m}{2 E} }\]where \(E\) is the energy, \(m\) is the mass, \(t\) is the time-of-flight of the neutron, and \(L\) is the flight path lenghth.
- Parameters:
energy – Energy of the neutron in \(\mathrm{eV}\).
flight_path_length – flight path length in \(\mathrm{m}\).
- Returns:
Time-of-flight in \(\mathrm{μs}\).