Skip to content

ENH: Add masking support for many algorithms - #83

Merged
derb12 merged 31 commits into
developmentfrom
add_masking
Jun 7, 2026
Merged

ENH: Add masking support for many algorithms#83
derb12 merged 31 commits into
developmentfrom
add_masking

Conversation

@derb12

@derb12 derb12 commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Description

Mostly addresses issue #72. Adds a new mask property to Baseline and Baseline2D to allow omitting regions from fitting, and adds test cases to ensure correct behavior. This PR adds mask support for all weighted algorithms (polynomial, Whittaker, and p-spline methods) except loess, which will be covered in a separate PR, plus a few optimizers. There are maybe a few other methods that could get mask support without much effort, but they can be added in a later follow up.

Type of Pull Request

  • Bug Fix
  • New Feature
  • Miscellaneous Changes (refactor, code improvements, etc.)
  • Documentation or Example Programs

Pull Request Checklist

  • New code and/or documentation is valid for use with the BSD 3-clause license.
  • New code is fully documented with docstrings that follow Numpy style,
    if applicable.
  • New code follows PEP 8 standards as closely as possible, if applicable.
  • Added/updated tests and ensured they pass locally, if applicable.
  • Verified that documentation builds locally, if applicable.

derb12 added 30 commits April 4, 2026 20:30
No methods currently support masking, so will error if actually used.
Also account for mask when normalizing in mixture_model
Also fixed 2D polynomial setup to not ignore when a mask is given.
Also mark all relevant 2D test classes as supporting masking.
Also set upper bound for amount of masked points.
The items were useless since the actual weights from fitting are contained within method_params['weights']. Marked adaptive_minmax as supporting masking.
Also add mask property to docs.
@derb12

derb12 commented Jun 7, 2026

Copy link
Copy Markdown
Owner Author

test_whittaker.py::TestAsPLS::test_pentadiagonal_solver is failing again. It looks like the solution is a little unstable, with 3.10, 3.11, 3.12, and nightly failing with rtol 0.00016443 and atol 0.082209809, while 3.13 and 3.14 fail with rtol 0.00016311 and atol 0.08167898. For now I'll just bump the rtol again, but might want to change the data it's fitting so the fit's more stable in the future.

test_whittaker.py::TestDerpsalsa::test_masking_fit_all only fails on the nightly; just need a small rtol bump.

@derb12

derb12 commented Jun 7, 2026

Copy link
Copy Markdown
Owner Author

rtd failure is from the masking example, which will be removed/rewritten on the docs branch, so not worth triggering CI again to fix.

@derb12
derb12 merged commit a1da800 into development Jun 7, 2026
10 of 11 checks passed
@derb12
derb12 deleted the add_masking branch June 7, 2026 15:40
This was referenced Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant