Skip to content

Commit

Permalink
Merge pull request #825 from javerbukh/fix_mosviz_bugs
Browse files Browse the repository at this point in the history
Mosviz hotfix
  • Loading branch information
rosteen authored Sep 1, 2021
2 parents 39fb4f1 + e2b36dd commit d0c2ce0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
14 changes: 8 additions & 6 deletions jdaviz/configs/mosviz/helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ def _zoom_to_slit_params(self, msg):
imview = self.app.get_viewer("image-viewer")
specview = self.app.get_viewer("spectrum-2d-viewer")

sky_region = jwst_header_to_skyregion(specview.layers[0].layer.meta)
try:
sky_region = jwst_header_to_skyregion(specview.layers[0].layer.meta)
except KeyError:
# If the header didn't have slit params, can't zoom to it.
return None, None
ra = sky_region.center.ra.deg
dec = sky_region.center.dec.deg

Expand Down Expand Up @@ -254,6 +258,9 @@ def load_data(self, spectra_1d=None, spectra_2d=None, images=None,
msg = SnackbarMessage(msg, color='warning', sender=self)
self.app.hub.broadcast(msg)

# Load the first object into the viewers automatically
self.app.get_viewer("table-viewer").figure_widget.highlighted = 0

def load_spectra(self, spectra_1d, spectra_2d):
"""
Load 1D and 2D spectra using lists or strings to represent each.
Expand Down Expand Up @@ -287,9 +294,6 @@ def load_spectra_from_directory(self, directory, instrument):
"""
self.load_data(directory=directory, instrument=instrument)

# Load the first object into the viewers automatically
self.app.get_viewer("table-viewer").figure_widget.highlighted = 0

def load_metadata(self, data_obj):
"""
Load and parse a set of FITS objects to extract any relevant metadata.
Expand Down Expand Up @@ -340,8 +344,6 @@ def load_2d_spectra(self, data_obj, data_labels=None):

def load_niriss_data(self, data_obj, data_labels=None):
super().load_data(data_obj, parser_reference="mosviz-niriss-parser")
# Load the first object into the viewers automatically
self.app.get_viewer("table-viewer").figure_widget.highlighted = 0

def load_images(self, data_obj, data_labels=None, share_image=0):
"""
Expand Down
2 changes: 1 addition & 1 deletion notebooks/MosvizNIRISSExample.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
"source": [
"mosviz.load_data(directory=data_dir, instrument=\"niriss\")"
]
},
}
],
"metadata": {
"kernelspec": {
Expand Down

0 comments on commit d0c2ce0

Please sign in to comment.