Skip to content

Commit 8595c67

Browse files
authored
Merge pull request #37 from derb12/development
MAINT: Merge development for v1.2.0
2 parents a70bedd + b96d308 commit 8595c67

File tree

129 files changed

+10636
-4355
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

129 files changed

+10636
-4355
lines changed

.github/workflows/python-test-latest.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ jobs:
3131
fail-fast: false
3232
matrix:
3333
# Choose the latest stable python version
34-
python-version: ['3.12']
34+
python-version: ['3.13']
3535

3636
steps:
3737
- uses: actions/checkout@v4

.github/workflows/python-test.yml

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -31,29 +31,31 @@ jobs:
3131
fail-fast: false
3232
matrix:
3333
# Use strings since yaml considers 3.10 equal to 3.1
34-
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12']
34+
python-version: ['3.9', '3.10', '3.11', '3.12', '3.13', '3.13t']
3535

3636
steps:
3737
- uses: actions/checkout@v4
3838

39-
- name: Set up Python ${{ matrix.python-version }}
40-
uses: actions/setup-python@v5
39+
- name: Set up Python
40+
# Switch back to actions/setup-python@v5 once they support free-threaded python;
41+
# see revelant PR: https://github.com/actions/setup-python/pull/973
42+
uses: Quansight-Labs/setup-python@v5
4143
with:
4244
python-version: ${{ matrix.python-version }}
4345

4446
- name: Install required dependencies
4547
run: |
4648
python -m pip install --upgrade pip
47-
python -m pip install "numpy>=1.20" "scipy>=1.5" pytest
49+
python -m pip install . pytest
4850
4951
- name: Test with required dependencies
5052
run: pytest .
5153

5254
- name: Install optional dependencies
5355
id: install-optional
5456
# uncomment below to allow skipping future versions
55-
#if: matrix.python-version != '3.13'
56-
run: python -m pip install "pentapy>=1.1" "numba>=0.49"
57+
if: matrix.python-version != '3.13t'
58+
run: python -m pip install .[full]
5759

5860
- name: Test with optional dependencies
5961
if: steps.install-optional.outcome == 'success'
@@ -66,7 +68,7 @@ jobs:
6668
strategy:
6769
fail-fast: false
6870
matrix:
69-
python-version: ['3.8']
71+
python-version: ['3.9']
7072

7173
steps:
7274
- uses: actions/checkout@v4
@@ -77,15 +79,17 @@ jobs:
7779
python-version: ${{ matrix.python-version }}
7880

7981
- name: Install minimum dependencies
82+
# set installed versions using "==major.minor.*"" to allow bug fixes on patch versions
83+
# for minimum supported versions
8084
run: |
8185
python -m pip install --upgrade pip
82-
python -m pip install "numpy==1.20" "scipy==1.5" pytest
86+
python -m pip install "numpy==1.20.*" "scipy==1.6.*" pytest
8387
8488
- name: Test with minimum required dependencies
8589
run: pytest .
8690

8791
- name: Install minimum optional dependencies
88-
run: python -m pip install "pentapy==1.1" "numba==0.49"
92+
run: python -m pip install "pentapy==1.1.*" "numba==0.53.*"
8993

9094
- name: Test with minimum optional dependencies
9195
run: pytest .
@@ -96,7 +100,7 @@ jobs:
96100
strategy:
97101
fail-fast: false
98102
matrix:
99-
python-version: ['3.11']
103+
python-version: ['3.13']
100104

101105
steps:
102106
- uses: actions/checkout@v4

.gitignore

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,12 +48,11 @@ coverage.xml
4848
# Sphinx documentation
4949
docs/_build/
5050

51-
# sphinx-gallery output
52-
docs/examples/
51+
52+
# generated documentation files, including timings from sphinx-gallery
53+
docs/generated
5354
sg_execution_times.rst
5455

55-
# sphinx-autoapi output
56-
docs/api
5756

5857
# PyBuilder
5958
target/

.readthedocs.yaml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ version: 2
66

77
# Set the version of Python and other tools you might need
88
build:
9-
os: ubuntu-22.04
9+
os: ubuntu-24.04
1010
tools:
11-
python: "3.11"
11+
python: "3.12"
1212

