specutils icon indicating copy to clipboard operation
specutils copied to clipboard

Document workflows for intensity calculations

Open nmearl opened this issue 5 years ago • 1 comments

Both issue #243 and #244 suggest ways of calculating the mean and standard deviations within a spectrum, respectively:

Oh and I guess the snippet above is now (v0.4) np.mean(extract_region(spectrum, reg).flux) or astropy.stats.sigma_clip(extract_region(spectrum, reg).flux, cenfunc=np.mean) if you want sigma-clipping

and

For completeness, in v0.4 that would be np.std(extract_region(spectrum, reg).flux)

These do not rise to the level of needing dedicated analysis functions but (as suggested in the linked issues) should be documented.

nmearl avatar May 06 '20 20:05 nmearl

What is the intended workflow if you need to sigma clip before doing a calculation? Is it simply to create a new spectrum, e.g.:

new_spec = Spectrum(sigma_clip(old_spec.flux), ...)

or is there a way to perform generic astropy/scipy/numpy functions on an array while preserving the underlying metadata, e.g.:

new_spec = sigma_clip(old_spec)

(this doesn't work out-of-the-box, at least)

keflavich avatar Aug 02 '25 11:08 keflavich