Skip to content

Fixes time gap rendering in pcolormesh spectrogram plots#181

Open
MohamedAli1937 wants to merge 4 commits intosunpy:mainfrom
MohamedAli1937:fix-time-gaps
Open

Fixes time gap rendering in pcolormesh spectrogram plots#181
MohamedAli1937 wants to merge 4 commits intosunpy:mainfrom
MohamedAli1937:fix-time-gaps

Conversation

@MohamedAli1937
Copy link

@MohamedAli1937 MohamedAli1937 commented Mar 20, 2026

PR Description

Resolves the TODO in radiospectra/spectrogram/sources/eovsa.py that noted time gaps in spectrogram plots need to be rendered as actual gaps instead of being stretched across by pcolormesh.

fixes: #180

Solution:

  • Adds a _insert_time_gaps() helper to PcolormeshPlotMixin that detects gaps in the time axis and inserts NaN rows + midpoint timestamps so pcolormesh renders them as empty space.

Changes:

radiospectra/mixins.py:

  • Adds _insert_time_gaps(times, data, gap_threshold=None) static method.
  • Updates plot() with handle_gaps=True and gap_threshold=None parameters. The feature is enabled by default and backward compatible.

radiospectra/spectrogram/sources/eovsa.py:

  • Removes the outdated TODO comment.

radiospectra/tests/test_mixins.py (new):

  • Adds 5 unit tests covering no-gap, single-gap, multiple-gap, float-input, and manual-threshold cases.

AI Assistance Disclosure

AI tools were used for:

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding
  • No AI tools were used

Regardless of AI use, the human contributor remains fully responsible for correctness, design choices, licensing compatibility, and long-term maintainability.

Screenshots:

time_gap_bug_demo

SunPyBot and others added 4 commits March 18, 2026 21:08
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.

pcolormesh plots fill time gaps instead of showing them as empty

2 participants