diff --git a/CHANGES.rst b/CHANGES.rst index 1bb87ddd0c..004db01f16 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -43,6 +43,8 @@ Bug Fixes Cubeviz ^^^^^^^ +- Fixed copious warnings from spaxel tool when data has INF. [#3368] + Imviz ^^^^^ diff --git a/jdaviz/configs/cubeviz/plugins/parsers.py b/jdaviz/configs/cubeviz/plugins/parsers.py index 715df19f4d..017cde1264 100644 --- a/jdaviz/configs/cubeviz/plugins/parsers.py +++ b/jdaviz/configs/cubeviz/plugins/parsers.py @@ -456,6 +456,7 @@ def _parse_spectrum1d_3d(app, file_obj, data_label=None, flux = val << u.dimensionless_unscaled # DQ flags have no unit elif attr == "uncertainty": flux = val.represent_as(StdDevUncertainty).quantity + flux[np.isinf(flux)] = np.nan # Avoid INF from IVAR conversion else: flux = val diff --git a/jdaviz/configs/cubeviz/plugins/tools.py b/jdaviz/configs/cubeviz/plugins/tools.py index d49660ba9c..ec77106dda 100644 --- a/jdaviz/configs/cubeviz/plugins/tools.py +++ b/jdaviz/configs/cubeviz/plugins/tools.py @@ -172,5 +172,8 @@ def _mouse_move_worker(self, x, y): self.viewer.start_stream() self.viewer.update_sonified_cube(x, y) - self._profile_viewer.set_limits( - y_min=np.nanmin(y_values) * 0.8, y_max=np.nanmax(y_values) * 1.2) + # Data might have inf too. + new_ymin = np.nanmin(y_values) + new_ymax = np.nanmax(y_values) + if np.all(np.isfinite([new_ymin, new_ymax])): + self._profile_viewer.set_limits(y_min=new_ymin * 0.8, y_max=new_ymax * 1.2)