Ejemplo n.º 1
0
    def __init__(self, parent=None, viewer_state=None):

        super(AladinLiteOptionsPanel, self).__init__(parent=parent)

        self._data_collection = self.parent()._data

        self.viewer_state = viewer_state

        self.ui = load_ui('options_widget.ui',
                          self,
                          directory=os.path.dirname(__file__))

        autoconnect_callbacks_to_qt(self.viewer_state, self.ui)

        self._ra_att_helpers = ComponentIDComboHelper(self.ui.combodata_ra_att,
                                                      self._data_collection,
                                                      categorical=False,
                                                      default_index=0)

        self._dec_att_helpers = ComponentIDComboHelper(
            self.ui.combodata_dec_att,
            self._data_collection,
            categorical=False,
            default_index=1)

        self.viewer_state.add_callback('layers', nonpartial(self._update_data))
Ejemplo n.º 2
0
    def __init__(self, viewer_state, session, parent=None):

        super(ScatterOptionsWidget, self).__init__(parent=parent)

        self.ui = load_ui('options_widget.ui', self,
                          directory=os.path.dirname(__file__))

        self.viewer_state = viewer_state
        autoconnect_qt(self.viewer_state, self)

        self.viewer_state.connect('layers', self._update_combo_data)

        self.xatt_helper = ComponentIDComboHelper(self.ui.combo_xatt,
                                                  session.data_collection)
        self.yatt_helper = ComponentIDComboHelper(self.ui.combo_yatt,
                                                  session.data_collection)
Ejemplo n.º 3
0
    def setup_method(self, method):

        self.attribute_combo = QtGui.QComboBox()
        self.lower_value = QtGui.QLineEdit()
        self.upper_value = QtGui.QLineEdit()
        self.mode_combo = QtGui.QComboBox()
        self.flip_button = QtGui.QToolButton()

        self.log_button = QtGui.QToolButton()
        self.log_button.setCheckable(True)

        self.data = Data(x=np.linspace(-100, 100, 10000),
                         y=np.linspace(2, 3, 10000),
                         label='test_data')

        self.data_collection = DataCollection([self.data])

        self.helper = AttributeLimitsHelper(self.attribute_combo,
                                            self.lower_value,
                                            self.upper_value,
                                            mode_combo=self.mode_combo,
                                            flip_button=self.flip_button,
                                            log_button=self.log_button)

        self.component_helper = ComponentIDComboHelper(self.attribute_combo,
                                                       self.data_collection)

        self.component_helper.append(self.data)

        self.x_id = self.data.visible_components[0]
        self.y_id = self.data.visible_components[1]
Ejemplo n.º 4
0
    def _setup_combos(self):
        layers = [
            'Digitized Sky Survey (Color)',
            'VLSS: VLA Low-frequency Sky Survey (Radio)',
            'WMAP ILC 5-Year Cosmic Microwave Background',
            'SFD Dust Map (Infrared)', 'WISE All Sky (Infrared)',
            'GLIMPSE/MIPSGAL', 'Hydrogen Alpha Full Sky Map'
        ]
        labels = ['DSS', 'VLSS', 'WMAP', 'SFD', 'WISE', 'GLIMPSE', 'H Alpha']
        thumbnails = [
            'DSS', 'VLA', 'wmap5yr_ilc_200uk', 'dust', 'glimpsemipsgaltn',
            'halpha'
        ]
        base = ('http://www.worldwidetelescope.org/wwtweb/'
                'thumbnail.aspx?name=%s')

        for i, row in enumerate(zip(layers, labels, thumbnails)):
            layer, text, thumb = row
            url = base % thumb
            data = urlopen(url).read()
            pm = QtGui.QPixmap()
            pm.loadFromData(data)
            icon = QtGui.QIcon(pm)

            self.ui.combo_foreground.addItem(icon, text, layer)
            self.ui.combo_foreground.setItemData(i, layer, role=Qt.ToolTipRole)
            self.ui.combo_background.addItem(icon, text, layer)
            self.ui.combo_background.setItemData(i, layer, role=Qt.ToolTipRole)

        self.ui.combo_foreground.setIconSize(QtCore.QSize(60, 60))
        self.ui.combo_background.setIconSize(QtCore.QSize(60, 60))

        self.ra_att_helper = ComponentIDComboHelper(self.ui.combo_ra_att,
                                                    self.viewer._data,
                                                    categorical=False,
                                                    numeric=True)

        self.dec_att_helper = ComponentIDComboHelper(self.ui.combo_dec_att,
                                                     self.viewer._data,
                                                     categorical=False,
                                                     numeric=True)
Ejemplo n.º 5
0
    def __init__(self, parent=None, data_viewer=None):

        super(OptionsWidget, self).__init__(parent=parent)

        self.ui = load_ui('viewer_options.ui',
                          self,
                          directory=os.path.dirname(__file__))

        self.file_helper = ComponentIDComboHelper(self.ui.combo_file_attribute,
                                                  data_viewer._data)

        self._data_viewer = data_viewer

        self._data = None
Ejemplo n.º 6
0
    def __init__(self, viewer_state, session, parent=None):

        super(HistogramOptionsWidget, self).__init__(parent=parent)

        self.ui = load_ui('options_widget.ui',
                          self,
                          directory=os.path.dirname(__file__))

        autoconnect_callbacks_to_qt(viewer_state, self.ui)

        viewer_state.add_callback('layers', self._update_combo_data)

        self.x_att_helper = ComponentIDComboHelper(self.ui.combodata_x_att,
                                                   session.data_collection)

        self.viewer_state = viewer_state

        viewer_state.add_callback('x_att', nonpartial(self._update_attribute))
Ejemplo n.º 7
0
    def __init__(self, layer, parent=None):

        super(ImageLayerStyleEditor, self).__init__(parent=parent)

        self.ui = load_ui('layer_style_editor.ui', self,
                          directory=os.path.dirname(__file__))

        connect_kwargs = {'alpha': dict(value_range=(0, 1)),
                          'contrast': dict(value_range=(0.1, 10), log=True),
                          'bias': dict(value_range=(1.5, -0.5))}

        percentiles = [('Min/Max', 100),
                       ('99.5%', 99.5),
                       ('99%', 99),
                       ('95%', 95),
                       ('90%', 90),
                       ('Custom', 'Custom')]

        update_combobox(self.ui.combodata_percentile, percentiles)

        stretches = [('Linear', 'linear'),
                     ('Square Root', 'sqrt'),
                     ('Arcsinh', 'arcsinh'),
                     ('Logarithmic', 'log')]

        update_combobox(self.ui.combodata_stretch, stretches)

        self.attribute_helper = ComponentIDComboHelper(self.ui.combodata_attribute,
                                                       layer.data_collection)

        self.attribute_helper.append_data(layer.layer)

        autoconnect_callbacks_to_qt(layer.state, self.ui, connect_kwargs)

        layer._viewer_state.add_callback('color_mode', self._update_color_mode)

        self._update_color_mode(layer._viewer_state.color_mode)

        self.ui.bool_global_sync.setToolTip('Whether to sync the color and transparency with other viewers')