Skip to content

Commit

Permalink
Revert "explicitly request as_unit=True/False"
Browse files Browse the repository at this point in the history
This reverts commit b1968b5.
  • Loading branch information
kecnry committed Jul 24, 2024
1 parent 86aa0c5 commit f8a3759
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion jdaviz/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -1048,7 +1048,7 @@ def _get_range_subset_bounds(self, subset_state,
raise ValueError("Unable to find spectral axis units")
if use_display_units:
# converting may result in flipping order (wavelength <-> frequency)
ret_units = self._get_display_unit('spectral', as_unit=False)
ret_units = self._get_display_unit('spectral')
subset_bounds = [(subset_state.lo * units).to(ret_units, u.spectral()),
(subset_state.hi * units).to(ret_units, u.spectral())]
spec_region = SpectralRegion(min(subset_bounds), max(subset_bounds))
Expand Down
3 changes: 1 addition & 2 deletions jdaviz/configs/cubeviz/plugins/moment_maps/moment_maps.py
Original file line number Diff line number Diff line change
Expand Up @@ -297,8 +297,7 @@ def calculate_moment(self, add_data=True):
# slice out desired region
# TODO: should we add a warning for a composite spectral subset?
spec_min, spec_max = self.spectral_subset.selected_min_max(cube)
display_spectral_axis_unit = self.app._get_display_unit(self.slice_display_unit_name,
as_unit=False)
display_spectral_axis_unit = self.app._get_display_unit(self.slice_display_unit_name)

# Convert units of min and max if necessary
if display_spectral_axis_unit and display_spectral_axis_unit != str(spec_min.unit):
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ def uncert_cube(self):

@property
def spectral_display_unit(self):
return self.app._get_display_unit(self.slice_display_unit_name, as_unit=True)
return astropy.units.Unit(self.app._get_display_unit(self.slice_display_unit_name))

@property
def mask_non_science(self):
Expand Down
4 changes: 2 additions & 2 deletions jdaviz/core/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -460,10 +460,10 @@ def show_in_new_tab(self, title=None): # pragma: no cover
def _handle_display_units(self, data, use_display_units=True):
if use_display_units:
if isinstance(data, Spectrum1D):
spectral_unit = self.app._get_display_unit('spectral', as_unit=True)
spectral_unit = self.app._get_display_unit('spectral')
if not spectral_unit:
return data
flux_unit = self.app._get_display_unit('flux', as_unit=True)
flux_unit = self.app._get_display_unit('flux')
# TODO: any other attributes (meta, wcs, etc)?
# TODO: implement uncertainty.to upstream
uncertainty = data.uncertainty
Expand Down

0 comments on commit f8a3759

Please sign in to comment.