Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix formatting of unit after appending angle #3198

Closed
wants to merge 1 commit into from

Conversation

cshanahan1
Copy link
Contributor

This PR fixes a traceback when changing flux units via API. When changing between Jy and erg/c/cm2/A, the traceback said the unit was not in the list of available options for the y axis because the strings differed. This happens when handing contours. To reproduce:

from jdaviz.conftest import _create_spectrum1d_cube_with_fluxunit
from jdaviz import Cubeviz
import astropy.units as u
cube = _create_spectrum1d_cube_with_fluxunit(shape=(25, 25, 4), fluxunit=u.Jy / u.sr, with_uncerts=True)
cubeviz_helper = Cubeviz()
cubeviz_helper.load_data(cube, data_label="test")
uc = cubeviz_helper.plugins['Unit Conversion']._obj
uc.flux_unit.selected='erg / (Angstrom s cm2)'

In the unit conversion plugin, the '_append_angle_correctly' method to combine chosen flux and angle units sometimes produces unit strings that aren't in the required order for setting the spectral axis. These options are hard coded in UnitConverterWithSpectral (app.py). Additionally, this method was setting the sb_unit_selected read-only attribute twice in a row, so this redundancy was removed.

There is a remaining traceback coming from contours when changing flux unit, which is described in JDAT-4785.

@github-actions github-actions bot added specviz plugin Label for plugins common to multiple configurations labels Sep 17, 2024
@cshanahan1 cshanahan1 added this to the 4.0 milestone Sep 17, 2024
@cshanahan1 cshanahan1 added the no-changelog-entry-needed changelog bot directive label Sep 17, 2024
Copy link

codecov bot commented Sep 17, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 89.60%. Comparing base (d49e3b5) to head (e824d32).
Report is 3 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3198      +/-   ##
==========================================
+ Coverage   88.50%   89.60%   +1.09%     
==========================================
  Files         124      124              
  Lines       18448    20869    +2421     
==========================================
+ Hits        16327    18699    +2372     
- Misses       2121     2170      +49     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@pllim
Copy link
Contributor

pllim commented Sep 18, 2024

Maybe add your reproducing code to regression test suite?

Copy link
Member

@kecnry kecnry left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will also be fixed by #3192 (and if it doesn't, we might want to apply the fix on top of that since it will likely require a different solution)

@cshanahan1
Copy link
Contributor Author

closing this, it's fixed by 3192

@cshanahan1 cshanahan1 closed this Sep 18, 2024
@cshanahan1 cshanahan1 reopened this Sep 25, 2024
@cshanahan1 cshanahan1 closed this Sep 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-changelog-entry-needed changelog bot directive plugin Label for plugins common to multiple configurations specviz
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants