Skip to content

Commit

Permalink
code style
Browse files Browse the repository at this point in the history
  • Loading branch information
cshanahan1 committed Sep 6, 2024
1 parent cd688bb commit 8ead071
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def test_markers_cubeviz(tmp_path, cubeviz_helper, spectrum1d_cube):
{'event': 'mousemove',
'domain': {'x': 4.623e-7, 'y': 0}})

assert label_mouseover.as_text() == (f'Cursor 4.62300e-07, 0.00000e+00 Value +8.00000e+00 {sb_unit}',
assert label_mouseover.as_text() == (f'Cursor 4.62300e-07, 0.00000e+00 Value +8.00000e+00 {sb_unit}', # noqa
'Wave 4.62280e-07 m (0 pix)',
f'Flux 2.80000e+01 {flux_unit}')
assert label_mouseover.as_dict() == {'data_label': 'Spectrum (sum)',
Expand All @@ -103,7 +103,7 @@ def test_markers_cubeviz(tmp_path, cubeviz_helper, spectrum1d_cube):
{'event': 'mousemove',
'domain': {'x': 4.623e-7, 'y': 0}})

assert label_mouseover.as_text() == (f'Cursor 4.62300e-07, 0.00000e+00 Value +8.00000e+00 {sb_unit}',
assert label_mouseover.as_text() == (f'Cursor 4.62300e-07, 0.00000e+00 Value +8.00000e+00 {sb_unit}', # noqa
'', '')
assert label_mouseover.as_dict() == {'axes_x': 4.623e-07,
'axes_x:unit': 'm',
Expand Down
7 changes: 4 additions & 3 deletions jdaviz/configs/default/plugins/viewers.py
Original file line number Diff line number Diff line change
Expand Up @@ -772,9 +772,10 @@ def set_plot_axes(self):
locally_defined_sb_units = [un / solid_angle_unit for un in locally_defined_flux_units]

# create an equivalency for each flux unit for flux <> flux/pix2.
# for similar reasons to the 'untranslatable units' issue, custom equivalencies can't be combined,
# so a workaround is creating an equivalency for each flux that may need an additional equiv.
angle_to_pixel_equivs = [_eqv_sb_per_pixel_to_per_angle(un) for un in locally_defined_flux_units]
# for similar reasons to the 'untranslatable units' issue, custom
# equivs. can't be combined, so a workaround is creating an eqiv
# for each flux that may need an additional equiv.
angle_to_pixel_equivs = [_eqv_sb_per_pixel_to_per_angle(un) for un in locally_defined_flux_units] # noqa

if any([y_unit.is_equivalent(unit, angle_to_pixel_equivs[i]) for i, unit in enumerate(locally_defined_sb_units)]): # noqa
flux_unit_type = "Surface Brightness"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -343,15 +343,13 @@ def _translate(self, flux_or_sb=None):

# Surface Brightness -> Flux
if spec_axis_ang_unit and flux_or_sb == 'Flux':
print(f'translating SB to flux. spec_units = {spec_units}, angle={selected_display_solid_angle_unit}')
spec_units *= selected_display_solid_angle_unit
print('new spec_units = ', spec_units)
# update display units
self.spectrum_viewer.state.y_display_unit = str(spec_units)

# Flux -> Surface Brightness
elif (not spec_axis_ang_unit and flux_or_sb == 'Surface Brightness'):
print(f'translating flux to sb. spec_units = {spec_units}, angle={selected_display_solid_angle_unit}')
spec_units /= selected_display_solid_angle_unit
print('new spec_units = ', spec_units)
# update display units
Expand Down

0 comments on commit 8ead071

Please sign in to comment.