Skip to content

Commit

Permalink
Merge pull request #25 from derb12/development
Browse files Browse the repository at this point in the history
Merge development for v1.0.0
  • Loading branch information
derb12 committed Oct 27, 2022
2 parents 801e417 + c6fcf1b commit bd0e3cc
Show file tree
Hide file tree
Showing 74 changed files with 13,182 additions and 6,975 deletions.
10 changes: 9 additions & 1 deletion .bumpversion.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[bumpversion]
current_version = 0.8.0
current_version = 1.0.0
commit = False
tag = False

Expand All @@ -14,3 +14,11 @@ replace = __version__ = '{new_version}'
[bumpversion:file:docs/conf.py]
search = version = '{current_version}'
replace = version = '{new_version}'

[bumpversion:file:CITATION.cff]
search = version: {current_version}
replace = version: {new_version}

[bumpversion:file:docs/citing.rst]
search = version = {{{current_version}}}
replace = version = {{{new_version}}}
15 changes: 8 additions & 7 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,13 @@ jobs:
fail-fast: false
matrix:
# Use strings since yaml considers 3.10 equal to 3.1
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10']
python-version: ['3.6', '3.7', '3.8', '3.9', '3.10', '3.11']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down Expand Up @@ -66,11 +66,12 @@ jobs:

- name: Install optional dependencies
id: install-optional
# skip optional depedencies for python 3.10 until numba is available
if: matrix.python-version != '3.10'
# uncomment below in case this step ever needs skipped again
if: matrix.python-version != '3.11'
run: python -m pip install "pentapy>=1.0" "numba>=0.45"

- name: Test with optional dependencies
# uncomment below in case this step ever needs skipped again
if: steps.install-optional.outcome == 'success'
run: pytest .

Expand All @@ -84,10 +85,10 @@ jobs:
python-version: ['3.6']

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}

Expand Down
55 changes: 55 additions & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,61 @@
Changelog
=========

Version 1.0.0 (2022-10-26)
--------------------------

This is a major version with new features, bug fixes, deprecations,
and documentation improvements.

New Features
~~~~~~~~~~~~

* Added a new class-based api for all algorithms, which can be accessed by using
the `pybaselines.api.Baseline` class. All algorithms are available as methods of
the `Baseline` class. The functional api from earlier versions is also maintained
for backwards compatibility.
* All functions now allow inputting an `x_data` keyword, even if it is not used within
the function, to allow for a more consistent api. Likewise, `pybaselines.misc.interp_pts`
added an unused `data` keyword. Now, all algorithms can be called with
the signature `baseline_algorithm(data=y_data, x_data=x_data, ...)`.
* Added a function for Whittaker smoothing to pybaselines.utils,
`pybaselines.utils.whittaker_smooth`.
* whittaker.iasls and spline.psline_iasls now allow inputting a `diff_order` parameter.

Bug Fixes
~~~~~~~~~

* Fixed the addition of the penalty difference diagonals in spline.pspline_drpls, which
was incorrectly treating the penalty diagonals as lower banded rather than fully banded.

Other Changes
~~~~~~~~~~~~~

* Officially list Python 3.11 as supported.
* Added default `half_window` values for snip and noise_median.
* collab_pls accomodates `alpha` for aspls and pspline_aspls; the `alpha` parameter is
calculated for the entire dataset in the same way as the weights and is then fixed when
fitting each of the individual data entries.
* Improved input validation.
* Improved testing base classes to reduce copied code and improve test coverage.
* Improved code handling for banded systems and penalized splines to simplify internal code.

Deprecations/Breaking Changes
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

* Removed the ability to pass addtional keyword arguments to algorithms in
pybaselines.optimizers, which was deprecated in version 0.8.0.
* Removed the deprecated pybaselines.window module, which was formally deprecated in version 0.8.
* Moved the `PENTAPY_SOLVER` constant from pybaselines.utils to the new pybaselines.config module.

Documentation/Examples
~~~~~~~~~~~~~~~~~~~~~~

