-
Notifications
You must be signed in to change notification settings - Fork 74
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
Imviz: Aperture photometry sum in scientific notation #2530
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
📢 Thoughts on this report? Let us know!. |
Thank you! Much appreciated |
1e8d618
to
42518cd
Compare
@@ -3134,16 +3134,20 @@ def float_precision(column, item): | |||
if column in ('slice', 'index'): | |||
# stored in astropy table as a float so we can also store nans, | |||
# but should display in the UI without any decimals | |||
return int(item) | |||
elif column in ('pixel'): | |||
return f"{item:0.03f}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@kecnry , I think "0.03f" can be shortened to "0.3f" but maybe I am missing some subtlety here?
|
||
if isinstance(item, SkyCoord): | ||
return item.to_string('hmsdms', precision=4) | ||
if isinstance(item, u.Quantity) and not np.isnan(item): | ||
return (float_precision(column, item.value) * item.unit).to_string() | ||
return f"{float_precision(column, item.value)} {item.unit.to_string()}" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was the problem: Any formatting from float_precision
was lost again because the return value was then converted back to Quantity via *
operator. It is unnecessary (and also has extra overhead).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to do the trick, thanks!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested it locally and it looks good to me! Thanks for your work!
42518cd
to
e8ff573
Compare
Rebased to resolve change log conflict. Thanks for the reviews! |
Description
This pull request is to show "sum" as scientific notation.
This already exists:
With this PR, this also matches:
Change log entry
CHANGES.rst
? If you want to avoid merge conflicts,list the proposed change log here for review and add to
CHANGES.rst
before merge. If no, maintainershould add a
no-changelog-entry-needed
label.Checklist for package maintainer(s)
This checklist is meant to remind the package maintainer(s) who will review this pull request of some common things to look for. This list is not exhaustive.
trivial
label.