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

Fix gaussian smooth bug #441

Merged
merged 2 commits into from
Feb 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,16 @@ def vue_spectral_smooth(self, *args, **kwargs):
# define a standard deviation for gaussian smoothing
spec_smoothed = gaussian_smooth(spec, stddev=size)

label = f"Smoothed {self._selected_data.label}"
label = f"Smoothed {self._selected_data.label} stddev {size}"

if label in self.data_collection:
snackbar_message = SnackbarMessage(
"Data with selected stddev already exists, canceling operation.",
color="error",
sender=self)
self.hub.broadcast(snackbar_message)

return

self.data_collection[label] = spec_smoothed

Expand Down Expand Up @@ -112,7 +121,16 @@ def vue_spatial_convolution(self, *args):
mask=cube.mask, meta=cube.meta,
fill_value=cube.fill_value)

label = f"Smoothed {self._selected_data.label}"
label = f"Smoothed {self._selected_data.label} spatial stddev {size}"

if label in self.data_collection:
snackbar_message = SnackbarMessage(
"Data with selected stddev already exists, canceling operation.",
color="error",
sender=self)
self.hub.broadcast(snackbar_message)

return

self.data_collection[label] = newcube

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ def test_linking_after_spectral_smooth(spectral_cube_wcs):
gs.vue_spectral_smooth()

assert len(dc) == 2
assert dc[1].label == 'Smoothed test'
assert dc[1].label == 'Smoothed test stddev 3.2'
assert len(dc.external_links) == 1

assert dc.external_links[0].cids1[0] is dc[0].world_component_ids[0]
Expand All @@ -39,5 +39,5 @@ def test_spatial_convolution(spectral_cube_wcs):
gs.vue_spatial_convolution()

assert len(dc) == 2
assert dc[1].label == "Smoothed test"
assert dc["Smoothed test"].get_object(cls=SpectralCube).shape == (3, 4, 5)
assert dc[1].label == "Smoothed test spatial stddev 3.0"
assert dc["Smoothed test spatial stddev 3.0"].get_object(cls=SpectralCube).shape == (3, 4, 5)