Open CSSFrancis opened 2 years ago
Indeed, that would be good to improve the situation but I suspect that adding signal_axes
is not the right approach because it may the end up being quite complicated to be generic enough.
I find that updating the axes separately after running map has the advantage of being explicit and easy to read. Maybe improving the syntax and the documentation may be good enough?
I didn't look at the full code of the example above, but I suspect that it should be possible to avoid the first if
/else
block. For the rest, I don't think that you can get away without it!
Maybe something along the line of https://github.com/hyperspy/hyperspy/pull/2756 would help in general - even if in this specific example, it will not! ;)
The discussion from #2830 reminded me of something that I have been meaning to fix.
In many cases after using the map function the axes are changed/ adjusted and should have different scales, axes etc.
For example in
pyxem
when we take theazimuthal_integral2d
the signal changes from a diffraction pattern to a polar signal this chunk of code is used to change the axes to the proper format.I think that there are a couple of better ways to do this but the easiest would be to add a
signal_axes
parameter to themap
function which automatically sets the units, offset, and name for some axes after mapping the signal.