* Added citation guidelines to make it easier to cite pybaselines.
* Added new examples showing how to use the new `Baseline` class.
* Added a new example examining the `beads` algorithm.


Version 0.8.0 (2021-12-07)
--------------------------

Expand Down
29 changes: 29 additions & 0 deletions CITATION.cff
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
abstract: pybaselines is a Python library that provides many different algorithms for
performing baseline correction on data from experimental techniques such as Raman,
FTIR, NMR, XRD, etc.
authors:
- family-names: Erb
given-names: Donald
cff-version: 1.2.0
identifiers:
- type: doi
value: 10.5281/zenodo.5608581
description: "Persistent DOI for all versions of pybaselines"
- type: url
value: https://github.com/derb12/pybaselines
description: "URL for the pybaselines source code repository"
- type: url
value: https://pypi.org/project/pybaselines
description: "URL for the PyPI upload of pybaselines"
keywords:
- "baseline correction"
- "materials characterization"
- spectroscopy
- Python
license: BSD-3-Clause
message: "If citing this software, consider using this metadata."
repository-artifact: https://pypi.org/project/pybaselines
repository-code: https://github.com/derb12/pybaselines
title: "pybaselines: A Python library of algorithms for the baseline correction of experimental data"
type: software
version: 1.0.0
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
BSD 3-Clause License

Copyright (c) 2021, Donald Erb
Copyright (c) 2021-2022, Donald Erb
All rights reserved.

Redistribution and use in source and binary forms, with or without
Expand Down
27 changes: 20 additions & 7 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -132,14 +132,17 @@ pybaselines's documentation. For examples of their usage, refer to the `examples

.. _examples section: https://pybaselines.readthedocs.io/en/latest/examples/index.html

A simple example is shown below.
A simple example is shown below (if using a version earlier than 1.0, see the `quickstart`_ in
the documentation for the old version).

.. _quickstart: https://pybaselines.readthedocs.io/en/latest/quickstart.html#pre-version-1-0-0-quick-start


.. code-block:: python
import matplotlib.pyplot as plt
import numpy as np
import pybaselines
from pybaselines import utils
from pybaselines import Baseline, utils
x = np.linspace(1, 1000, 1000)
# a measured signal containing several Gaussian peaks
Expand All @@ -159,10 +162,12 @@ A simple example is shown below.
y = signal + true_baseline + noise
bkg_1 = pybaselines.polynomial.modpoly(y, x, poly_order=3)[0]
bkg_2 = pybaselines.whittaker.asls(y, lam=1e7, p=0.02)[0]
bkg_3 = pybaselines.morphological.mor(y, half_window=30)[0]
bkg_4 = pybaselines.smooth.snip(
baseline_fitter = Baseline(x_data=x)
bkg_1 = baseline_fitter.modpoly(y, poly_order=3)[0]
bkg_2 = baseline_fitter.asls(y, lam=1e7, p=0.02)[0]
bkg_3 = baseline_fitter.mor(y, half_window=30)[0]
bkg_4 = baseline_fitter.snip(
y, max_half_window=40, decreasing=True, smooth_half_window=3
)[0]
Expand Down Expand Up @@ -211,6 +216,14 @@ For more information, refer to the license_.
.. _license: https://github.com/derb12/pybaselines/tree/main/LICENSE.txt


Citing
------

If you use pybaselines for published research, please consider citing
by following the `guidelines in the documentation
<https://pybaselines.readthedocs.io/en/latest/citing.html>`_.


Author
------

Expand Down
5 changes: 0 additions & 5 deletions docs/_templates/autoapi/python/module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,6 @@
{{ obj.name }}
{{ "=" * obj.name|length }}

{% if obj.name == "pybaselines.window" %}
{{ "This module was renamed in version 0.6.0. Use :mod:`pybaselines.smooth` instead." }}

{% endif %}

.. py:module:: {{ obj.name }}
Expand Down
Loading

0 comments on commit bd0e3cc

Please sign in to comment.