Skip to content

FIX: Keep adaptive-minmax constraints aligned with unsorted coordinates - #96

Merged
derb12 merged 2 commits into
derb12:developmentfrom
antonsoo:fix/adaptive-minmax-coordinate-order
Oct 11, 2026
Merged

derb12 merged 2 commits into
derb12:developmentfrom
antonsoo:fix/adaptive-minmax-coordinate-order

Conversation

@antonsoo

Copy link
Copy Markdown

Description

adaptive_minmax builds endpoint constraints in sorted coordinate order. When weights is omitted, it skips restoring those constraints to the input order, so reversed or shuffled coordinates constrain the wrong samples. This affects both Baseline and Baseline2D.

Always restore the constrained weights to input order. Keep the existing conditional restoration for the original weights. Add regressions for both polynomial methods and document that endpoints follow physical coordinates.

Validation:

  • The eight new reversed/shuffled cases fail before and pass afterward; the four ordered controls pass throughout. The full suite passes with 10,024 passed and 113 skipped. Ruff and the full documentation build, including all 23 gallery examples, pass.
  • On measured Raman spectra, all 144 incorrect reordered results are corrected: 96 single-spectrum fits and 48 fits of matrices containing repeated measurements. All 216 tested outputs now exactly match coordinate-aligned references, including an independent one-dimensional oracle that constructs endpoint membership from physical coordinates. All 360 explicit-weight control outputs remain byte-identical.

These checks establish coordinate invariance; they do not assess the quality of the baseline model.

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 follows the style and docstring guidelines
  • Added/updated tests and ensured they pass locally
  • Verified that documentation builds locally

Comment thread tests/two_d/test_optimizers.py Outdated
Comment thread tests/two_d/test_optimizers.py
@derb12 derb12 changed the title Keep adaptive-minmax constraints aligned with unsorted coordinates FIX: Keep adaptive-minmax constraints aligned with unsorted coordinates Oct 11, 2026
@derb12

derb12 commented Oct 11, 2026

Copy link
Copy Markdown
Owner

The segmentation faults in the test-min-dependencies job are unrelated to the changes here, so can ignore.

Thanks again for both this and PR 97.

@derb12
derb12 merged commit b2ca208 into derb12:development Oct 11, 2026
10 of 11 checks passed
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.

2 participants