From ad97141919fa32063f4145d365cf8bc13ecc7fc5 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Tue, 23 Nov 2021 16:31:15 -0500 Subject: [PATCH] add dev note and fix output_unit exception --- .../default/plugins/model_fitting/tests/test_blackbody.py | 1 + jdaviz/models/physical_models.py | 7 ++++++- 2 files changed, 7 insertions(+), 1 deletion(-) 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