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

RAD-158: Changed image units. #389

Merged
merged 3 commits into from Mar 11, 2024

Conversation

PaulHuwe
Copy link
Collaborator

@PaulHuwe PaulHuwe commented Mar 5, 2024

Resolves RAD-158

Closes #388

This PR changes the units of the variables within the Image Model schema.

NOTE: no regression test link, because these changes require update to regression test files.

Checklist

@PaulHuwe PaulHuwe requested a review from a team as a code owner March 5, 2024 23:34
@PaulHuwe PaulHuwe requested a review from schlafly March 5, 2024 23:34
Copy link

codecov bot commented Mar 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.38%. Comparing base (0fb1239) to head (af2c433).
Report is 7 commits behind head on main.

❗ Current head af2c433 differs from pull request most recent head 1ad6dde. Consider uploading reports for the commit 1ad6dde to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #389   +/-   ##
=======================================
  Coverage   95.38%   95.38%           
=======================================
  Files           4        4           
  Lines         195      195           
=======================================
  Hits          186      186           
  Misses          9        9           

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

@PaulHuwe PaulHuwe changed the title Changed image units. RAD-158: Changed image units. Mar 6, 2024
CHANGES.rst Outdated
@@ -16,6 +16,8 @@

- Updated product table names. [#382]

- Changed image units. [#389]
Copy link
Collaborator

Choose a reason for hiding this comment

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

It may be good for the release notes to specify what the change it.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Updated.

@@ -26,9 +26,10 @@ properties:
tag: asdf://stsci.edu/datamodels/roman/tags/source_detection-1.0.0
required: [photometry, wcs]
data:
title: Science Data (electrons / s)
title: Science Data (DN / s) or (MJy / sr)
Copy link
Collaborator

@nden nden Mar 6, 2024

Choose a reason for hiding this comment

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

Is the conversion to MJy/sr applied in Level 2 or L3? If L2 (and I may be confused about this) then remove MJy/sr

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

L2, and the MJy/sr option was specifically requested in the ticket.

oneOf:
- tag: tag:stsci.edu:asdf/unit/unit-1.*
- tag: tag:astropy.org:astropy/units/unit-1.*
enum: ["DN / s", "MJy.sr**-1"]
Copy link
Collaborator

Choose a reason for hiding this comment

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

@braingram Can one of the tags be dropped here? I believe DN/s is a VO unit and supported by astropy.

Copy link
Contributor

Choose a reason for hiding this comment

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

Thanks for the ping!

The oneOf here is needed as asdf-astropy will select which tag to use based on the unit (and if it is or is not a VO unit). See the relevant converter code here.

Writing out a ImageModel with DN / s data produces the following and uses the astropy tag:

  data: !unit/quantity-1.1.0
    unit: !<tag:astropy.org:astropy/units/unit-1.0.0> DN / s
    value: !core/ndarray-1.0.0
      source: 9
      datatype: float32
      byteorder: little
      shape: [4088, 4088]

whereas using MJy.sr**-1 produces the following and uses the stsci tag:

  data: !unit/quantity-1.1.0
    unit: !unit/unit-1.0.0 MJy.sr**-1
    value: !core/ndarray-1.0.0
      source: 9
      datatype: float32
      byteorder: little
      shape: [4088, 4088]

Copy link
Collaborator

Choose a reason for hiding this comment

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

Huh! My bad! I checked DN/s but not MJy/sr as I thought that surely this is a VO unit. Apparently not!

Copy link
Collaborator

@schlafly schlafly 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!

@PaulHuwe PaulHuwe merged commit 8a8c722 into spacetelescope:main Mar 11, 2024
11 checks passed
@nden nden added this to the Build 14 milestone Mar 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Change Image Units
5 participants