Closed SimonHeybrock closed 3 years ago
Next step here: Turn convert
into a Python function, which simply calls sc.transform_coords
. To do so:
transform
(or transform_in_place
) is called, implement as C++ function and add Python bindings if it is required to avoid (large) temporaries.convert
into a wrapper for sc.transform_coords
using the defined graphs.convert
, recommend direct use of sc.transform_coords
(don't do this until we have settled on a API for accessing/getting graphs).Note that this should be merged into the next
branch, since sc.transform_coords
is not available in a release yet.
See ongoing PRs.
Neutron Scattering Unit Conversion
Status
scippneutron.convert
(mostly equivalent tomantid.ConvertUnits
) does the following:The current syntax is:
One thing to note here is that in addition to the coord specified using the
origin
arg,scn.convert
finds additional coords containing position information.Bigger picture
We also need to consider:
[Qx, Qy]
bins and reducing over pixel dimensionsSofQW
, which is another case of a "2d" transformRelated Mantid algorithms:
ConvertUnits
SofQW
(this is a family of algorithmsQ1D
andQxy
for SANSConvertToMD
algorithmsHypothesis
My current hunch is that there may be a better way to think of unit conversion mechanisms in a more modular manner. While the concrete decomposition of the problem is far from clear it might be that a 2-stage or multi-stage approach similar to
groupby
may be a good pattern:Questions
Brainstorming
Conclusion
transform_coords
to `scipp.scippneutron
defined building blocks for conversion graphs, as well a common graphs. Graphs in https://scipp.github.io/scippneutron/user-guide/unit-conversions.html#Beamline-geometry-parameters-used-in-unit-conversions are the first example of such a graph.