Skip to content

Commit

Permalink
Remove code for old specutils version
Browse files Browse the repository at this point in the history
  • Loading branch information
rosteen committed Aug 20, 2024
1 parent 5d07f1c commit 163d657
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 18 deletions.
7 changes: 1 addition & 6 deletions jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@

__all__ = ['MomentMap']

SPECUTILS_LT_1_15_1 = not minversion(specutils, "1.15.1.dev")

spaxel = u.def_unit('spaxel', 1 * u.Unit(""))
u.add_enabled_units([spaxel])

Expand Down Expand Up @@ -354,10 +352,7 @@ def calculate_moment(self, add_data=True):

# convert unit string to u.Unit so moment map data can be converted
flux_or_sb_display_unit = u.Unit(flux_sb_unit)
if SPECUTILS_LT_1_15_1:
moment_new_unit = flux_or_sb_display_unit
else:
moment_new_unit = flux_or_sb_display_unit * self.spectrum_viewer.state.x_display_unit # noqa: E501
moment_new_unit = flux_or_sb_display_unit * self.spectrum_viewer.state.x_display_unit # noqa: E501
self.moment = self.moment.to(moment_new_unit)

# Reattach the WCS so we can load the result
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
from glue.core.roi import XRangeROI
from numpy.testing import assert_allclose

from jdaviz.configs.cubeviz.plugins.moment_maps.moment_maps import SPECUTILS_LT_1_15_1


def test_user_api(cubeviz_helper, spectrum1d_cube):
with warnings.catch_warnings():
Expand Down Expand Up @@ -51,12 +49,8 @@ def test_user_api(cubeviz_helper, spectrum1d_cube):


def test_moment_calculation(cubeviz_helper, spectrum1d_cube, tmp_path):
if SPECUTILS_LT_1_15_1:
moment_unit = "Jy"
moment_value_str = "+8.00000e+00"
else:
moment_unit = "Jy m"
moment_value_str = "+6.40166e-10"
moment_unit = "Jy m"
moment_value_str = "+6.40166e-10"

dc = cubeviz_helper.app.data_collection
with warnings.catch_warnings():
Expand Down Expand Up @@ -296,10 +290,7 @@ def test_momentmap_nirspec_prism(cubeviz_helper, tmp_path):


def test_correct_output_flux_or_sb_units(cubeviz_helper, spectrum1d_cube_custom_fluxunit):
if SPECUTILS_LT_1_15_1:
moment_unit = "Jy / sr"
else:
moment_unit = "Jy m / sr"
moment_unit = "Jy m / sr"

# test that the output unit labels in the moment map plugin reflect any
# changes made in the unit conversion plugin.
Expand Down

0 comments on commit 163d657

Please sign in to comment.