Generalised CoM to take lists of 2D arrays
The calculate_center_of_mass
function, which I previously sped up, only took individual 2D arrays, and returned tuples of center positions. I've generalised this to "nD-2D" arrays, that is, array inputs of shape
(N1, N2, ..., ND, Y, X)
will now return center position arrays of shape (N1, N2, ..., ND, 2)
. The behaviour for regular 2D arrays of shape (Y, X) is unchanged.
I'm intending to use this for my own work outside of Atomap, but I thought it would be nice to share it. It should be useful in the atomap library as well, e.g. feeding an array of atoms to it.