Skip to content

Commit

Permalink
test adjusts made post rebasing multiple PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
gibsongreen committed May 31, 2024
1 parent e89989d commit 3aa49fb
Showing 1 changed file with 4 additions and 19 deletions.
23 changes: 4 additions & 19 deletions jdaviz/tests/test_app.py
Original file line number Diff line number Diff line change
Expand Up @@ -228,33 +228,18 @@ def test_to_unit(cubeviz_helper):
original_units = u.MJy / u.sr
target_units = u.MJy

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

# will be a uniform array since not wavelength dependent
# so test first value in array
assert np.allclose(value[0], 4.800000041882413e-08)

# Change from Fnu to Flam (with values shape matching spectral axis)

values = np.ones(3001)
original_units = u.MJy
target_units = u.erg / u.cm**2 / u.s / u.AA

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

assert np.allclose(new_values,
(values * original_units)
.to_value(target_units,
equivalencies=u.spectral_density(cube.spectral_axis)))

# Change from Fnu to Flam (with a shape (2,) array of values indicating we
# are probably converting the limits)
# Flux to surface brightness

values = [1, 2]
original_units = u.MJy
target_units = u.erg / u.cm**2 / u.s / u.AA
target_units = u.MJy / u.sr

new_values = 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)

assert np.allclose(value, 1)

Expand Down

0 comments on commit 3aa49fb

Please sign in to comment.