Conversation
Reviewer's guide (collapsed on small PRs)Reviewer's GuideAdjusts 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
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
There was a problem hiding this comment.
Hey - I've found 1 issue, and left some high level feedback:
- When computing
min/maxforplotted, consider using NaN-safe operations (e.g.,np.nanmin/np.nanmax) to avoid ending up withNaNticks when any line contains NaNs. - If all plotted values are identical,
minandmaxwill 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>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}")) |
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary by Sourcery
Adjust lightcurve plot scaling and formatting to better match the legacy visuals and page layout.
Enhancements: