Skip to content

Conversation

@d-chambers
Copy link
Contributor

@d-chambers d-chambers commented Oct 4, 2025

Description

This PR fixes #462.

Checklist

I have (if applicable):

  • referenced the GitHub issue this PR closes.
  • documented the new feature with docstrings and/or appropriate doc page.
  • included tests. See testing guidelines.
  • added the "ready_for_review" tag once the PR is ready to be reviewed.

Summary by CodeRabbit

  • New Features

    • Wiggle plot now supports 1D data: directly plots using the remaining coordinate on the x-axis.
    • Automatically labels axes (x: dimension label, y: amplitude) and formats time axes when coordinates are datetime.
    • Optional display via show is supported; returns the plotting axis.
  • Tests

    • Added tests validating 1D wiggle plotting and show behavior to ensure correct axis labeling and rendering.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Oct 4, 2025

Walkthrough

Added an early code path in wiggle to handle 1D patches by plotting the single dimension against data with appropriate labeling and optional time-axis formatting, then returning the axis. Existing 2D logic remains unchanged. Added tests verifying 1D behavior, axis labeling, and show handling.

Changes

Cohort / File(s) Summary of Changes
Wiggle 1D handling
dascore/viz/wiggle.py
Added early branch for 1D patches: plot x from the sole dimension’s coordinates, y from data; set xlabel to dimension name, ylabel to "amplitude"; format datetime axis if applicable; support show and return axis. Preserved existing 2D flow.
Tests for 1D wiggle
tests/test_viz/test_wiggle.py
Added tests for 1D patches: verifies wiggle returns a matplotlib Axes with correct x-axis labeling; adds show=True test with plt.show mocked.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning, 1 inconclusive)
Check name Status Explanation Resolution
Description Check ⚠️ Warning The PR description follows the required template but only states “This PR fixes #462” and leaves the checklist unchecked, without explaining what code changes were made or their impact. This minimal description lacks detail on how the 1D patch support is implemented and verified. Please expand the Description section to outline the new early-path logic for 1D patches, describe how the plotting behavior changes, and check off completed checklist items including tests and documentation updates.
Title Check ❓ Inconclusive The pull request title “fix #462” only references the issue number without summarizing the implemented change and is too generic to convey that 1D patch support was added to viz.wiggle. It does not provide enough context for a reviewer scanning the history to understand the primary change. Please update the title to a concise description of the main change, for example “Support 1D patches in viz.wiggle plotting,” so it clearly communicates the purpose of the PR.
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues Check ✅ Passed The changes introduce a new branch in viz.wiggle to handle 1D patches by using the remaining dimension as the x-axis and the data as the y-axis, and the added tests verify this behavior, directly addressing the objective of issue #462.
Out of Scope Changes Check ✅ Passed All modifications are confined to the wiggle plotting function and its tests, with no unrelated files or logic altered outside the scope of adding 1D patch support.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix_462

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov
Copy link

codecov bot commented Oct 4, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.92%. Comparing base (f8d7949) to head (4f661d2).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #564   +/-   ##
=======================================
  Coverage   99.92%   99.92%           
=======================================
  Files         127      127           
  Lines       10622    10634   +12     
=======================================
+ Hits        10614    10626   +12     
  Misses          8        8           
Flag Coverage Δ
unittests 99.92% <100.00%> (+<0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed-hq
Copy link

codspeed-hq bot commented Oct 4, 2025

CodSpeed Performance Report

Merging #564 will not alter performance

Comparing fix_462 (4f661d2) with master (f8d7949)

Summary

✅ 50 untouched

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (1)
tests/test_viz/test_wiggle.py (1)

58-66: Good test coverage for 1D patch handling.

The test correctly verifies that wiggle works with 1D patches created via mean with dim_reduce="squeeze", matching the scenario described in issue #462. The assertions confirm the return type and dimension labeling.

Optionally, you could add an assertion to verify the y-axis label:

     ax = patch_1d.viz.wiggle()
     assert isinstance(ax, plt.Axes)
     # The remaining dimension should be on the x-axis
     assert patch_1d.dims[0].lower() in ax.get_xlabel().lower()
+    assert "amplitude" in ax.get_ylabel().lower()
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between f8d7949 and 4f661d2.

📒 Files selected for processing (2)
  • dascore/viz/wiggle.py (1 hunks)
  • tests/test_viz/test_wiggle.py (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
tests/test_viz/test_wiggle.py (5)
tests/test_viz/test_spectrogram.py (1)
  • test_1d_patch (75-79)
dascore/examples.py (1)
  • random_patch (29-111)
tests/conftest.py (1)
  • random_patch (282-284)
dascore/proc/aggregate.py (1)
  • mean (140-163)
dascore/viz/wiggle.py (1)
  • wiggle (54-135)
dascore/viz/wiggle.py (3)
dascore/core/coordmanager.py (2)
  • get_array (1072-1074)
  • get_coord (1039-1058)
dascore/proc/coords.py (2)
  • get_array (151-200)
  • get_coord (96-148)
dascore/utils/plotting.py (2)
  • _get_dim_label (14-19)
  • _format_time_axis (84-103)
🔇 Additional comments (2)
dascore/viz/wiggle.py (1)

97-110: LGTM! Clean implementation of 1D patch support.

The implementation correctly handles 1D patches by plotting the single dimension as the x-axis and data values as y-values with "amplitude" labeling. Time-axis formatting for datetime dimensions is properly applied, and the show parameter is respected. This addresses issue #462 as specified.

tests/test_viz/test_wiggle.py (1)

68-72: LGTM! Proper verification of the show parameter.

The test correctly verifies that wiggle(show=True) works with 1D patches by mocking plt.show.

@d-chambers d-chambers merged commit 8da0afb into master Oct 4, 2025
23 checks passed
@d-chambers d-chambers deleted the fix_462 branch November 20, 2025 18:18
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.

viz.wiggle with 1D patch

2 participants