diff --git a/jdaviz/configs/mosviz/plugins/viewers.py b/jdaviz/configs/mosviz/plugins/viewers.py index 29f3d78c50..1686848c95 100644 --- a/jdaviz/configs/mosviz/plugins/viewers.py +++ b/jdaviz/configs/mosviz/plugins/viewers.py @@ -203,11 +203,6 @@ def on_mouse_or_key_event(self, data): attribute = active_layer.attribute value = image.get_data(attribute)[int(round(y)), int(round(x))] unit = image.get_component(attribute).units - - # Works around https://github.com/spacetelescope/jdaviz/issues/1625 - if not unit: - unit = image.meta.get('BUNIT', '') - self.label_mouseover.value = f'{value:+10.5e} {unit}' else: self.label_mouseover.value = '' diff --git a/jdaviz/configs/specviz/plugins/viewers.py b/jdaviz/configs/specviz/plugins/viewers.py index fe4123a003..c3ea5ad570 100644 --- a/jdaviz/configs/specviz/plugins/viewers.py +++ b/jdaviz/configs/specviz/plugins/viewers.py @@ -491,12 +491,6 @@ def set_plot_axes(self): # flux_unit_type = data.flux.unit.physical_type.title() flux_unit_type = "Flux density" - # Works around https://github.com/spacetelescope/jdaviz/issues/1625 - flux_unit_str = data.flux.unit.to_string() - if ((not flux_unit_str) or - (self.jdaviz_app.config == 'specviz2d' and flux_unit_str == 'DN')): - flux_unit_str = data.meta.get('BUNIT', '') - if data.spectral_axis.unit.is_equivalent(u.m): spectral_axis_unit_type = "Wavelength" elif data.spectral_axis.unit.is_equivalent(u.pixel): @@ -504,7 +498,7 @@ def set_plot_axes(self): label_0 = f"{spectral_axis_unit_type} [{data.spectral_axis.unit.to_string()}]" self.figure.axes[0].label = label_0 - self.figure.axes[1].label = f"{flux_unit_type} [{flux_unit_str}]" + self.figure.axes[1].label = f"{flux_unit_type} [{data.flux.unit.to_string()}]" # Make it so y axis label is not covering tick numbers. self.figure.axes[1].label_offset = "-50" diff --git a/jdaviz/configs/specviz2d/plugins/parsers.py b/jdaviz/configs/specviz2d/plugins/parsers.py index bc6083e243..df99a7fcfc 100644 --- a/jdaviz/configs/specviz2d/plugins/parsers.py +++ b/jdaviz/configs/specviz2d/plugins/parsers.py @@ -52,7 +52,8 @@ def spec2d_1d_parser(app, data_obj, data_label=None, show_in_viewer=True): if "WAVEND" in header and "WAVSTART" in header: step = (header["WAVEND"] - header["WAVSTART"]) / flux.size - spectral_axis = (np.arange(header["WAVSTART"], header["WAVEND"], step) * u.m).to(u.micron) # noqa: E501 + spectral_axis = np.arange(header["WAVSTART"], header["WAVEND"], + step) * u.m else: # u.Unit("m") is used if WAVEND and WAVSTART are present so # we use it here as well, even though the actual unit is pixels diff --git a/jdaviz/configs/specviz2d/plugins/spectral_extraction/spectral_extraction.py b/jdaviz/configs/specviz2d/plugins/spectral_extraction/spectral_extraction.py index 06b2f235ce..0047363e30 100644 --- a/jdaviz/configs/specviz2d/plugins/spectral_extraction/spectral_extraction.py +++ b/jdaviz/configs/specviz2d/plugins/spectral_extraction/spectral_extraction.py @@ -644,7 +644,9 @@ def export_extract(self, **kwargs): self.update_marks(step='ext') trace = self._get_ext_trace() - inp_sp2d = self._get_ext_input_spectrum() + + # FIXME: Passing in Quantity turns MJy into MJy2. But not passing it in gives DN. + inp_sp2d = self._get_ext_input_spectrum().flux if self.ext_type_selected == 'Boxcar': ext = extract.BoxcarExtract(inp_sp2d.data, trace, width=self.ext_width) @@ -679,10 +681,6 @@ def export_extract_spectrum(self, add_data=False, **kwargs): # spectrum = Spectrum1D(spectral_axis=inp_sp2d.spectral_axis, flux=spectrum.flux) - # We preserve some original metadata, as needed. - for key in ('BUNIT', ): - spectrum.meta[key] = self.trace_dataset.selected_obj.meta[key] - if add_data: self.ext_add_results.add_results_from_plugin(spectrum, replace=False)