Skip to content

Commit

Permalink
Fix unit conversion from flux to surface brightness
Browse files Browse the repository at this point in the history
  • Loading branch information
astrofrog authored and gibsongreen committed May 31, 2024
1 parent b3c3ae9 commit 836bce6
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions jdaviz/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,14 +120,14 @@ def to_unit(self, data, cid, values, original_units, target_units):
# target_units dictate the conversion to take place.

if (u.sr in u.Unit(original_units).bases) and \
(u.sr not in u.Unit(target_units).bases):
(u.sr not in u.Unit(target_units).bases):
# Surface Brightness -> Flux
eqv = [(u.MJy / u.sr,
u.MJy,
lambda x: (x * np.array(spec.meta['_pixel_scale_factor'])),
lambda x: x)]
elif (u.sr not in u.Unit(original_units).bases) and \
(u.sr in u.Unit(target_units).bases):
(u.sr in u.Unit(target_units).bases):
# Flux -> Surface Brightness
eqv = [(u.MJy,
u.MJy / u.sr,
Expand Down
2 changes: 1 addition & 1 deletion jdaviz/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ def test_to_unit(cubeviz_helper):
original_units = u.MJy / u.sr
target_units = u.MJy

value = uc.to_unit(cubeviz_helper, data, cid, values, original_units, target_units)
value = uc.to_unit(cubeviz_helper, data, cid, value, original_units, target_units)

# will be a uniform array since not wavelength dependent
# so test first value in array
Expand Down

0 comments on commit 836bce6

Please sign in to comment.