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

Ensure the unit is kept in np.median even if the result is a scalar nan #14635

Merged
merged 2 commits into from Apr 17, 2023

Conversation

mhvk
Copy link
Contributor

@mhvk mhvk commented Apr 17, 2023

#14634 reminded me that really #12165 should be fixed in units, not worked around in stats.

Fixes #12165 and close #14634

@mhvk mhvk added units Bug 💤 backport-v5.0.x on-merge: backport to v5.0.x 💤 backport-v5.2.x on-merge: backport to v5.2.x labels Apr 17, 2023
@mhvk mhvk added this to the v5.0.7 milestone Apr 17, 2023
@mhvk mhvk requested a review from larrybradley as a code owner April 17, 2023 16:03
@github-actions github-actions bot added the stats label Apr 17, 2023
@github-actions
Copy link

Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.

  • Do the proposed changes actually accomplish desired goals?
  • Do the proposed changes follow the Astropy coding guidelines?
  • Are tests added/updated as required? If so, do they follow the Astropy testing guidelines?
  • Are docs added/updated as required? If so, do they follow the Astropy documentation guidelines?
  • Is rebase and/or squash necessary? If so, please provide the author with appropriate instructions. Also see "When to rebase and squash commits".
  • Did the CI pass? If no, are the failures related? If you need to run daily and weekly cron jobs as part of the PR, please apply the "Extra CI" label. Codestyle issues can be fixed by the bot.
  • Is a change log needed? If yes, did the change log check pass? If no, add the "no-changelog-entry-needed" label. If this is a manual backport, use the "skip-changelog-checks" label unless special changelog handling is necessary.
  • Is this a big PR that makes a "What's new?" entry worthwhile and if so, is (1) a "what's new" entry included in this PR and (2) the "whatsnew-needed" label applied?
  • Is a milestone set? Milestone must be set but we cannot check for it on Actions; do not let the green checkmark fool you.
  • At the time of adding the milestone, if the milestone set requires a backport to release branch(es), apply the appropriate "backport-X.Y.x" label(s) before merge.

@mhvk mhvk force-pushed the quantity-median-numpy-lt-1-22-nan-output branch 2 times, most recently from 0944d2c to 5ac9758 Compare April 17, 2023 16:08
@pllim
Copy link
Member

pllim commented Apr 17, 2023

xref #12146 (comment)

Copy link
Member

@pllim pllim left a comment

Choose a reason for hiding this comment

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

Nice clean-up. Thanks!

@mhvk mhvk force-pushed the quantity-median-numpy-lt-1-22-nan-output branch from 5ac9758 to 512ed21 Compare April 17, 2023 16:33
Copy link
Member

@larrybradley larrybradley left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@larrybradley
Copy link
Member

larrybradley commented Apr 17, 2023

There's a new CI failure in the oldest deps and 32-bit tests that might be real.

@mhvk
Copy link
Contributor Author

mhvk commented Apr 17, 2023

Hmm, yes, definitely looks real. I got frustrated that tox -e test-oldestdeps just gave an installation error and ended up just pushing things up... I'll investigate...

@pllim
Copy link
Member

pllim commented Apr 17, 2023

We are going to bump some oldest deps but only for v5.3. So if you end up having to do that, then we cannot backport this. 🤷

@pllim
Copy link
Member

pllim commented Apr 17, 2023

TypeError: unsupported operand type(s) for /: 'function' and 'int'

Same error in 32-bit job, that also uses old deps but not oldest.

@mhvk mhvk force-pushed the quantity-median-numpy-lt-1-22-nan-output branch 2 times, most recently from 1c60e16 to 3df34b2 Compare April 17, 2023 17:49
@mhvk mhvk force-pushed the quantity-median-numpy-lt-1-22-nan-output branch from 3df34b2 to 9748f58 Compare April 17, 2023 18:08
@mhvk
Copy link
Contributor Author

mhvk commented Apr 17, 2023

Gosh, that took a bit longer than I had hoped - it seems I'm getting rusty. Anyway, all tests pass now, so will merge. Thanks for the quick reviews!!

@mhvk mhvk merged commit 39f05f8 into astropy:main Apr 17, 2023
24 of 25 checks passed
@mhvk mhvk deleted the quantity-median-numpy-lt-1-22-nan-output branch April 17, 2023 18:41
@lumberbot-app

This comment was marked as resolved.

meeseeksmachine pushed a commit to meeseeksmachine/astropy that referenced this pull request Apr 17, 2023
mhvk added a commit to mhvk/astropy that referenced this pull request Apr 17, 2023
…ven if the result is a scalar ``nan``
pllim added a commit that referenced this pull request Apr 17, 2023
Backport PR #14635: Ensure the unit is kept in ``np.median`` even if  the result is a scalar ``nan`` (v5.0.x)
pllim added a commit that referenced this pull request Apr 17, 2023
…635-on-v5.2.x

Backport PR #14635 on branch v5.2.x (Ensure the unit is kept in ``np.median`` even if the result is a scalar ``nan``)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug stats units 💤 backport-v5.0.x on-merge: backport to v5.0.x 💤 backport-v5.2.x on-merge: backport to v5.2.x
Projects
None yet
Development

Successfully merging this pull request may close these issues.

np.median drops units if the result is nan
3 participants