diff --git a/jdaviz/configs/default/plugins/model_fitting/tests/test_blackbody.py b/jdaviz/configs/default/plugins/model_fitting/tests/test_blackbody.py index bacc6eb4fc..27f8a7432e 100644 --- a/jdaviz/configs/default/plugins/model_fitting/tests/test_blackbody.py +++ b/jdaviz/configs/default/plugins/model_fitting/tests/test_blackbody.py @@ -1,4 +1,5 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst +# copied and modified from astropy: https://github.com/astropy/astropy/pull/12304 """Tests for physical functions.""" # pylint: disable=no-member, invalid-name import pytest diff --git a/jdaviz/models/physical_models.py b/jdaviz/models/physical_models.py index 37e33574cb..de4dd78843 100644 --- a/jdaviz/models/physical_models.py +++ b/jdaviz/models/physical_models.py @@ -1,4 +1,5 @@ # Licensed under a 3-clause BSD style license - see LICENSE.rst +# copied and modified from astropy: https://github.com/astropy/astropy/pull/12304 """ Models that have physical origins. """ @@ -269,7 +270,11 @@ def output_units(self, unit): # let's provide some convenience for passing these as strings unit = self._native_output_units.get(unit) else: - unit = u.Unit(unit) + try: + unit = u.Unit(unit) + except ValueError: + # then the string wasn't a valid unit, we'll allow the error below to be raised + pass if unit is None: pass