From c576b4d1f3469d1f867fbe64dc2f10bed44bfa37 Mon Sep 17 00:00:00 2001 From: Kyle Conroy Date: Mon, 16 May 2022 13:32:14 -0400 Subject: [PATCH] fix clearing the identified spectral line when deleted --- CHANGES.rst | 2 ++ jdaviz/configs/specviz/plugins/viewers.py | 7 ++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/CHANGES.rst b/CHANGES.rst index e416396840..4db97dc98d 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -64,6 +64,8 @@ Mosviz Specviz ^^^^^^^ +- Fixed clearing an identified spectral line when its removed. [#1322] + Specviz2d ^^^^^^^^^ diff --git a/jdaviz/configs/specviz/plugins/viewers.py b/jdaviz/configs/specviz/plugins/viewers.py index d94edcc3d6..cce5432e47 100644 --- a/jdaviz/configs/specviz/plugins/viewers.py +++ b/jdaviz/configs/specviz/plugins/viewers.py @@ -13,7 +13,7 @@ from astropy import units as u -from jdaviz.core.events import SpectralMarksChangedMessage +from jdaviz.core.events import SpectralMarksChangedMessage, LineIdentifyMessage from jdaviz.core.registries import viewer_registry from jdaviz.core.marks import SpectralLine, LineUncertainties, ScatterMask from jdaviz.core.linelists import load_preset_linelist, get_available_linelists @@ -206,6 +206,11 @@ def _broadcast_plotted_lines(self, marks=None): msg = SpectralMarksChangedMessage(marks, sender=self) self.session.hub.broadcast(msg) + if not np.any([mark.identify for mark in marks]): + # then clear the identified entry + msg = LineIdentifyMessage(name_rest='', sender=self) + self.session.hub.broadcast(msg) + def erase_spectral_lines(self, name=None, name_rest=None, show_none=True): """ Erase either all spectral lines, all spectral lines sharing the same