astropy / specutils

An Astropy coordinated package for astronomical spectroscopy. Maintainers: @rosteen @keflavich @eteq
http://specutils.readthedocs.io/en/latest/
166 stars 126 forks source link

fit_lines center window does not work #1160

Closed TurboSlayer closed 1 week ago

TurboSlayer commented 3 weeks ago

Using a single value for window in fit_lines causes the program to use the entire spectrum as opposed to centering around the mean of the gaussian. Defining the window bounds manually works as expected. I've tried putting in some extreme constants into window such as np.inf and negative numbers, all of which have no effect on the line fit.

Defining a window of 10 by setting bounds manually:

g_init = models.Gaussian1D(amplitude=2000, mean=6563 * u.AA, stddev=3 * u.AA)
g_init += models.Const1D(0)
g_fit = fit_lines(spectrum, g_init, window=(6553 * u.AA, 6573 * u.AA))

bounds_window

Defining a window of 10 automatically:

g_init = models.Gaussian1D(amplitude=2000, mean=6563 * u.AA, stddev=3 * u.AA)
g_init += models.Const1D(0)
g_fit = fit_lines(spectrum, g_init, window=10 * u.AA)

center_window

rosteen commented 3 weeks ago

Thanks for the report, I'm hoping I'll have time to look into this next week.