Describe the bug
Found while developing #1656. When I load a line list when there's no data in the viz tool, it results in the following traceback:
---------------------------------------------------------------------------
IndexError Traceback (most recent call last)
File E:\STScI\gitRepos\jdaviz\envmain\lib\site-packages\ipyvue\VueTemplateWidget.py:60, in Events._handle_event(self, _, content, buffers)
58 getattr(self, "vue_" + event)(data, buffers)
59 else:
---> 60 getattr(self, "vue_" + event)(data)
File E:\STScI\gitRepos\jdaviz\jdaviz\configs\default\plugins\line_lists\line_lists.py:573, in LineListTool.vue_load_list(self, event)
570 self.loaded_lists = []
571 self.loaded_lists = loaded_lists
--> 573 self._viewer.plot_spectral_lines()
574 self.update_line_mark_dict()
576 msg_text = ("Spectral lines loaded from preset. Lines can be shown/hidden"
577 f" in the {self.list_to_load} dropdown in the Line Lists plugin")
File E:\STScI\gitRepos\jdaviz\jdaviz\configs\specviz\plugins\viewers.py:298, in SpecvizProfileView.plot_spectral_lines(self, colors, **kwargs)
295 colors = colors*len(self.spectral_lines)
297 lines = self.spectral_lines
--> 298 plot_units = self.data()[0].spectral_axis.unit
300 marks = []
301 for line, color in zip(lines, colors):
IndexError: list index out of range
Looks like it's trying to look up the units, of which there naturally isn't any because there isn't any data.
To Reproduce
Steps to reproduce the behavior:
Load Specviz
Open Line list plugin
Load a preset line
Traceback appears
Expected behavior
I figure we should probably intercept this beforehand (not allow a user to load line lists unless there's data) or allow the list to be loaded, but the lines not plotted.
Screenshots
Desktop (please complete the following information):
OS: Windows 10
Browser: Chromium: 105.0.5195.127
Package versions (please complete the following information):
Describe the bug Found while developing #1656. When I load a line list when there's no data in the viz tool, it results in the following traceback:
Looks like it's trying to look up the units, of which there naturally isn't any because there isn't any data.
To Reproduce Steps to reproduce the behavior:
Expected behavior I figure we should probably intercept this beforehand (not allow a user to load line lists unless there's data) or allow the list to be loaded, but the lines not plotted.
Screenshots
Desktop (please complete the following information):
Package versions (please complete the following information):
Package Versions
anyio==3.6.1 argon2-cffi==21.3.0 argon2-cffi-bindings==21.2.0 asdf==2.13.0 asdf-astropy==0.2.2 asdf-coordinates-schemas==0.1.0 asdf-standard==1.0.3 asdf-transform-schemas==0.3.0 asdf-wcs-schemas==0.1.1 asteval==0.9.27 astropy==5.1 astroquery==0.4.6 asttokens==2.0.8 attrs==22.1.0 Babel==2.10.3 backcall==0.2.0 beautifulsoup4==4.11.1 bleach==5.0.1 bqplot==0.12.36 bqplot-image-gl==1.4.11 casa-formats-io==0.1 certifi==2022.6.15 cffi==1.15.1 charset-normalizer==2.1.1 cloudpickle==2.1.0 colorama==0.4.5 coverage==6.4.4 cycler==0.11.0 dask==2022.8.1 debugpy==1.6.3 decorator==5.1.1 defusedxml==0.7.1 dill==0.3.5.1 distlib==0.3.6 echo==0.6 entrypoints==0.4 et-xmlfile==1.1.0 exceptiongroup==1.0.0rc9 executing==1.0.0 fast-histogram==0.11 fastjsonschema==2.16.1 filelock==3.8.0 fonttools==4.37.1 freetype-py==2.3.0 fsspec==2022.8.2 glue-astronomy==0.5.0 glue-core==1.5.0 glue-jupyter==0.13.0 glue-vispy-viewers==1.0.5 gwcs==0.18.1 h5py==3.7.0 hsluv==5.0.3 html5lib==1.1 hypothesis==6.54.4 idna==3.3 imageio==2.21.2 iniconfig==1.1.1 ipydatawidgets==4.3.2 ipygoldenlayout==0.4.0 ipykernel==6.15.2 ipympl==0.9.2 ipypopout==1.0.0 ipysplitpanes==0.2.0 ipython==8.4.0 ipython-genutils==0.2.0 ipyvolume==0.6.0a10 ipyvue==1.7.0 ipyvuetify==1.8.4 ipywebrtc==0.6.0 ipywidgets==7.7.2 jaraco.classes==3.2.2 -e git+https://github.com/duytnguyendtn/jdaviz.git@864f7003277576fb44524602de38c78ef4aeddde#egg=jdaviz jedi==0.18.1 Jinja2==3.1.2 jmespath==1.0.1 joblib==1.1.0 json5==0.9.10 jsonschema==4.9.1 jupyter-core==4.11.1 jupyter-server==1.18.1 jupyter_client==7.3.5 jupyterlab==3.4.5 jupyterlab-pygments==0.2.2 jupyterlab-widgets==1.1.1 jupyterlab_server==2.15.1 keyring==23.9.0 kiwisolver==1.4.4 locket==1.0.0 lxml==4.9.1 MarkupSafe==2.1.1 matplotlib==3.5.3 matplotlib-inline==0.1.6 mistune==0.8.4 more-itertools==8.14.0 mpl-scatter-density==0.7 nbclassic==0.4.3 nbclient==0.5.13 nbconvert==6.5.3 nbformat==5.4.0 ndcube==2.0.2 nest-asyncio==1.5.5 networkx==2.8.6 notebook==6.4.12 notebook-shim==0.1.0 numpy==1.23.2 openpyxl==3.0.10 packaging==21.3 pandas==1.4.4 pandocfilters==1.5.0 parso==0.8.3 partd==1.3.0 photutils==1.5.0 pickleshare==0.7.5 Pillow==9.2.0 platformdirs==2.5.2 pluggy==1.0.0 prometheus-client==0.14.1 prompt-toolkit==3.0.31 psutil==5.9.1 pure-eval==0.2.2 pvextractor==0.3 py==1.11.0 pycparser==2.21 pyerfa==2.0.0.1 Pygments==2.13.0 PyOpenGL==3.1.6 pyparsing==3.0.9 pyrsistent==0.18.1 pytest==7.1.3 pytest-arraydiff==0.5.0 pytest-astropy==0.10.0 pytest-astropy-header==0.2.1 pytest-cov==3.0.0 pytest-doctestplus==0.12.0 pytest-filter-subpackage==0.1.1 pytest-mock==3.8.2 pytest-openfiles==0.5.0 pytest-remotedata==0.3.3 python-dateutil==2.8.2 pythreejs==2.4.1 pytz==2022.2.1 pyvo==1.3 PyWavelets==1.3.0 pywin32==304 pywin32-ctypes==0.2.0 pywinpty==2.0.7 PyYAML==6.0 pyzmq==23.2.1 qtconsole==5.3.2 QtPy==2.2.0 radio-beam==0.3.3 regions==0.6 requests==2.28.1 scikit-image==0.19.3 scipy==1.9.1 semantic-version==2.10.0 Send2Trash==1.8.0 sidecar==0.5.1 six==1.16.0 sniffio==1.3.0 sortedcontainers==2.4.0 soupsieve==2.3.2.post1 specreduce==1.1.0 spectral-cube==0.6.0 specutils==1.8.0 stack-data==0.5.0 synphot==1.1.1 terminado==0.15.0 tifffile==2022.8.12 tinycss2==1.1.1 toml==0.10.2 tomli==2.0.1 toolz==0.12.0 tornado==6.2 tox==3.25.1 traitlets==5.3.0 traittypes==0.2.1 urllib3==1.26.12 virtualenv==20.16.4 vispy==0.11.0 voila==0.3.6 wcwidth==0.2.5 webencodings==0.5.1 websocket-client==1.4.0 websockets==10.3 widgetsnbextension==3.6.1 xlrd==2.0.1