1313
# Path to sphinx's configuration file
1414
sphinx:
@@ -17,7 +17,6 @@ sphinx:
1717
# Build pdf and htmlzip files in addition to the html documentation
1818
formats:
1919
- pdf
20-
- htmlzip
2120

2221
# Additional requirements for the documentation
2322
python:

CHANGELOG.rst

Lines changed: 94 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,98 @@
22
Changelog
33
=========
44

5+
Version 1.2.0 (2025-03-17)
6+
--------------------------
7+
8+
This is a minor version with new features, bug fixes, deprecations,
9+
and documentation improvements.
10+
11+
New Features
12+
~~~~~~~~~~~~
13+
14+
* Added the locally symmetric reweighted penalized least squares (``lsrpls``) Whittaker smoothing
15+
algorithm and its penalized spline version ``pspline_lsrpls``.
16+
* Added the Bayesian reweighted penalized least squares (``brpls``) Whittaker smoothing
17+
algorithm and its penalized spline version ``pspline_brpls``.
18+
* Added the 4S peak filling (``peak_filling``) algorithm, which truncates the data and then iteratively
19+
selects the minimum of a directional moving average and the current data point.
20+
* ``Baseline`` and ``Baseline2D`` objects keep the computed pseudo-inverse of the Vandermonde for
21+
polynomial methods if weights are not given, which speeds up most polynomial methods for repeated
22+
fits.
23+
24+
Bug Fixes
25+
~~~~~~~~~
26+
27+
* All methods of ``Baseline`` and ``Baseline2D`` are now thread-safe as long as non-data arguments
28+
are the same for each method call.
29+
* Fixed incorrect indexing in ``rubberband``.
30+
* Removed using ``copy=False`` for numpy.array calls since it raised an error in Numpy versions
31+
2.0 or later if a copy had to be made.
32+
* Fixed an issue converting sparse matrices to banded matrices when solving penalized splines
33+
where a column could be omitted if the last diagonal value was zero. Only relevant if Numba
34+
is not installed and using SciPy versions 1.15 and newer.
35+
* Corrected ``airpls`` weighting; the weighting equation for airpls was misprinted in its journal
36+
article, so changed to the correct weighting scheme.
37+
* Improved overflow avoidance for ``iarpls``, ``airpls``, and ``drpls``.
38+
* Removed internal parallel processing for ``loess`` since it was problematic for both threaded and
39+
multiprocessing uses.
40+
* Fixed an issue when flattening 3D arrays with shape (N, M, 1) to (N, M) where the shape would be
41+
output instead of the flattened array.
42+
43+
Other Changes
44+
~~~~~~~~~~~~~
45+
46+
* Officially list Python 3.13 as supported, as well as the experimental free-threaded
47+
Python 3.13 build.
48+
* Updated lowest supported Python version to 3.9
49+
* Updated lowest supported dependency versions: NumPy 1.20, SciPy 1.6,
50+
pentapy 1.1, and Numba 0.53
51+
* Allow inputting ``assymetric_coef`` for ``aspls`` and ``pspline_aspls`` to modify shape of the
52+
weighting curve.
53+
* Added ``normalize_weights`` for ``airpls`` to normalize weights between 0 and 1, which is set to
54+
True by default. The new, corrected ``airpls`` weighting makes all negative residuals have weights
55+
greater than 1, so this option can help to avoid numerical issues or overflow. Set to False to ensure
56+
matching the literature implementation.
57+
58+
Deprecations/Breaking Changes
59+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
60+
61+
* All optimizer algorithms other than ``Baseline2D.individual_axes`` now return the parameter
62+
dictionary from the underlying method within the ``method_params`` key in order to avoid
63+
key overlap between the optimizer's parameters and the method parameters.
64+
* The default ``delta`` for ``loess`` was changed from 0 to ``0.01 * (max(x_data) - min(x_data))``.
65+
* The ``delta`` parameter for ``loess`` is now used on the actual input `x_data` rather
66+
than the `x_data` after scaling to the domain [-1, 1] to make it easier to use.
67+
* The ``optimal_parameter`` key for the ``optimize_extended_range`` method no longer returns the
68+
log10 of the optimal value when fitting a non polynomial method. For example, it now returns
69+
10000 rather than 4 if the optimal ``lam`` value was 10000.
70+
* Deprecated passing ``tol`` and ``max_iter`` to ``mpls`` and ``pspline_mpls`` since the keywords
71+
were not internally used. The keywords will be removed in version 1.4.
72+
* Deprecated the ``pentapy_solver`` attribute of ``Baseline`` and ``Baseline2D`` in
73+
favor of the ``banded_solver`` attribute to control the solvers used for banded linear systems.
74+
The attribute will be removed in version 1.4.
75+
* Deprecated passing additional keyword arguments for padding to multiple methods, and will remove
76+
the functionality in version 1.4. Keyword arguments for padding should now be grouped into
77+
the ``pad_kwargs`` parameter instead.
78+
* Deprecated passing additional keyword arguments for estimating the half-window parameter if none was
79+
given for morphological methods, and will remove the functionality in version 1.4. Keyword arguments
80+
for estimating the half-window should now be grouped into the ``window_kwargs`` parameter instead.
81+
* Deprecated the ``min_rmse`` key from the parameter dictionary output of ``optimize_extended_range``
82+
in favor of returning all calculated root mean square values from the fittings through the new ``rmse``
83+
key. The ``min_rmse`` key will be removed in version 1.4.
84+
* **Pending Deprecation**: The functional interface of pybaselines will be deprecated in version 1.3, and
85+
will be removed in version 2.0. For example, user code using ``whittaker.arpls(...)`` should
86+
migrate to ``Baseline.arpls(...)``. The only items that will be kept under the main pybaselines
87+
namespace will be ``Baseline``, ``Baseline2D``, and ``utils``.
88+
89+
Documentation/Examples
90+
~~~~~~~~~~~~~~~~~~~~~~
91+
92+
* Added new examples to the documentation.
93+
* Added a page describing best practices for fitting multiple datasets with pybaselines.
94+
* Render each method on its own page in the documentation.
95+
96+
597
Version 1.1.0 (2024-02-18)
698
--------------------------
799

