spacetelescope / specviz

An interactive astronomical 1D spectra analysis tool.
http://specviz.readthedocs.io
BSD 3-Clause "New" or "Revised" License
43 stars 31 forks source link

Model creation fails/crashes when no data is selected #662

Closed nluetzge closed 5 years ago

nluetzge commented 5 years ago

When no data is selected and I click on create new model I get a crash and this error message:

Traceback (most recent call last):
  File "/Users/nluetzge/JWST/Devtools/specviz/specviz/specviz/plugins/model_editor/model_editor.py", line 146, in _on_create_new_model
    new_spec = Spectrum1D(flux=np.zeros(self.hub.data_item.spectral_axis.size) * self.hub.data_item.flux.unit,
AttributeError: 'NoneType' object has no attribute 'spectral_axis'
Abort trap: 6

I think we should disable that "create new model" button when no data is selected.

nluetzge commented 5 years ago

Sorry nevermind, I just realized it was fixed in https://github.com/spacetelescope/specviz/pull/648. Closing this.