centroid

specutils.analysis.centroid(spectrum, regions=None, region=None, analytic=True)[source]

Calculate the centroid of a region, or regions, of the spectrum.

Parameters:
spectrumSpectrum1D

The spectrum object over which the centroid will be calculated. If the uncertainty is populated, the returned quantity will include an uncertainty attribute with the propagated uncertainty (as Standard Deviation-style uncertainties). This uncertainty assumes the input uncertainties are uncorrelated.

regionsSpectralRegion or list of SpectralRegion

Region within the spectrum to calculate the centroid.

analyticbool, optional

Set this flag to False to use the uncertainty distribution-based calculation for the centroid and its uncertainty instead of the default analytic solution.

Returns:
centroidfloat or list (based on region input)

Centroid of the spectrum or within the regions

Notes

The spectrum will need to be continuum subtracted before calling this method. See the analysis documentation for more information.