@@ -16,12 +108,12 @@ New Features
16108
These can be accessed using the new `Baseline2D` class.
17109
* Added the `Baseline2D.individual_axes` method, which allows fitting each row and/or
18110
column in two dimensional data with any one dimensional method in pybaselines.
19-
* Added a version of the rubberband method to pybaselines.misc which allows fitting
111+
* Added a version of the rubberband method to pybaselines.classification which allows fitting
20112
individual segments within data to better fit concave-shaped data.
21113
* Added the Customized Baseline Correction (custom_bc) method to
22114
pybaselines.optimizers, which allows fitting baselines with controllable
23115
levels of stiffness in different regions.
24-
* Added a penalized version of mpls (pspline_mpls) to pybaselines.spline.
116+
* Added a penalized spline version of mpls (pspline_mpls) to pybaselines.spline.
25117
* Updated spline.mixture_model to use expectation-maximization rather than the previous
26118
nieve approach of fitting the histogram of the residuals with the probability density
27119
function. Should reduce calculation times.

CITATION.cff

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,4 +26,4 @@ repository-artifact: https://pypi.org/project/pybaselines
2626
repository-code: https://github.com/derb12/pybaselines
2727
title: "pybaselines: A Python library of algorithms for the baseline correction of experimental data"
2828
type: software
29-
version: 1.1.0
29+
version: 1.2.0

LICENSE.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
BSD 3-Clause License
22

3-
Copyright (c) 2021-2024, Donald Erb
3+
Copyright (c) 2021 Donald Erb
44
All rights reserved.
55

66
Redistribution and use in source and binary forms, with or without

LICENSES_bundled.txt

Lines changed: 0 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -130,38 +130,6 @@ IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
130130
OF SUCH DAMAGE.
131131

132132

