Skip to content

chore: RATIO IS IMPORTANT - #41

Merged
nabobalis merged 1 commit into
mainfrom
RATIO
Jul 29, 2026
Merged

nabobalis merged 1 commit into
mainfrom
RATIO

Conversation

@nabobalis

@nabobalis nabobalis commented Jul 29, 2026 •

Copy link
Copy Markdown
Member

Summary by Sourcery

Adjust lightcurve plot scaling and formatting to better match the legacy visuals and page layout.

Enhancements:

  • Limit AIA lightcurve y-axis ticks to min and max values and format labels with compact numeric notation for clearer per-channel ranges.
  • Update default timeseries figure aspect ratio to 4:5 to align with the legacy 1024x1280 layout while preserving width.

@sourcery-ai

sourcery-ai Bot commented Jul 29, 2026 •

Copy link
Copy Markdown
Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adjusts AIA lightcurve Y-axis tick strategy to show only min/max with formatted labels and updates default timeseries figure aspect ratio to 4:5 to match legacy layout.

File-Level Changes

Change Details Files
Simplified AIA lightcurve Y-axis ticks to min/max with custom numeric formatting.
  • Collects y-data from all plotted lines on the AIA lightcurve axis
  • Sets Y-axis ticks to the global min and max of the plotted data when available
  • Applies a FuncFormatter to render tick labels using a compact four-significant-figure format
src/suntoday/lightcurve.py
Updated timeseries figure dimensions to a 4:5 aspect ratio consistent with the legacy 1024x1280 plot.
  • Documents the rationale for the chosen aspect ratio in a code comment
  • Reduces the configured timeseries figure height from 2400 to 1500 pixels while keeping width at 1200 pixels
src/suntoday/config.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Hey - I've found 1 issue, and left some high level feedback:

  • When computing min/max for plotted, consider using NaN-safe operations (e.g., np.nanmin/np.nanmax) to avoid ending up with NaN ticks when any line contains NaNs.
  • If all plotted values are identical, min and max will be equal and produce a degenerate tick set; consider adding a small epsilon or falling back to the default locator in that case to avoid a flat axis.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- When computing `min`/`max` for `plotted`, consider using NaN-safe operations (e.g., `np.nanmin`/`np.nanmax`) to avoid ending up with `NaN` ticks when any line contains NaNs.
- If all plotted values are identical, `min` and `max` will be equal and produce a degenerate tick set; consider adding a small epsilon or falling back to the default locator in that case to avoid a flat axis.

## Individual Comments

### Comment 1
<location path="src/suntoday/lightcurve.py" line_range="113-116" />
<code_context>
         ax.set_ylabel(r"Data Mean (DN)", size=LABEL_FONTSIZE)
+    # The per-channel ranges are narrow, so a full tick ladder is noise;
+    # min/max-only ticks show the range directly (matching the legacy plot).
+    plotted = [line.get_ydata() for line in ax.lines if len(line.get_ydata())]
+    if plotted:
+        ax.set_yticks([min(data.min() for data in plotted), max(data.max() for data in plotted)])
+        ax.yaxis.set_major_formatter(ticker.FuncFormatter(lambda value, _pos: f"{value:.4g}"))


</code_context>
<issue_to_address>
**issue:** NaN values in line data will propagate into tick limits and formatter.

If any `line.get_ydata()` contains NaNs, `data.min()`/`data.max()` will evaluate to NaN and produce invalid y-axis ticks. Consider using `np.nanmin`/`np.nanmax` or filtering out NaNs before computing the tick limits so they stay valid with partially missing data.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +113 to +116
plotted = [line.get_ydata() for line in ax.lines if len(line.get_ydata())]
if plotted:
ax.set_yticks([min(data.min() for data in plotted), max(data.max() for data in plotted)])
ax.yaxis.set_major_formatter(ticker.FuncFormatter(lambda value, _pos: f"{value:.4g}"))

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

issue: NaN values in line data will propagate into tick limits and formatter.

If any line.get_ydata() contains NaNs, data.min()/data.max() will evaluate to NaN and produce invalid y-axis ticks. Consider using np.nanmin/np.nanmax or filtering out NaNs before computing the tick limits so they stay valid with partially missing data.

@nabobalis
nabobalis merged commit 78050ab into main Jul 29, 2026
5 of 6 checks passed
@nabobalis
nabobalis deleted the RATIO branch July 29, 2026 22: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.

1 participant