Centre of Massο
ibex_bluesky_core.callbacks.CentreOfMass is a callback that provides functionality for calculating our definition of Centre of Mass. We calculate centre of mass from the 2D region bounded by min(y), min(x), max(x), and straight-line segments joining (x, y) data points with their nearest neighbours along the x axis.
ibex_bluesky_core.callbacks.CentreOfMass has a property, result, which stores the centre of mass value once the callback has finished.
Our CoM Algorithmο
Given non-continuous arrays of collected data x and y, (ibex_bluesky_core.callbacks.CentreOfMass) returns the x value of the centre of mass.
Our use cases require that our algorithm abides to the following rules:
Any background on data does not skew the centre of mass
The order in which data is received does not skew the centre of mass
Should support non-constant point spacing without skewing the centre of mass
Note
Note that this is designed for only positive peaks.
Step-by-stepο
Sort
xandyarrays in respect ofxascending. This is so that data can be received in any order.From each
yelement, subtractmin(y). This means that any constant background over data is ignored. (Does not work for negative peaks)Calculate weight/widths for each point; based on itβs
xdistances from neighbouring points. This ensures non-constant point spacing is accounted for in our calculation.For each decomposed shape that makes up the total area under the curve,
CoMis calculated as the following:
ibex_bluesky_core.callbacks.CentreOfMass can be used from our callbacks collection. See ISIS Standard Callbacks (ISISCallbacks).