133-
Source: sphinx-autoapi (https://github.com/readthedocs/sphinx-autoapi)
134-
Folder: All files within docs/_templates/autoapi were adapted from templates
135-
provided by sphinx-autoapi.
136-
License: MIT
137-
138-
The MIT License (MIT)
139-
=====================
140-
141-
Copyright (c) 2015 Read the Docs, Inc
142-
143-
Permission is hereby granted, free of charge, to any person
144-
obtaining a copy of this software and associated documentation
145-
files (the "Software"), to deal in the Software without
146-
restriction, including without limitation the rights to use,
147-
copy, modify, merge, publish, distribute, sublicense, and/or sell
148-
copies of the Software, and to permit persons to whom the
149-
Software is furnished to do so, subject to the following
150-
conditions:
151-
152-
The above copyright notice and this permission notice shall be
153-
included in all copies or substantial portions of the Software.
154-
155-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
156-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
157-
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
158-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
159-
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
160-
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
161-
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
162-
OTHER DEALINGS IN THE SOFTWARE.
163-
164-
165133
Source: SciPy (https://github.com/scipy/scipy, last accessed December 28, 2023)
166134
Files: pybaselines._spline_utils.py, pybaselines.classification.py
167135
License: 3-clause BSD

README.rst

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ pybaselines
3232

3333
pybaselines is a library of algorithms for the baseline correction of experimental data.
3434

35-
* For Python 3.8+
35+
* For Python 3.9 or later
3636
* Open Source: BSD 3-Clause License
3737
* Source Code: https://github.com/derb12/pybaselines
3838
* Documentation: https://pybaselines.readthedocs.io.
@@ -47,16 +47,16 @@ Introduction
4747

4848
pybaselines is a Python library that provides many different algorithms for
4949
performing baseline correction on data from experimental techniques such as
50-
Raman, FTIR, NMR, XRD, XRF, PIXE, etc. The aim of the project is to provide a
51-
semi-unified API to allow quickly testing and comparing multiple baseline
50+
Raman, FTIR, NMR, XRD, XRF, PIXE, MALDI-TOF, LIBS, etc. The aim of the project is
51+
to provide a semi-unified API to allow quickly testing and comparing multiple baseline
5252
correction algorithms to find the best one for a set of data.
5353

5454
pybaselines has 50+ baseline correction algorithms. These include popular algorithms,
5555
such as AsLS, airPLS, ModPoly, and SNIP, as well as many lesser known algorithms. Most
5656
algorithms are adapted directly from literature, although there are a few that are unique
5757
to pybaselines, such as penalized spline versions of Whittaker-smoothing-based algorithms.
5858
The full list of implemented algorithms can be found in the
59-
`documentation <https://pybaselines.readthedocs.io/en/latest/introduction.html>`_.
59+
`documentation <https://pybaselines.readthedocs.io/en/latest/api/Baseline.html>`_.
6060

6161

6262
Installation
@@ -88,7 +88,7 @@ To install the current version of pybaselines from GitHub, run:
8888

8989
.. code-block:: console
9090
91-
pip install git+https://github.com/derb12/pybaselines.git#egg=pybaselines
91+
pip install git+https://github.com/derb12/pybaselines.git
9292
9393
9494
.. _GitHub repo: https://github.com/derb12/pybaselines
@@ -97,7 +97,7 @@ To install the current version of pybaselines from GitHub, run:
9797
Dependencies
9898
~~~~~~~~~~~~
9999

100-
pybaselines requires `Python <https://python.org>`_ version 3.8 or later
100+
pybaselines requires `Python <https://python.org>`_ version 3.9 or later
101101
and the following libraries:
102102

103103
* `NumPy <https://numpy.org>`_
@@ -208,7 +208,7 @@ Refer to the changelog_ for information on pybaselines's changes.
208208
License
209209
-------
210210

211-
pybaselines is open source and freely available under the BSD 3-clause license.
211+
pybaselines is open source and freely available under the BSD-3-Clause license.
212212
For more information, refer to the license_.
213213

214214
.. _license: https://github.com/derb12/pybaselines/tree/main/LICENSE.txt

docs/_templates/autoapi/LICENSE.rst

Lines changed: 0 additions & 30 deletions
This file was deleted.

docs/_templates/autoapi/index.rst

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)