diff --git a/.gitignore b/.gitignore index a0e61c527..4b94e7cf4 100644 --- a/.gitignore +++ b/.gitignore @@ -42,3 +42,4 @@ glue/qt/glue_qt_resources.py .pytest_cache .tox .vscode +.history diff --git a/glue/core/data.py b/glue/core/data.py index 94fe4f48e..397066730 100644 --- a/glue/core/data.py +++ b/glue/core/data.py @@ -27,8 +27,7 @@ from glue.core.contracts import contract from glue.core.joins import get_mask_with_key_joins from glue.config import settings, data_translator, subset_state_translator -from glue.utils import (compute_statistic, - unbroadcast, iterate_chunks, +from glue.utils import (compute_statistic, unbroadcast, iterate_chunks, datetime64_to_mpl, broadcast_to, categorical_ndarray, format_choices, random_views_for_dask_array) from glue.core.coordinate_helpers import axis_label @@ -1687,7 +1686,6 @@ def compute_statistic(self, statistic, cid, subset_state=None, axis=None, values = self.compute_statistic(statistic, cid, subset_state=subset_state, axis=axis, finite=finite, positive=positive, percentile=percentile, view=chunk_view) - result[chunk_view[axis_index]] = values return result diff --git a/glue/utils/wcs.py b/glue/utils/wcs.py index 06345d1ea..9d402dd73 100644 --- a/glue/utils/wcs.py +++ b/glue/utils/wcs.py @@ -2,7 +2,19 @@ def get_identity_wcs(naxis): + """ + [summary] + Parameters + ---------- + naxis : [type] + [description] + + Returns + ------- + [type] + [description] + """ wcs = WCS(naxis=naxis) wcs.wcs.ctype = ['X'] * naxis wcs.wcs.crval = [0.] * naxis diff --git a/glue/viewers/common/qt/data_slice_widget.py b/glue/viewers/common/qt/data_slice_widget.py index 9fffd1a08..c0c2a23c7 100644 --- a/glue/viewers/common/qt/data_slice_widget.py +++ b/glue/viewers/common/qt/data_slice_widget.py @@ -109,7 +109,6 @@ def __init__(self, label='', world=None, lo=0, hi=10, def set_label_from_slider(self): value = self.state.slice_center - if self.state.use_world: value = self._world[value] if self._world_warning: diff --git a/glue/viewers/image/qt/data_viewer.py b/glue/viewers/image/qt/data_viewer.py index af8f798bc..69c5bfff4 100644 --- a/glue/viewers/image/qt/data_viewer.py +++ b/glue/viewers/image/qt/data_viewer.py @@ -39,8 +39,8 @@ class ImageViewer(MatplotlibImageMixin, MatplotlibDataViewer): tools = ['select:rectangle', 'select:xrange', 'select:yrange', 'select:circle', 'select:polygon', 'image:point_selection', - 'image:contrast_bias', - 'profile-viewer'] + 'image:contrast_bias', 'profile-viewer', + ] def __init__(self, session, parent=None, state=None): MatplotlibDataViewer.__init__(self, session, wcs=True, parent=parent, state=state) diff --git a/glue/viewers/image/qt/slice_widget.py b/glue/viewers/image/qt/slice_widget.py index 1e41c8ed1..0184b313b 100644 --- a/glue/viewers/image/qt/slice_widget.py +++ b/glue/viewers/image/qt/slice_widget.py @@ -6,7 +6,6 @@ from glue.viewers.image.state import AggregateSlice from glue.utils.decorators import avoid_circular - __all__ = ['MultiSliceWidgetHelper'] @@ -57,7 +56,6 @@ def sync_state_from_sliders(self, *args): else: slices.append(self.viewer_state.slices[i]) self.viewer_state.slices = tuple(slices) - self._reference_data = self.viewer_state.reference_data @avoid_circular @@ -96,7 +94,6 @@ def sync_sliders_from_state(self, *args): pixel_axis=world_axis_index, world_axis=world_axis_index) world_unit = self.data.coords.world_axis_units[world_axis_index] - world_warning = len(dependent_axes(self.data.coords, i)) > 1 world_label = self.data.world_component_ids[i].label else: @@ -110,7 +107,6 @@ def sync_sliders_from_state(self, *args): world_unit=world_unit, world_warning=world_warning) self.slider_state = slider.state - self.slider_state.add_callback('slice_center', self.sync_state_from_sliders) self._sliders.append(slider) self.layout.addWidget(slider) diff --git a/glue/viewers/image/viewer.py b/glue/viewers/image/viewer.py index 70e01ce97..1aa58e086 100644 --- a/glue/viewers/image/viewer.py +++ b/glue/viewers/image/viewer.py @@ -1,7 +1,5 @@ import os -from astropy.wcs import WCS - from glue.core.subset import roi_to_subset_state from glue.core.coordinates import Coordinates, LegacyCoordinates from glue.core.coordinate_helpers import dependent_axes @@ -12,21 +10,11 @@ from glue.viewers.image.frb_artist import imshow from glue.viewers.image.composite_array import CompositeArray +from glue.utils.wcs import get_identity_wcs __all__ = ['MatplotlibImageMixin'] -def get_identity_wcs(naxis): - - wcs = WCS(naxis=naxis) - wcs.wcs.ctype = ['X'] * naxis - wcs.wcs.crval = [0.] * naxis - wcs.wcs.crpix = [1.] * naxis - wcs.wcs.cdelt = [1.] * naxis - - return wcs - - EXTRA_FOOTER = """ # Set tick label size - for now tick_params (called lower down) doesn't work # properly, but these lines won't be needed in future. diff --git a/glue/viewers/profile/layer_artist.py b/glue/viewers/profile/layer_artist.py index 0a1164c83..2d6c5c752 100644 --- a/glue/viewers/profile/layer_artist.py +++ b/glue/viewers/profile/layer_artist.py @@ -45,7 +45,6 @@ def _calculate_profile_thread(self, reset=False): # otherwise the thread tries to send these to the glue logger (which # uses Qt), which then results in this kind of error: # QObject::connect: Cannot queue arguments of type 'QTextCursor' - with warnings.catch_warnings(): warnings.simplefilter("ignore") if reset: diff --git a/glue/viewers/profile/qt/options_widget.py b/glue/viewers/profile/qt/options_widget.py index 8bee8955c..0c750b2c6 100644 --- a/glue/viewers/profile/qt/options_widget.py +++ b/glue/viewers/profile/qt/options_widget.py @@ -41,7 +41,6 @@ def __init__(self, viewer_state, session, parent=None): self.viewer_state.add_callback('x_att', self._on_attribute_change) self.ui.text_warning.hide() - self.ui.axes_editor.button_apply_all.clicked.connect(self._apply_all_viewers) def _on_function_change(self, *args): @@ -52,7 +51,6 @@ def _on_function_change(self, *args): layout=self.ui.layout_slices) self.ui.text_warning.hide() self.ui.text_warning.setText('') - else: if self.profile_slice_helper: self.profile_slice_helper.remove()