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

Imviz: Aperture photometry sum in scientific notation #2530

Merged
merged 2 commits into from
Oct 27, 2023

Conversation

pllim
Copy link
Contributor

@pllim pllim commented Oct 24, 2023

Description

This pull request is to show "sum" as scientific notation.

This already exists:

Screenshot 2023-10-24 133213

With this PR, this also matches:

Screenshot 2023-10-24 133300

Change log entry

  • Is a change log needed? If yes, is it added to 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, maintainer
    should 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.

  • Are two approvals required? Branch protection rule does not check for the second approval. If a second approval is not necessary, please apply the trivial label.
  • Do the proposed changes actually accomplish desired goals? Also manually run the affected example notebooks, if necessary.
  • Do the proposed changes follow the STScI Style Guides?
  • Are tests added/updated as required? If so, do they follow the STScI Style Guides?
  • Are docs added/updated as required? If so, do they follow the STScI Style Guides?
  • Did the CI pass? If not, are the failures related?
  • Is a milestone set? Set this to bugfix milestone if this is a bug fix and needs to be released ASAP; otherwise, set this to the next major release milestone.
  • After merge, any internal documentations need updating (e.g., JIRA, Innerspace)? 🐱

@pllim pllim added this to the 3.8 milestone Oct 24, 2023
@github-actions github-actions bot added the imviz label Oct 24, 2023
@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Files Coverage Δ
...imviz/plugins/aper_phot_simple/aper_phot_simple.py 91.09% <100.00%> (+0.01%) ⬆️
jdaviz/core/template_mixin.py 91.44% <100.00%> (+0.02%) ⬆️

📢 Thoughts on this report? Let us know!.

@camipacifici
Copy link
Contributor

Thank you! Much appreciated

@@ -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}"
Copy link
Contributor Author

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()}"
Copy link
Contributor Author

@pllim pllim Oct 25, 2023

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).

@pllim pllim marked this pull request as ready for review October 25, 2023 03:27
Copy link
Member

@kecnry kecnry left a 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!

Copy link
Contributor

@haticekaratay haticekaratay left a 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!

@pllim
Copy link
Contributor Author

pllim commented Oct 27, 2023

Rebased to resolve change log conflict. Thanks for the reviews!

@pllim pllim merged commit 6e010c2 into spacetelescope:main Oct 27, 2023
15 checks passed
@pllim pllim deleted the sum-sci-notation branch October 27, 2023 15:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants