Add energy_transfer to coord transform graphs from wavelength#677
Add energy_transfer to coord transform graphs from wavelength#677
Conversation
| 'energy': _kernels.energy_from_wavelength, | ||
| 'energy_transfer': _kernels.energy_transfer_from_energies, | ||
| 'incident_energy': _kernels.incident_energy_from_wavelength, | ||
| 'final_energy': _kernels.final_energy_from_wavelength, |
There was a problem hiding this comment.
Why do we need these in the elastic graph? This seems to invite mistakes from not overriding these functions correctly.
There was a problem hiding this comment.
It makes a disconnected graph.

You still need to correctly connect the initial and final wavelengths.
As I thought those were the quantities that are known at the instrument (rather than the energies), it seemed convenient to be able to compute energies and energy transfer from the graph without having to manually construct it?
Or are you just saying this should be a separate graph that is not part of the elastic graph?
There was a problem hiding this comment.
It also probably makes sense that they are not part of the elastic graph if they represent inelastic processes....
There was a problem hiding this comment.
I missed that they use incident_wavelength and final_wavelength. It looks good to me now that they are in the inelastic workflows. Then we can remove those frunctions from ESSspectroscopy.
src/scippneutron/conversion/tof.py
Outdated
| dtype = _common_dtype(incident_energy, final_energy) | ||
| e_i = incident_energy.to(dtype=dtype, copy=False) | ||
| e_f = final_energy.to(dtype=dtype, unit=e_i.unit, copy=False) | ||
| return sc.to_unit(e_i - e_f, 'meV', copy=False) |
There was a problem hiding this comment.
You already convert units above. Can you change these conversions such that e_i - e_f is always meV so we don't need a third pass over the array for that conversion?
This is step 1 towards using wavelength in reduction workflows instead of tof
We add the missing steps to compute
energy_transferfromwavelengthrather thantof.Wavelength will now be the primary coordinate we work from for ESS instruments.
It will be computed from lookup tables in essreduce.
We also fix a bug in the
time_at_samplefunction which assumed that all neutrons had left the pulse at exactly t=0.