diff --git a/jdaviz/configs/default/plugins/model_fitting/model_fitting.py b/jdaviz/configs/default/plugins/model_fitting/model_fitting.py index d1cc35d5c8..3d97678d4e 100644 --- a/jdaviz/configs/default/plugins/model_fitting/model_fitting.py +++ b/jdaviz/configs/default/plugins/model_fitting/model_fitting.py @@ -982,7 +982,9 @@ def _fit_model_to_cube(self, add_data): sb_unit = self.app._get_display_unit('sb') if spec.flux.unit != sb_unit: - spec = spec.with_flux_unit(sb_unit) + # ensure specutils has access to jdaviz custom unit equivalencies + equivalencies = all_flux_unit_conversion_equivs() + spec = spec.with_flux_unit(sb_unit, equivalencies=equivalencies) snackbar_message = SnackbarMessage( "Fitting model to cube...", diff --git a/jdaviz/utils.py b/jdaviz/utils.py index 266edeab12..f4ce7b3bd5 100644 --- a/jdaviz/utils.py +++ b/jdaviz/utils.py @@ -505,6 +505,7 @@ def _indirect_conversion(values, orig_units, targ_units, eqv, elif image_data or (spec_unit and solid_angle_in_spec): if not solid_angle_in_targ: targ_units /= solid_angle_in_spec + solid_angle_in_targ = solid_angle_in_spec if ((u.Unit(targ_units) in indirect_units()) or (u.Unit(orig_units) in indirect_units())): # SB -> Flux -> Flux -> SB