Skip to content

Commit 3273b62

Browse files
committed
more contextual words about fitting in the docs
1 parent cdc3972 commit 3273b62

File tree

1 file changed

+34
-17
lines changed

1 file changed

+34
-17
lines changed

docs/fitting.rst

Lines changed: 34 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,41 @@
1-
===================
2-
Spectrum Fitting
3-
===================
1+
=====================
2+
Line/Spectrum Fitting
3+
=====================
44

5-
Specutils has the ability to fit the flux of a `~specutils.Spectrum1D` object.
6-
The fit routine takes the `~specutils.Spectrum1D` object and a list of
7-
`~astropy.modeling.Model` that have initial guesses for each of the parameters.
5+
One of the primary tasks in spectroscopic analysis is fitting models of spectra.
6+
This concept is often applied mainly to line-fitting, but the same general
7+
approach applies to continuum fitting or even full-spectrum fitting.
8+
``specutils`` provides conveniences that aim to leverage the general fitting
9+
framework of `astropy.modeling` to spectral-specific tasks.
810

9-
The internal functionality uses `~astropy.modeling.fitting` routines. The flux
10-
is extracted from the `~specutils.Spectrum1D` and is passed along with a
11-
compound model created from the model initial guesses.
11+
At a high level, this fitting takes the `~specutils.Spectrum1D` object and a
12+
list of `~astropy.modeling.Model` objects that have initial guesses for each of
13+
the parameters. these are used to create a compound model created from the model
14+
initial guesses. This model is then actually fit to the spectrum's ``flux``,
15+
yielding a single composite model result (which can be split back into its
16+
components if desired).
1217

13-
Model Fitting
14-
-------------
18+
Model (Line) Fitting
19+
--------------------
1520

16-
The first step is to create a set of models with initial guesses as the parameters. Even
17-
better is to include a set of bounds for each parameter, but that is optional. (A method
18-
will be provided in a future PR, but user defined initial guesses may be used with the
19-
current code).
21+
The generic model fitting machinery is well-suited to fitting spectral lines.
22+
The first step is to create a set of models with initial guesses as the
23+
parameters. To acheive better fits it may be wise to include a set of bounds for
24+
each parameter, but that is optional.
25+
26+
.. note::
27+
A method to make plausible initial guesses will be provided in a future
28+
version, but user defined initial guesses are required at present.
29+
30+
Below are a series of examples of this sort of fitting.
2031

2132

2233
Simple Example
2334
^^^^^^^^^^^^^^
2435

25-
Below is a simple example to demonstrate how to use the `~specutils.fitting.fit_lines` method
26-
to fit a spectrum to an Astropy model initial guess.
36+
Below is a simple example to demonstrate how to use the
37+
`~specutils.fitting.fit_lines` method to fit a spectrum to an Astropy model
38+
initial guess.
2739

2840
.. plot::
2941
:include-source:
@@ -429,6 +441,11 @@ all the data *except* between ``5.2*u.um`` and ``5.8*u.um``.
429441
Continuum Fitting
430442
-----------------
431443

444+
While the line-fitting machinery can be used to fit continuua at the same time
445+
as models, often it is convenient to subtract or normalize a spectrum by its
446+
continuum before other processing is done. ``specutils`` provides some
447+
convenience functions to perform exactly this task. An example is shown below.
448+
432449
.. plot::
433450
:include-source:
434451
:align: center

0 commit comments

Comments
 (0)