Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Additional fixes to trending.py #688

Merged
merged 10 commits into from
Aug 4, 2023

Conversation

Skyhawk172
Copy link
Collaborator

@Skyhawk172 Skyhawk172 commented Jul 7, 2023

There are multiple fixes folded into this PR, all related to our trending plots.

I noticed an issue in webbpsf.trending.wfe_histogram_plot when plotting arrows, where the original hardcoded offset does not scale properly when the ylimits change (say, when we change the start and end dates). See screenshot:

Screenshot 2023-07-07 at 4 39 29 PM

This PR addresses this issue for any ylimits, as demonstrated below. The correction arrows now go from the edge of the two connecting points, without overlapping with the points:

Screenshot 2023-07-07 at 4 41 21 PM

There are also a few additional fixes that I've stumbled upon over the last months.

@Skyhawk172 Skyhawk172 added the bug Something isn't working label Jul 7, 2023
@Skyhawk172 Skyhawk172 self-assigned this Jul 7, 2023
@Skyhawk172 Skyhawk172 requested a review from obi-wan76 July 7, 2023 20:53
@Skyhawk172 Skyhawk172 linked an issue Jul 21, 2023 that may be closed by this pull request
@codecov
Copy link

codecov bot commented Jul 21, 2023

Codecov Report

Patch coverage: 5.33% and project coverage change: -0.45% ⚠️

Comparison is base (2e17f9e) 55.20% compared to head (58db3c3) 54.75%.

Additional details and impacted files
@@             Coverage Diff             @@
##           develop     #688      +/-   ##
===========================================
- Coverage    55.20%   54.75%   -0.45%     
===========================================
  Files           16       16              
  Lines         6380     6436      +56     
===========================================
+ Hits          3522     3524       +2     
- Misses        2858     2912      +54     
Files Changed Coverage Δ
webbpsf/trending.py 4.51% <5.33%> (-0.07%) ⬇️

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

@Skyhawk172 Skyhawk172 linked an issue Jul 21, 2023 that may be closed by this pull request
@Skyhawk172
Copy link
Collaborator Author

Here's an example of what the PID argument allows:
image

@Skyhawk172
Copy link
Collaborator Author

Skyhawk172 commented Jul 25, 2023

Tests are failing because the last commit requires the import of astroquery

ImportError while loading conftest '/home/runner/work/webbpsf/webbpsf/webbpsf/conftest.py'.
webbpsf/__init__.py:96: in <module>
    from . import trending
webbpsf/trending.py:10: in <module>
    from astroquery.mast import Observations
E   ModuleNotFoundError: No module named 'astroquery'
ERROR: InvocationError for command /home/runner/work/webbpsf/webbpsf/.tox/py39-legacy-test/bin/pytest (exited with code 4)

@obi-wan76
Copy link
Collaborator

@Skyhawk172 as you work on this, can you also include #677 in this PR? We can iterate on what makes more sense in the trending figure.

@Skyhawk172
Copy link
Collaborator Author

Already done, along with #683.

Copy link
Collaborator

@BradleySappington BradleySappington left a comment

Choose a reason for hiding this comment

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

The code itself looks fine. I do see a lot of magic numbers in there without comments explaining why that specific number is chosen. You can also "duck type" the numbers as implied constants (all caps) and give them meaningful names to make the calculations more legible. Lots of these numbers happen with the offsets calculations, and set_ylim/get_ylim.

These changes aren't necessary, but make reviews easier and the code more legible/maintanable. I'll approve and leave it up to you if you'd like to change.

@BradleySappington
Copy link
Collaborator

Looks like #690 should fix these failing tests

@BradleySappington
Copy link
Collaborator

BradleySappington commented Aug 1, 2023

@Skyhawk172, would you please do another rebase to verify all tests pass? Need #704

@mperrin mperrin added this to the Release 1.2 milestone Aug 1, 2023
@Skyhawk172
Copy link
Collaborator Author

I merged the latest develop branch, including #704, and only the Sphinx doc build is reporting errors now.

@Skyhawk172 Skyhawk172 reopened this Aug 4, 2023
@Skyhawk172
Copy link
Collaborator Author

Skyhawk172 commented Aug 4, 2023

This PR was closed but not merged. I reopened it so I could merge the latest develop with #708, which should fix the Sphinx test. Then it'll be good to merge.

@BradleySappington BradleySappington merged commit 34ba8fc into spacetelescope:develop Aug 4, 2023
12 of 14 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add new PIDs from Cycle 2 into webbpsf sensing trending functions Trending EE plot normalization issue
4 participants