gaussFitSpec 0.1.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- gaussfitspec-0.1.0/LICENSE +21 -0
- gaussfitspec-0.1.0/MANIFEST.in +17 -0
- gaussfitspec-0.1.0/PKG-INFO +42 -0
- gaussfitspec-0.1.0/README.md +22 -0
- gaussfitspec-0.1.0/docs/api.rst +26 -0
- gaussfitspec-0.1.0/docs/conf.py +28 -0
- gaussfitspec-0.1.0/docs/examples.rst +32 -0
- gaussfitspec-0.1.0/docs/index.rst +18 -0
- gaussfitspec-0.1.0/docs/input_format.rst +29 -0
- gaussfitspec-0.1.0/docs/installation.rst +16 -0
- gaussfitspec-0.1.0/docs/model_selection.rst +32 -0
- gaussfitspec-0.1.0/docs/usage.rst +89 -0
- gaussfitspec-0.1.0/examples/example_components.csv +3 -0
- gaussfitspec-0.1.0/examples/example_fit.png +0 -0
- gaussfitspec-0.1.0/examples/example_spectra.txt +200 -0
- gaussfitspec-0.1.0/pyproject.toml +39 -0
- gaussfitspec-0.1.0/setup.cfg +4 -0
- gaussfitspec-0.1.0/src/gaussFitSpec/__init__.py +19 -0
- gaussfitspec-0.1.0/src/gaussFitSpec/fitting.py +533 -0
- gaussfitspec-0.1.0/src/gaussFitSpec/io.py +83 -0
- gaussfitspec-0.1.0/src/gaussFitSpec/plotting.py +148 -0
- gaussfitspec-0.1.0/src/gaussFitSpec.egg-info/PKG-INFO +42 -0
- gaussfitspec-0.1.0/src/gaussFitSpec.egg-info/SOURCES.txt +24 -0
- gaussfitspec-0.1.0/src/gaussFitSpec.egg-info/dependency_links.txt +1 -0
- gaussfitspec-0.1.0/src/gaussFitSpec.egg-info/requires.txt +11 -0
- gaussfitspec-0.1.0/src/gaussFitSpec.egg-info/top_level.txt +1 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Hongxing Chen
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
include README.md
|
|
2
|
+
include LICENSE
|
|
3
|
+
include pyproject.toml
|
|
4
|
+
include examples/example_spectra.txt
|
|
5
|
+
include examples/example_components.csv
|
|
6
|
+
include examples/example_fit.png
|
|
7
|
+
recursive-include src *.py
|
|
8
|
+
recursive-include docs *.rst *.py
|
|
9
|
+
|
|
10
|
+
global-exclude __pycache__
|
|
11
|
+
global-exclude *.py[cod]
|
|
12
|
+
|
|
13
|
+
prune .pytest_cache
|
|
14
|
+
prune tests
|
|
15
|
+
prune build
|
|
16
|
+
prune dist
|
|
17
|
+
prune docs/_build
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: gaussFitSpec
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Lightweight 1D Gaussian spectral decomposition.
|
|
5
|
+
Author: Hongxing Chen
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Description-Content-Type: text/markdown
|
|
9
|
+
License-File: LICENSE
|
|
10
|
+
Requires-Dist: matplotlib>=3.7
|
|
11
|
+
Requires-Dist: numpy>=1.24
|
|
12
|
+
Requires-Dist: pandas>=2.0
|
|
13
|
+
Requires-Dist: scipy>=1.10
|
|
14
|
+
Provides-Extra: dev
|
|
15
|
+
Requires-Dist: pytest>=7.4; extra == "dev"
|
|
16
|
+
Provides-Extra: docs
|
|
17
|
+
Requires-Dist: sphinx>=8; extra == "docs"
|
|
18
|
+
Requires-Dist: sphinx-rtd-theme>=3; extra == "docs"
|
|
19
|
+
Dynamic: license-file
|
|
20
|
+
|
|
21
|
+
# gaussFitSpec
|
|
22
|
+
|
|
23
|
+
[](https://pypi.org/project/gaussFitSpec/)
|
|
24
|
+
[](https://pypi.org/project/gaussFitSpec/)
|
|
25
|
+
[](https://gaussfitspec.readthedocs.io/en/latest/)
|
|
26
|
+
[](https://doi.org/10.5281/zenodo.20917299)
|
|
27
|
+
[](LICENSE)
|
|
28
|
+
|
|
29
|
+
Lightweight 1D Gaussian spectral decomposition for independent spectra.
|
|
30
|
+
|
|
31
|
+
`gaussFitSpec` fits one-dimensional spectra with multiple Gaussian components
|
|
32
|
+
and returns fitted component parameters as a pandas DataFrame.
|
|
33
|
+
|
|
34
|
+
## Links
|
|
35
|
+
|
|
36
|
+
- PyPI: https://pypi.org/project/gaussFitSpec/
|
|
37
|
+
- Documentation: https://gaussfitspec.readthedocs.io/en/latest/
|
|
38
|
+
- Source code: https://github.com/retarchen/GaussianFitSpectra
|
|
39
|
+
- Citation DOI: https://doi.org/10.5281/zenodo.20917299
|
|
40
|
+
|
|
41
|
+
This release is archived on Zenodo and can be cited with DOI
|
|
42
|
+
`10.5281/zenodo.20917299`.
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
# gaussFitSpec
|
|
2
|
+
|
|
3
|
+
[](https://pypi.org/project/gaussFitSpec/)
|
|
4
|
+
[](https://pypi.org/project/gaussFitSpec/)
|
|
5
|
+
[](https://gaussfitspec.readthedocs.io/en/latest/)
|
|
6
|
+
[](https://doi.org/10.5281/zenodo.20917299)
|
|
7
|
+
[](LICENSE)
|
|
8
|
+
|
|
9
|
+
Lightweight 1D Gaussian spectral decomposition for independent spectra.
|
|
10
|
+
|
|
11
|
+
`gaussFitSpec` fits one-dimensional spectra with multiple Gaussian components
|
|
12
|
+
and returns fitted component parameters as a pandas DataFrame.
|
|
13
|
+
|
|
14
|
+
## Links
|
|
15
|
+
|
|
16
|
+
- PyPI: https://pypi.org/project/gaussFitSpec/
|
|
17
|
+
- Documentation: https://gaussfitspec.readthedocs.io/en/latest/
|
|
18
|
+
- Source code: https://github.com/retarchen/GaussianFitSpectra
|
|
19
|
+
- Citation DOI: https://doi.org/10.5281/zenodo.20917299
|
|
20
|
+
|
|
21
|
+
This release is archived on Zenodo and can be cited with DOI
|
|
22
|
+
`10.5281/zenodo.20917299`.
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
API Reference
|
|
2
|
+
=============
|
|
3
|
+
|
|
4
|
+
Public API
|
|
5
|
+
----------
|
|
6
|
+
|
|
7
|
+
.. automodule:: gaussFitSpec
|
|
8
|
+
:members:
|
|
9
|
+
|
|
10
|
+
Fitting
|
|
11
|
+
-------
|
|
12
|
+
|
|
13
|
+
.. automodule:: gaussFitSpec.fitting
|
|
14
|
+
:members: SpectrumFitResult, fit_spectrum
|
|
15
|
+
|
|
16
|
+
I/O
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
.. automodule:: gaussFitSpec.io
|
|
20
|
+
:members:
|
|
21
|
+
|
|
22
|
+
Plotting
|
|
23
|
+
--------
|
|
24
|
+
|
|
25
|
+
.. automodule:: gaussFitSpec.plotting
|
|
26
|
+
:members:
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"""Sphinx configuration for gaussFitSpec."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from pathlib import Path
|
|
6
|
+
import sys
|
|
7
|
+
|
|
8
|
+
PROJECT_ROOT = Path(__file__).resolve().parents[1]
|
|
9
|
+
sys.path.insert(0, str(PROJECT_ROOT / "src"))
|
|
10
|
+
|
|
11
|
+
project = "gaussFitSpec"
|
|
12
|
+
author = "Hongxing Chen"
|
|
13
|
+
release = "0.1.0"
|
|
14
|
+
|
|
15
|
+
extensions = [
|
|
16
|
+
"sphinx.ext.autodoc",
|
|
17
|
+
"sphinx.ext.napoleon",
|
|
18
|
+
"sphinx.ext.viewcode",
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
templates_path = ["_templates"]
|
|
22
|
+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
|
|
23
|
+
|
|
24
|
+
html_theme = "sphinx_rtd_theme"
|
|
25
|
+
html_static_path = ["_static"]
|
|
26
|
+
autodoc_typehints = "description"
|
|
27
|
+
napoleon_google_docstring = True
|
|
28
|
+
napoleon_numpy_docstring = True
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Examples
|
|
2
|
+
========
|
|
3
|
+
|
|
4
|
+
The repository includes an example spectrum at:
|
|
5
|
+
|
|
6
|
+
.. code-block:: text
|
|
7
|
+
|
|
8
|
+
examples/example_spectra.txt
|
|
9
|
+
|
|
10
|
+
Run the example script from the project root:
|
|
11
|
+
|
|
12
|
+
.. code-block:: bash
|
|
13
|
+
|
|
14
|
+
python examples/run_example.py
|
|
15
|
+
|
|
16
|
+
The script writes:
|
|
17
|
+
|
|
18
|
+
.. code-block:: text
|
|
19
|
+
|
|
20
|
+
examples/example_components.csv
|
|
21
|
+
examples/example_fit.png
|
|
22
|
+
|
|
23
|
+
The example output plot is shown below as a reference for a successful fit:
|
|
24
|
+
|
|
25
|
+
.. image:: ../examples/example_fit.png
|
|
26
|
+
:alt: Diagnostic Gaussian fit for the bundled example spectrum
|
|
27
|
+
:align: center
|
|
28
|
+
:width: 90%
|
|
29
|
+
|
|
30
|
+
The fitted component table is also included as a downloadable example output:
|
|
31
|
+
|
|
32
|
+
:download:`Download example_components.csv <../examples/example_components.csv>`
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
gaussFitSpec documentation
|
|
2
|
+
==========================
|
|
3
|
+
|
|
4
|
+
``gaussFitSpec`` is a lightweight Python package for decomposing an independent
|
|
5
|
+
1D spectrum into multiple Gaussian components. It supports BIC and approximate
|
|
6
|
+
F-test model selection, returns fitted components as a pandas DataFrame, and can
|
|
7
|
+
create diagnostic plots.
|
|
8
|
+
|
|
9
|
+
.. toctree::
|
|
10
|
+
:maxdepth: 2
|
|
11
|
+
:caption: User Guide
|
|
12
|
+
|
|
13
|
+
installation
|
|
14
|
+
input_format
|
|
15
|
+
usage
|
|
16
|
+
model_selection
|
|
17
|
+
examples
|
|
18
|
+
api
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
Input Format
|
|
2
|
+
============
|
|
3
|
+
|
|
4
|
+
Input spectrum files must contain exactly three numerical columns in this order:
|
|
5
|
+
|
|
6
|
+
1. ``velocity``
|
|
7
|
+
2. ``spectrum``
|
|
8
|
+
3. ``spectrum_err``
|
|
9
|
+
|
|
10
|
+
Plain text tables such as ``.txt``, ``.dat``, and ``.csv`` are supported when
|
|
11
|
+
they follow this three-column structure. Whitespace-separated and comma-separated
|
|
12
|
+
tables are both accepted.
|
|
13
|
+
|
|
14
|
+
Example
|
|
15
|
+
-------
|
|
16
|
+
|
|
17
|
+
.. code-block:: text
|
|
18
|
+
|
|
19
|
+
223.526564 0.040043 0.172759
|
|
20
|
+
224.113598 0.180919 0.789550
|
|
21
|
+
224.700631 0.293556 1.416493
|
|
22
|
+
|
|
23
|
+
Read a file with:
|
|
24
|
+
|
|
25
|
+
.. code-block:: python
|
|
26
|
+
|
|
27
|
+
from gaussFitSpec import read_spectrum
|
|
28
|
+
|
|
29
|
+
velocity, spectrum, spectrum_err = read_spectrum("examples/example_spectra.txt")
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Installation
|
|
2
|
+
============
|
|
3
|
+
|
|
4
|
+
Install the package in editable mode from the project root:
|
|
5
|
+
|
|
6
|
+
.. code-block:: bash
|
|
7
|
+
|
|
8
|
+
pip install -e .
|
|
9
|
+
|
|
10
|
+
For development and testing:
|
|
11
|
+
|
|
12
|
+
.. code-block:: bash
|
|
13
|
+
|
|
14
|
+
pip install -e ".[dev]"
|
|
15
|
+
|
|
16
|
+
The package depends on ``numpy``, ``scipy``, ``pandas``, and ``matplotlib``.
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
Model Selection
|
|
2
|
+
===============
|
|
3
|
+
|
|
4
|
+
BIC
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
``method="bic"`` is the default. The package fits models with 1 through
|
|
8
|
+
``max_components`` Gaussian components and selects the model with the lowest BIC:
|
|
9
|
+
|
|
10
|
+
.. math::
|
|
11
|
+
|
|
12
|
+
\mathrm{BIC} = \chi^2 + k \ln(n)
|
|
13
|
+
|
|
14
|
+
where ``k`` is the number of free parameters and ``n`` is the number of data
|
|
15
|
+
points.
|
|
16
|
+
|
|
17
|
+
F-test
|
|
18
|
+
------
|
|
19
|
+
|
|
20
|
+
``method="f_test"`` adds one component at a time and keeps the additional
|
|
21
|
+
component only when the approximate F-test reports:
|
|
22
|
+
|
|
23
|
+
.. code-block:: text
|
|
24
|
+
|
|
25
|
+
p < f_test_alpha
|
|
26
|
+
|
|
27
|
+
The default threshold is ``f_test_alpha=0.05``.
|
|
28
|
+
|
|
29
|
+
The F-test implementation is an approximate nested-model comparison based on
|
|
30
|
+
the improvement in residual sum of squares. It is useful for practical model
|
|
31
|
+
selection, but it should not be treated as a fully rigorous astrophysical
|
|
32
|
+
line-identification test.
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
Basic Usage
|
|
2
|
+
===========
|
|
3
|
+
|
|
4
|
+
Fit a spectrum with the default BIC model selection:
|
|
5
|
+
|
|
6
|
+
.. code-block:: python
|
|
7
|
+
|
|
8
|
+
from gaussFitSpec import fit_spectrum, plot_fit, read_spectrum
|
|
9
|
+
|
|
10
|
+
velocity, spectrum, spectrum_err = read_spectrum("examples/example_spectra.txt")
|
|
11
|
+
|
|
12
|
+
result = fit_spectrum(
|
|
13
|
+
velocity,
|
|
14
|
+
spectrum,
|
|
15
|
+
spectrum_err,
|
|
16
|
+
name="spectra1",
|
|
17
|
+
method="bic",
|
|
18
|
+
max_components=8,
|
|
19
|
+
)
|
|
20
|
+
|
|
21
|
+
print(result.components)
|
|
22
|
+
result.to_csv("examples/example_components.csv")
|
|
23
|
+
|
|
24
|
+
plot_fit(
|
|
25
|
+
velocity,
|
|
26
|
+
spectrum,
|
|
27
|
+
spectrum_err,
|
|
28
|
+
result,
|
|
29
|
+
output_file="examples/example_fit.png",
|
|
30
|
+
)
|
|
31
|
+
|
|
32
|
+
Fitting Options
|
|
33
|
+
---------------
|
|
34
|
+
|
|
35
|
+
Use ``min_fwhm`` and ``max_fwhm`` to constrain component widths:
|
|
36
|
+
|
|
37
|
+
.. code-block:: python
|
|
38
|
+
|
|
39
|
+
result = fit_spectrum(
|
|
40
|
+
velocity,
|
|
41
|
+
spectrum,
|
|
42
|
+
spectrum_err,
|
|
43
|
+
min_fwhm=2.0,
|
|
44
|
+
max_fwhm=40.0,
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
Fit Result
|
|
48
|
+
----------
|
|
49
|
+
|
|
50
|
+
The returned ``SpectrumFitResult`` contains:
|
|
51
|
+
|
|
52
|
+
``components``
|
|
53
|
+
A pandas DataFrame with one row per Gaussian component.
|
|
54
|
+
|
|
55
|
+
``best_model``
|
|
56
|
+
The total fitted Gaussian model evaluated on the input velocity grid.
|
|
57
|
+
|
|
58
|
+
``individual_components``
|
|
59
|
+
A 2D array containing each Gaussian component evaluated on the input velocity
|
|
60
|
+
grid.
|
|
61
|
+
|
|
62
|
+
``residual``
|
|
63
|
+
``spectrum - best_model``.
|
|
64
|
+
|
|
65
|
+
``method``
|
|
66
|
+
The selected model-selection method.
|
|
67
|
+
|
|
68
|
+
``n_components``
|
|
69
|
+
The number of selected Gaussian components.
|
|
70
|
+
|
|
71
|
+
``fit_statistics``
|
|
72
|
+
A dictionary with values such as ``chi2``, ``reduced_chi2``, ``aic``, and
|
|
73
|
+
``bic``.
|
|
74
|
+
|
|
75
|
+
Component Table
|
|
76
|
+
---------------
|
|
77
|
+
|
|
78
|
+
The component table includes:
|
|
79
|
+
|
|
80
|
+
.. code-block:: text
|
|
81
|
+
|
|
82
|
+
name
|
|
83
|
+
component_index
|
|
84
|
+
amplitude
|
|
85
|
+
amplitude_err
|
|
86
|
+
velocity
|
|
87
|
+
velocity_err
|
|
88
|
+
fwhm
|
|
89
|
+
fwhm_err
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
name,component_index,amplitude,amplitude_err,velocity,velocity_err,fwhm,fwhm_err
|
|
2
|
+
spectra1,1,30.719455863304102,1.2960236955351023,242.08519230354096,0.12379227433705506,8.785013010396264,0.3637763168311731
|
|
3
|
+
spectra1,2,18.043265182018196,0.8105330499276882,245.05006347937564,0.27913280072025837,29.697380157924023,0.7310859766237641
|
|
Binary file
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
169.223213 -0.051378 0.084575
|
|
2
|
+
170.029980 -0.209886 0.381358
|
|
3
|
+
170.836746 -0.240423 0.704199
|
|
4
|
+
171.643513 0.084050 0.796395
|
|
5
|
+
172.450280 0.225295 0.740715
|
|
6
|
+
173.257047 0.109119 0.824865
|
|
7
|
+
174.063813 0.069419 0.835017
|
|
8
|
+
174.870580 0.108204 0.742901
|
|
9
|
+
175.677347 0.294026 0.801274
|
|
10
|
+
176.484113 0.355414 0.849117
|
|
11
|
+
177.290880 0.279666 0.800087
|
|
12
|
+
178.097647 0.143762 0.665558
|
|
13
|
+
178.904413 -0.013534 0.731112
|
|
14
|
+
179.711180 -0.058090 0.872266
|
|
15
|
+
180.517947 -0.038125 0.903539
|
|
16
|
+
181.324713 0.035891 0.961912
|
|
17
|
+
182.131480 0.027419 0.831842
|
|
18
|
+
182.938247 -0.006093 0.907416
|
|
19
|
+
183.745013 -0.046264 0.998111
|
|
20
|
+
184.551780 -0.198992 0.926267
|
|
21
|
+
185.358547 -0.309919 0.943745
|
|
22
|
+
186.165313 -0.248100 0.934969
|
|
23
|
+
186.972080 -0.062067 0.876708
|
|
24
|
+
187.778847 0.064827 0.791065
|
|
25
|
+
188.585613 0.018504 0.713378
|
|
26
|
+
189.392380 0.008915 0.815016
|
|
27
|
+
190.199147 0.095548 0.901835
|
|
28
|
+
191.005913 0.127256 0.849412
|
|
29
|
+
191.812680 -0.046437 0.925115
|
|
30
|
+
192.619447 -0.210392 0.939867
|
|
31
|
+
193.426213 -0.136177 0.906167
|
|
32
|
+
194.232980 0.088370 0.789601
|
|
33
|
+
195.039747 0.296789 0.815457
|
|
34
|
+
195.846514 0.312478 0.711472
|
|
35
|
+
196.653280 0.215387 0.676745
|
|
36
|
+
197.460047 0.189120 0.810944
|
|
37
|
+
198.266814 0.256178 0.959052
|
|
38
|
+
199.073580 0.459011 0.939783
|
|
39
|
+
199.880347 0.593154 0.959268
|
|
40
|
+
200.687114 0.477939 0.767762
|
|
41
|
+
201.493880 0.244436 0.695782
|
|
42
|
+
202.300647 0.247385 0.818448
|
|
43
|
+
203.107414 0.361873 0.884467
|
|
44
|
+
203.914180 0.256186 0.872900
|
|
45
|
+
204.720947 0.135204 0.768211
|
|
46
|
+
205.527714 0.351266 0.763784
|
|
47
|
+
206.334480 0.762746 0.719210
|
|
48
|
+
207.141247 0.919308 0.612173
|
|
49
|
+
207.948014 0.755364 0.684702
|
|
50
|
+
208.754780 0.701783 0.853603
|
|
51
|
+
209.561547 0.782473 0.866252
|
|
52
|
+
210.368314 0.824836 0.940176
|
|
53
|
+
211.175080 0.851642 0.993832
|
|
54
|
+
211.981847 0.903761 0.943186
|
|
55
|
+
212.788614 1.030113 0.952811
|
|
56
|
+
213.595380 1.137577 0.941376
|
|
57
|
+
214.402147 1.161150 0.790976
|
|
58
|
+
215.208914 1.175361 0.775262
|
|
59
|
+
216.015681 1.309951 0.903400
|
|
60
|
+
216.822447 1.624255 0.910242
|
|
61
|
+
217.629214 1.833445 0.886051
|
|
62
|
+
218.435981 2.022358 0.894370
|
|
63
|
+
219.242747 2.437275 0.939360
|
|
64
|
+
220.049514 2.741029 0.807583
|
|
65
|
+
220.856281 2.821305 0.863376
|
|
66
|
+
221.663047 3.007326 1.148641
|
|
67
|
+
222.469814 3.383987 1.201270
|
|
68
|
+
223.276581 3.756919 1.128092
|
|
69
|
+
224.083347 4.105148 1.146127
|
|
70
|
+
224.890114 4.471130 1.086450
|
|
71
|
+
225.696881 4.888089 0.884743
|
|
72
|
+
226.503647 5.376625 1.066133
|
|
73
|
+
227.310414 6.053403 1.175447
|
|
74
|
+
228.117181 6.985528 1.269142
|
|
75
|
+
228.923947 7.888375 1.445930
|
|
76
|
+
229.730714 8.670854 1.619215
|
|
77
|
+
230.537481 9.559677 1.363808
|
|
78
|
+
231.344247 10.811086 0.986892
|
|
79
|
+
232.151014 12.232121 1.050776
|
|
80
|
+
232.957781 13.597061 1.076988
|
|
81
|
+
233.764547 15.122914 1.289056
|
|
82
|
+
234.571314 17.204223 1.648180
|
|
83
|
+
235.378081 19.853025 1.570089
|
|
84
|
+
236.184847 22.913794 1.485301
|
|
85
|
+
236.991614 26.414981 1.784028
|
|
86
|
+
237.798381 30.477241 2.243435
|
|
87
|
+
238.605148 34.997132 2.786707
|
|
88
|
+
239.411914 39.631692 3.161263
|
|
89
|
+
240.218681 43.899251 3.220666
|
|
90
|
+
241.025448 46.789029 3.235564
|
|
91
|
+
241.832214 47.715295 3.321778
|
|
92
|
+
242.638981 47.227129 3.096399
|
|
93
|
+
243.445748 45.992398 2.861070
|
|
94
|
+
244.252514 43.871485 2.691917
|
|
95
|
+
245.059281 40.961346 2.277715
|
|
96
|
+
245.866048 37.481588 1.747065
|
|
97
|
+
246.672814 33.458518 1.527372
|
|
98
|
+
247.479581 28.906482 1.567346
|
|
99
|
+
248.286348 24.612455 1.463185
|
|
100
|
+
249.093114 21.355218 1.252439
|
|
101
|
+
249.899881 19.160100 1.173143
|
|
102
|
+
250.706648 17.779837 1.358749
|
|
103
|
+
251.513414 16.781671 1.426363
|
|
104
|
+
252.320181 15.889040 1.392637
|
|
105
|
+
253.126948 15.302381 1.338812
|
|
106
|
+
253.933714 14.751068 1.313500
|
|
107
|
+
254.740481 14.021037 1.198413
|
|
108
|
+
255.547248 13.339361 1.186116
|
|
109
|
+
256.354014 12.537086 1.355677
|
|
110
|
+
257.160781 11.839795 1.358574
|
|
111
|
+
257.967548 11.121042 1.203808
|
|
112
|
+
258.774315 10.240221 1.261968
|
|
113
|
+
259.581081 9.350617 1.283421
|
|
114
|
+
260.387848 8.462893 1.335831
|
|
115
|
+
261.194615 7.655898 1.463723
|
|
116
|
+
262.001381 6.978076 1.606239
|
|
117
|
+
262.808148 6.347233 1.671197
|
|
118
|
+
263.614915 5.824419 1.445448
|
|
119
|
+
264.421681 5.451081 1.212917
|
|
120
|
+
265.228448 5.068914 1.238327
|
|
121
|
+
266.035215 4.644800 1.198635
|
|
122
|
+
266.841981 4.123035 1.181262
|
|
123
|
+
267.648748 3.605135 1.028579
|
|
124
|
+
268.455515 3.139130 0.984841
|
|
125
|
+
269.262281 2.624324 0.977819
|
|
126
|
+
270.069048 2.188257 0.997455
|
|
127
|
+
270.875815 2.066094 0.961392
|
|
128
|
+
271.682581 1.997856 1.076353
|
|
129
|
+
272.489348 1.739468 1.027318
|
|
130
|
+
273.296115 1.357335 0.867431
|
|
131
|
+
274.102881 1.222323 0.887501
|
|
132
|
+
274.909648 1.105125 1.020115
|
|
133
|
+
275.716415 0.898470 0.981746
|
|
134
|
+
276.523181 0.733163 0.827639
|
|
135
|
+
277.329948 0.763089 0.863280
|
|
136
|
+
278.136715 0.781045 0.910205
|
|
137
|
+
278.943482 0.620572 0.924676
|
|
138
|
+
279.750248 0.368894 1.055941
|
|
139
|
+
280.557015 0.206007 0.979581
|
|
140
|
+
281.363782 0.260230 0.891572
|
|
141
|
+
282.170548 0.299286 0.804352
|
|
142
|
+
282.977315 -0.007887 0.814386
|
|
143
|
+
283.784082 -0.360147 0.875297
|
|
144
|
+
284.590848 -0.424664 0.962512
|
|
145
|
+
285.397615 -0.417410 0.982056
|
|
146
|
+
286.204382 -0.268576 0.755472
|
|
147
|
+
287.011148 0.068532 0.807672
|
|
148
|
+
287.817915 0.241941 0.914048
|
|
149
|
+
288.624682 0.222014 0.784136
|
|
150
|
+
289.431448 0.144930 0.762920
|
|
151
|
+
290.238215 0.049685 0.774217
|
|
152
|
+
291.044982 -0.074506 0.794487
|
|
153
|
+
291.851748 -0.074674 0.795597
|
|
154
|
+
292.658515 -0.047697 0.742641
|
|
155
|
+
293.465282 -0.150940 0.839101
|
|
156
|
+
294.272048 -0.186577 0.936325
|
|
157
|
+
295.078815 -0.145823 0.822700
|
|
158
|
+
295.885582 -0.258044 0.885174
|
|
159
|
+
296.692348 -0.474601 1.029252
|
|
160
|
+
297.499115 -0.274283 0.975450
|
|
161
|
+
298.305882 0.108560 0.875500
|
|
162
|
+
299.112648 0.308847 0.984088
|
|
163
|
+
299.919415 0.222269 1.006629
|
|
164
|
+
300.726182 -0.042506 1.003279
|
|
165
|
+
301.532949 -0.134071 1.010686
|
|
166
|
+
302.339715 -0.073285 0.959841
|
|
167
|
+
303.146482 -0.093430 0.970801
|
|
168
|
+
303.953249 -0.160899 0.977550
|
|
169
|
+
304.760015 -0.031637 0.805491
|
|
170
|
+
305.566782 0.142979 0.876339
|
|
171
|
+
306.373549 0.218395 0.978226
|
|
172
|
+
307.180315 0.387146 0.859842
|
|
173
|
+
307.987082 0.558421 0.720247
|
|
174
|
+
308.793849 0.477668 0.723772
|
|
175
|
+
309.600615 0.319101 0.723067
|
|
176
|
+
310.407382 0.232847 0.753574
|
|
177
|
+
311.214149 0.146177 0.763329
|
|
178
|
+
312.020915 0.063254 0.879100
|
|
179
|
+
312.827682 0.067061 0.977356
|
|
180
|
+
313.634449 0.085607 0.967621
|
|
181
|
+
314.441215 -0.028195 1.022139
|
|
182
|
+
315.247982 -0.104256 1.042327
|
|
183
|
+
316.054749 -0.070856 0.891057
|
|
184
|
+
316.861515 -0.006097 0.801960
|
|
185
|
+
317.668282 0.038266 0.971858
|
|
186
|
+
318.475049 0.065924 1.028126
|
|
187
|
+
319.281815 0.104776 0.993460
|
|
188
|
+
320.088582 0.093295 0.922851
|
|
189
|
+
320.895349 0.046950 0.855686
|
|
190
|
+
321.702116 -0.028960 0.719254
|
|
191
|
+
322.508882 -0.113997 0.782099
|
|
192
|
+
323.315649 -0.143435 0.936198
|
|
193
|
+
324.122416 -0.084533 0.925058
|
|
194
|
+
324.929182 -0.068900 0.763369
|
|
195
|
+
325.735949 -0.060981 0.809960
|
|
196
|
+
326.542716 0.000180 0.793946
|
|
197
|
+
327.349482 0.122789 0.782817
|
|
198
|
+
328.156249 0.160396 0.910406
|
|
199
|
+
328.963016 0.092215 0.846644
|
|
200
|
+
329.769782 0.028310 0.432021
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "gaussFitSpec"
|
|
7
|
+
version = "0.1.0"
|
|
8
|
+
description = "Lightweight 1D Gaussian spectral decomposition."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = "MIT"
|
|
12
|
+
license-files = ["LICENSE"]
|
|
13
|
+
authors = [
|
|
14
|
+
{ name = "Hongxing Chen" }
|
|
15
|
+
]
|
|
16
|
+
dependencies = [
|
|
17
|
+
"matplotlib>=3.7",
|
|
18
|
+
"numpy>=1.24",
|
|
19
|
+
"pandas>=2.0",
|
|
20
|
+
"scipy>=1.10"
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[project.optional-dependencies]
|
|
24
|
+
dev = [
|
|
25
|
+
"pytest>=7.4"
|
|
26
|
+
]
|
|
27
|
+
docs = [
|
|
28
|
+
"sphinx>=8",
|
|
29
|
+
"sphinx-rtd-theme>=3"
|
|
30
|
+
]
|
|
31
|
+
|
|
32
|
+
[tool.setuptools]
|
|
33
|
+
package-dir = { "" = "src" }
|
|
34
|
+
|
|
35
|
+
[tool.setuptools.packages.find]
|
|
36
|
+
where = ["src"]
|
|
37
|
+
|
|
38
|
+
[tool.pytest.ini_options]
|
|
39
|
+
testpaths = ["tests"]
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"""Lightweight 1D Gaussian spectral decomposition.
|
|
2
|
+
|
|
3
|
+
The public API is intentionally small. Most users will read a three-column
|
|
4
|
+
spectrum table with :func:`read_spectrum`, fit it with :func:`fit_spectrum`,
|
|
5
|
+
save the returned component table, and optionally create a diagnostic plot with
|
|
6
|
+
:func:`plot_fit`.
|
|
7
|
+
"""
|
|
8
|
+
|
|
9
|
+
from .fitting import SpectrumFitResult, fit_spectrum
|
|
10
|
+
from .io import read_spectrum, save_components_csv
|
|
11
|
+
from .plotting import plot_fit
|
|
12
|
+
|
|
13
|
+
__all__ = [
|
|
14
|
+
"SpectrumFitResult",
|
|
15
|
+
"fit_spectrum",
|
|
16
|
+
"plot_fit",
|
|
17
|
+
"read_spectrum",
|
|
18
|
+
"save_components_csv",
|
|
19
|
+
]
|