Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: P. L. Lim <2090236+pllim@users.noreply.github.com>
  • Loading branch information
kecnry and pllim authored Apr 13, 2023
1 parent a41c92f commit d914fd8
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion jdaviz/configs/cubeviz/plugins/slice/slice.py
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ def _on_global_display_unit_changed(self, msg):
prev_unit = self.wavelength_unit
self.wavelength_unit = msg.unit.to_string()
# original unit during init can be blank or deg (before axis is set correctly)
if self._x_all is None or prev_unit in ['deg', '']:
if self._x_all is None or prev_unit in ('deg', ''):
return
self._update_data((self._x_all * u.Unit(prev_unit)).to(msg.unit, u.spectral()))

Expand Down
4 changes: 2 additions & 2 deletions jdaviz/configs/specviz/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,8 +135,8 @@ def get_spectral_regions(self, use_display_units=False):
Parameters
----------
use_display_units: bool, optional
Whether to convert to the display units defined in the <unit-conversion> plugin.
use_display_units : bool, optional
Whether to convert to the display units defined in the Unit Conversion plugin.
Returns
-------
Expand Down
6 changes: 3 additions & 3 deletions jdaviz/configs/specviz/plugins/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,8 +363,8 @@ def add_data(self, data, color=None, alpha=None, **layer_state):
if reset_plot_axes:
x_units = data.get_component(self.state.x_att.label).units
y_units = data.get_component("flux").units
self.state.x_display_unit = x_units if len(x_units) else None
self.state.y_display_unit = y_units if len(y_units) else None
self.state.x_display_unit = x_units if x_units else None
self.state.y_display_unit = y_units if y_units else None
self.set_plot_axes()

self._plot_uncertainties()
Expand Down Expand Up @@ -492,7 +492,7 @@ def set_plot_axes(self):
# Set axes labels for the spectrum viewer
flux_unit_type = "Flux density"
x_disp_unit = self.state.x_display_unit
x_unit = u.Unit(x_disp_unit) if x_disp_unit is not None else u.dimensionless_unscaled
x_unit = u.Unit(x_disp_unit) if x_disp_unit else u.dimensionless_unscaled
if x_unit.is_equivalent(u.m):
spectral_axis_unit_type = "Wavelength"
elif x_unit.is_equivalent(u.Hz):
Expand Down

0 comments on commit d914fd8

Please sign in to comment.