Skip to content

Commit

Permalink
minor changes
Browse files Browse the repository at this point in the history
  • Loading branch information
nabobalis committed Feb 4, 2022
1 parent 97be71e commit 95b08fb
Show file tree
Hide file tree
Showing 9 changed files with 17 additions and 26 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -42,3 +42,4 @@ glue/qt/glue_qt_resources.py
.pytest_cache
.tox
.vscode
.history
4 changes: 1 addition & 3 deletions glue/core/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
12 changes: 12 additions & 0 deletions glue/utils/wcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion glue/viewers/common/qt/data_slice_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions glue/viewers/image/qt/data_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
4 changes: 0 additions & 4 deletions glue/viewers/image/qt/slice_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from glue.viewers.image.state import AggregateSlice
from glue.utils.decorators import avoid_circular


__all__ = ['MultiSliceWidgetHelper']


Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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:
Expand All @@ -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)
Expand Down
14 changes: 1 addition & 13 deletions glue/viewers/image/viewer.py
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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.
Expand Down
1 change: 0 additions & 1 deletion glue/viewers/profile/layer_artist.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 0 additions & 2 deletions glue/viewers/profile/qt/options_widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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()
Expand Down

0 comments on commit 95b08fb

Please sign in to comment.