centroid¶
- specutils.analysis.centroid(spectrum, regions=None, region=None, analytic=True)[source]¶
Calculate the centroid of a region, or regions, of the spectrum.
- Parameters:
- spectrum
Spectrum1D
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.
- regions
SpectralRegion
or list ofSpectralRegion
Region within the spectrum to calculate the centroid.
- analyticbool, optional
Set this flag to
False
to use theuncertainty
distribution-based calculation for the centroid and its uncertainty instead of the default analytic solution.
- spectrum
- 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.