Skip to content

Handle non-monotonic 1D sweeps during gridding - #469

Merged
astafan8 merged 2 commits into
masterfrom
fix/nonmonotonic-sweep-grid
Sep 22, 2026
Merged

astafan8 merged 2 commits into
masterfrom
fix/nonmonotonic-sweep-grid

Conversation

@astafan8

@astafan8 astafan8 commented Sep 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

  • keep non-monotonic one-dimensional sweeps usable when Plottr applies shape metadata or infers a grid shape
  • preserve existing monotonicity validation for multidimensional grids
  • cover direction reversal and a repeated setpoint with synthetic regression data

Context

Plottr already supports non-monotonic one-dimensional datasets when gridding is disabled: they can be plotted as acquisition-ordered lines without requiring their coordinate values to be monotonic.

The same datasets could still fail when shape metadata was present or when Plottr attempted to infer a grid shape. In those paths, conversion to MeshgridDataDict applied multidimensional monotonicity requirements to a one-dimensional coordinate and rejected otherwise plottable data.

This change makes those paths user-friendly by allowing one-dimensional coordinates to reverse direction or repeat. The stricter monotonicity checks remain unchanged for multidimensional grids, where coordinate ordering is required to describe a valid mesh.

Testing

  • synthetic regression covers both metadata-based and inferred gridding
  • pytest -q test/pytest

Treat one-dimensional coordinates as acquisition-ordered lines while retaining monotonicity validation for multidimensional grids. Add synthetic regression coverage for a sweep that reverses direction.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1261dd26-b267-46d3-8a6c-8dbca70f7641
@astafan8
astafan8 requested review from jenshnielsen and a balanced review from Copilot September 22, 2026 07:35
@astafan8
astafan8 marked this pull request as ready for review September 22, 2026 07:35
@astafan8
astafan8 enabled auto-merge September 22, 2026 07:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot review overview

🟡 Changes recommended

Explicit coverage for repeated coordinates is still missing.

Get a fresh assessment by requesting another Copilot review.

Review effort: Balanced
Findings: 1 Low severity

Open (1)
What changed in this PR

Relaxes mesh validation for acquisition-ordered 1D sweeps while retaining multidimensional monotonicity checks.

Changes:

  • Skips monotonicity validation for single-axis dependents.
  • Adds regression coverage for reversed 1D sweeps.
File Description
plottr/​data/​datadict.py Permits non-monotonic 1D coordinates.
test/​pytest/​test_datadict_copy_semantics.py Tests reversed sweeps through both gridding paths.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread test/pytest/test_datadict_copy_semantics.py
@astafan8 astafan8 changed the title Allow non-monotonic one-dimensional sweeps Handle non-monotonic 1D sweeps during gridding Sep 22, 2026
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 1261dd26-b267-46d3-8a6c-8dbca70f7641
@astafan8
astafan8 marked this pull request as draft September 22, 2026 07:48
auto-merge was automatically disabled September 22, 2026 07:48

Pull request was converted to draft

@astafan8
astafan8 marked this pull request as ready for review September 22, 2026 07:50
@astafan8
astafan8 enabled auto-merge September 22, 2026 07:51
@astafan8
astafan8 merged commit 87be5d5 into master Sep 22, 2026
2 checks passed
@jenshnielsen
jenshnielsen deleted the fix/nonmonotonic-sweep-grid branch September 22, 2026 07:53
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.

3 participants