Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Gaussian smooth does not work in mosviz #1451

Closed
Jdaviz-Triage-Bot opened this issue Jul 5, 2022 · 5 comments · Fixed by #1452
Closed

Gaussian smooth does not work in mosviz #1451

Jdaviz-Triage-Bot opened this issue Jul 5, 2022 · 5 comments · Fixed by #1452
Labels
bug Something isn't working mosviz

Comments

@Jdaviz-Triage-Bot
Copy link

Jdaviz-Triage-Bot commented Jul 5, 2022

Reporter: Jesse Averbukh

Trying to run gaussian smooth in mosviz leads to a value error:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
File ~/opt/anaconda3/envs/jdaviz-dev-2.7/lib/python3.8/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 ~/Documents/jdaviz_dev/jdaviz/jdaviz/configs/default/plugins/gaussian_smooth/gaussian_smooth.py:78, in GaussianSmooth.vue_apply(self, event)
     76     self.apply_spatial_convolution()
     77 else:
---> 78     self.apply_spectral_smooth()

File ~/Documents/jdaviz_dev/jdaviz/jdaviz/configs/default/plugins/gaussian_smooth/gaussian_smooth.py:89, in GaussianSmooth.apply_spectral_smooth(self)
     80 def apply_spectral_smooth(self):
     81     # Testing inputs to make sure putting smoothed spectrum into
     82     # datacollection works
   (...)
     87     # Takes the user input from the dialog (stddev) and uses it to
     88     # define a standard deviation for gaussian smoothing
---> 89     cube = self.dataset.get_object(cls=Spectrum1D, statistic=None)
     90     spec_smoothed = gaussian_smooth(cube, stddev=self.stddev)
     92     # add data to the collection/viewer

File ~/Documents/jdaviz_dev/jdaviz/jdaviz/core/template_mixin.py:1048, in DatasetSelect.get_object(self, *args, **kwargs)
   1045 if self.selected not in self.labels:
   1046     # _apply_default_selection will override shortly anyways
   1047     return None
-> 1048 return self.selected_dc_item.get_object(*args, **kwargs)

File ~/opt/anaconda3/envs/jdaviz-dev-2.7/lib/python3.8/site-packages/glue/core/data.py:297, in BaseData.get_object(self, cls, **kwargs)
    292         raise ValueError('Specify the object class to use with cls= - supported '
    293                          'classes are:' + format_choices(data_translator.supported_classes))
    295 handler, _ = data_translator.get_handler_for(cls)
--> 297 return handler.to_object(self, **kwargs)

File ~/opt/anaconda3/envs/jdaviz-dev-2.7/lib/python3.8/site-packages/glue_astronomy/translators/spectrum1d.py:292, in Specutils1DHandler.to_object(self, data_or_subset, attribute, statistic)
    287     return data_kwargs
    289 data_kwargs = parse_attributes(
    290     [attribute] if not hasattr(attribute, '__len__') else attribute)
--> 292 return Spectrum1D(**data_kwargs, **kwargs)

File ~/opt/anaconda3/envs/jdaviz-dev-2.7/lib/python3.8/site-packages/specutils/spectra/spectrum1d.py:196, in Spectrum1D.__init__(self, flux, spectral_axis, wcs, velocity_convention, rest_value, redshift, radial_velocity, bin_specification, **kwargs)
    194         temp_axes.append(i)
    195 if len(temp_axes) != 1:
--> 196     raise ValueError("Input WCS must have exactly one axis with "
    197                      "spectral units, found {}".format(len(temp_axes)))
    199 # Due to FITS conventions, a WCS with spectral axis first corresponds
    200 # to a flux array with spectral axis last.
    201 if temp_axes[0] != 0:

ValueError: Input WCS must have exactly one axis with spectral units, found 0

DISCLAIMER: This issue was autocreated by the Jdaviz Issue Creation Bot on behalf of the reporter. If any information is incorrect, please contact Duy Nguyen

@javerbukh javerbukh added bug Something isn't working mosviz labels Jul 5, 2022
@pllim
Copy link
Contributor

pllim commented Jul 5, 2022

But there is no cube in Mosviz, right? You have a combo of 2D images, 2D spectra, 1D spectra, and a table.

@kecnry
Copy link
Member

kecnry commented Jul 5, 2022

What data were you using to reproduce this? I cannot reproduce this error with either default MOS data set, but am unable to overplot the smoothed spectrum and original spectrum (but can plot them separately).

We also might want to consider restricting the data dropdown in gaussian smooth to only 1d spectra for mosviz? Or do we need to support spatial smoothing for the image or spectral smoothing for the 2d spectra (these don't seem to currently raise errors, but also aren't added correctly to the viewers)?

@pllim
Copy link
Contributor

pllim commented Jul 5, 2022

I don't see why people want to smooth cutout images or 2D spectra. 🤷

@kecnry
Copy link
Member

kecnry commented Jul 5, 2022

See #1452 for restricting the data dropdown (I don't think it closes this issue though).

@javerbukh
Copy link
Contributor

I selected the image...I realize my mistake now. That PR should close this issue but there is a new issue for linking plugin data to mosviz...

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
bug Something isn't working mosviz
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants