Exemplo n.º 1
0
    def __init__(self, wwt_widget, viewer_state, layer_state=None, layer=None):

        super(WWTLayer, self).__init__(layer)

        self.layer = layer or layer_state.layer

        self._wwt_widget = wwt_widget
        self._viewer_state = viewer_state

        # Set up a state object for the layer artist
        self.state = layer_state or WWTLayerState(viewer_state=viewer_state,
                                                  layer=self.layer)
        if self.state not in self._viewer_state.layers:
            self._viewer_state.layers.append(self.state)

        self.layer_id = "{0:08x}".format(random.getrandbits(32))
        self.markers = self._wwt_widget.markers
        self.markers.allocate(self.layer_id)

        self.zorder = self.state.zorder
        self.visible = self.state.visible

        self._sync_zorder = keep_in_sync(self, 'zorder', self.state, 'zorder')
        self._sync_visible = keep_in_sync(self, 'visible', self.state,
                                          'visible')

        self.state.add_global_callback(self.update)

        self.update(force=True)
Exemplo n.º 2
0
 def _setup_syncing(self):
     for attribute in ['x_min', 'x_max', 'y_min', 'y_max']:
         sync1 = keep_in_sync(self.left_view._widget.state, attribute,
                              self.middle_view._widget.state, attribute)
         sync2 = keep_in_sync(self.middle_view._widget.state, attribute,
                              self.right_view._widget.state, attribute)
         self.sync[attribute] = sync1, sync2
     self._on_sync_click()
Exemplo n.º 3
0
 def _setup_syncing(self):
     for attribute in ['x_min', 'x_max', 'y_min', 'y_max']:
         # TODO: this will need to be generalized if we want to support an
         # arbitrary number of viewers.
         sync1 = keep_in_sync(self.split_views[0]._widget.state, attribute,
                              self.split_views[1]._widget.state, attribute)
         sync2 = keep_in_sync(self.split_views[1]._widget.state, attribute,
                              self.split_views[2]._widget.state, attribute)
         self.sync[attribute] = sync1, sync2
     self._on_sync_click()
Exemplo n.º 4
0
 def _setup_syncing(self):
     for attribute in ['x_min', 'x_max', 'y_min', 'y_max']:
         # TODO: this will need to be generalized if we want to support an
         # arbitrary number of viewers.
         sync1 = keep_in_sync(self.split_views[0]._widget.state, attribute,
                              self.split_views[1]._widget.state, attribute)
         sync2 = keep_in_sync(self.split_views[1]._widget.state, attribute,
                              self.split_views[2]._widget.state, attribute)
         self.sync[attribute] = sync1, sync2
     self._on_sync_click()
Exemplo n.º 5
0
    def __init__(self, viewer_state=None, **kwargs):

        super(MatplotlibLayerState, self).__init__(viewer_state=viewer_state, **kwargs)

        self.color = self.layer.style.color
        self.alpha = self.layer.style.alpha

        self._sync_color = keep_in_sync(self, 'color', self.layer.style, 'color')
        self._sync_alpha = keep_in_sync(self, 'alpha', self.layer.style, 'alpha')

        self.add_global_callback(self._notify_layer_update)
Exemplo n.º 6
0
    def __init__(self, viewer_state=None, **kwargs):

        super(MatplotlibLayerState, self).__init__(**kwargs)

        self.viewer_state = viewer_state

        self.color = self.layer.style.color
        self.alpha = self.layer.style.alpha

        self._sync_color = keep_in_sync(self, 'color', self.layer.style, 'color')
        self._sync_alpha = keep_in_sync(self, 'alpha', self.layer.style, 'alpha')
Exemplo n.º 7
0
    def __init__(self, viewer_state=None, **kwargs):

        super(MatplotlibLayerState, self).__init__(viewer_state=viewer_state, **kwargs)

        self.color = self.layer.style.color
        self.alpha = self.layer.style.alpha

        self._sync_color = keep_in_sync(self, 'color', self.layer.style, 'color')
        self._sync_alpha = keep_in_sync(self, 'alpha', self.layer.style, 'alpha')

        self.add_global_callback(self._notify_layer_update)
Exemplo n.º 8
0
    def _layer_changed(self):

        if self._sync_color is not None:
            self._sync_color.stop_syncing()

        if self._sync_alpha is not None:
            self._sync_alpha.stop_syncing()

        if self.layer is not None:

            self.color = self.layer.style.color
            self.alpha = self.layer.style.alpha

            self._sync_color = keep_in_sync(self, 'color', self.layer.style, 'color')
            self._sync_alpha = keep_in_sync(self, 'alpha', self.layer.style, 'alpha')
Exemplo n.º 9
0
    def _layer_changed(self):

        if self._sync_color is not None:
            self._sync_color.stop_syncing()

        if self._sync_alpha is not None:
            self._sync_alpha.stop_syncing()

        if self.layer is not None:

            self.color = self.layer.style.color
            self.alpha = self.layer.style.alpha

            self._sync_color = keep_in_sync(self, 'color', self.layer.style, 'color')
            self._sync_alpha = keep_in_sync(self, 'alpha', self.layer.style, 'alpha')
Exemplo n.º 10
0
    def __init__(self, viewer_state=None, **kwargs):

        super(SpecvizLayerState, self).__init__(viewer_state=viewer_state, **kwargs)

        self.color = self.layer.style.color
        self.alpha = self.layer.style.alpha

        self._sync_color = keep_in_sync(self, 'color', self.layer.style, 'color')
        self._sync_alpha = keep_in_sync(self, 'alpha', self.layer.style, 'alpha')

        self._att_helper = ComponentIDComboHelper(self, 'attribute')
        self.add_callback('layer', self._on_layer_change)
        self._on_layer_change()

        SpecvizLayerState.statistic.set_choices(self, list(FUNCTIONS))
        SpecvizLayerState.statistic.set_display_func(self, FUNCTIONS.get)
Exemplo n.º 11
0
    def __init__(self, viewer_state=None, **kwargs):

        super(SpecvizLayerState, self).__init__(viewer_state=viewer_state, **kwargs)

        self.color = self.layer.style.color
        self.alpha = self.layer.style.alpha

        self._sync_color = keep_in_sync(self, 'color', self.layer.style, 'color')
        self._sync_alpha = keep_in_sync(self, 'alpha', self.layer.style, 'alpha')

        self._att_helper = ComponentIDComboHelper(self, 'attribute')
        self.add_callback('layer', self._on_layer_change)
        self._on_layer_change()

        SpecvizLayerState.statistic.set_choices(self, list(FUNCTIONS))
        SpecvizLayerState.statistic.set_display_func(self, FUNCTIONS.get)
Exemplo n.º 12
0
    def __init__(self, layer=None, **kwargs):

        self._sync_markersize = None

        super(WWTLayerState, self).__init__(layer=layer)

        self._sync_color = keep_in_sync(self, 'color', self.layer.style, 'color')
        self._sync_alpha = keep_in_sync(self, 'alpha', self.layer.style, 'alpha')
        self._sync_size = keep_in_sync(self, 'size', self.layer.style, 'markersize')

        self.color = self.layer.style.color
        self.size = self.layer.style.markersize
        self.alpha = self.layer.style.alpha

        self.size_att_helper = ComponentIDComboHelper(self, 'size_att',
                                                      numeric=True,
                                                      categorical=False)
        self.cmap_att_helper = ComponentIDComboHelper(self, 'cmap_att',
                                                      numeric=True,
                                                      categorical=False)

        self.size_lim_helper = StateAttributeLimitsHelper(self, attribute='size_att',
                                                          lower='size_vmin', upper='size_vmax',
                                                          cache=self.size_limits_cache)

        self.cmap_lim_helper = StateAttributeLimitsHelper(self, attribute='cmap_att',
                                                          lower='cmap_vmin', upper='cmap_vmax',
                                                          cache=self.cmap_limits_cache)

        self.add_callback('layer', self._on_layer_change)
        if layer is not None:
            self._on_layer_change()

        self.cmap = colormaps.members[0][1]

        # Color and size encoding depending on attributes is only available
        # in PyWWT 0.6 or later.
        if PYWWT_LT_06:
            modes = ['Fixed']
        else:
            modes = ['Fixed', 'Linear']

        WWTLayerState.color_mode.set_choices(self, modes)
        WWTLayerState.size_mode.set_choices(self, modes)

        self.update_from_dict(kwargs)
Exemplo n.º 13
0
    def __init__(self, layer=None, **kwargs):
        super(WWTImageLayerState, self).__init__(layer=layer)

        self._sync_color = keep_in_sync(self, 'color', self.layer.style, 'color')
        self._sync_alpha = keep_in_sync(self, 'alpha', self.layer.style, 'alpha')

        self.color = self.layer.style.color

        self.img_data_att_helper = ComponentIDComboHelper(self, 'img_data_att',
                                                          numeric=True,
                                                          categorical=False)

        self.add_callback('layer', self._on_layer_change)
        if layer is not None:
            self._on_layer_change()

        self.update_from_dict(kwargs)
Exemplo n.º 14
0
    def __init__(self, viewer_state, layer_state=None, layer=None):

        super(LayerArtist, self).__init__(layer)

        self._viewer_state = viewer_state

        self.layer = layer or layer_state.layer
        self.state = layer_state or self._layer_state_cls(viewer_state=viewer_state,
                                                          layer=self.layer)

        if self.state not in self._viewer_state.layers:
            self._viewer_state.layers.append(self.state)

        self.zorder = self.state.zorder
        self.visible = self.state.visible

        self._sync_zorder = keep_in_sync(self, 'zorder', self.state, 'zorder')
        self._sync_visible = keep_in_sync(self, 'visible', self.state, 'visible')
Exemplo n.º 15
0
    def _layer_changed(self):

        super(WWTLayerState, self)._layer_changed()

        if self._sync_markersize is not None:
            self._sync_markersize.stop_syncing()

        if self.layer is not None:
            self.size = self.layer.style.markersize
            self._sync_markersize = keep_in_sync(self, 'size', self.layer.style, 'markersize')
Exemplo n.º 16
0
    def __init__(self, viewer_state, layer_state=None, layer=None):

        super(LayerArtist, self).__init__(layer)

        self._viewer_state = viewer_state

        self.layer = layer or layer_state.layer
        self.state = layer_state or self._layer_state_cls(
            viewer_state=viewer_state, layer=self.layer)

        if self.state not in self._viewer_state.layers:
            self._viewer_state.layers.append(self.state)

        self.zorder = self.state.zorder
        self.visible = self.state.visible

        self._sync_zorder = keep_in_sync(self, 'zorder', self.state, 'zorder')
        self._sync_visible = keep_in_sync(self, 'visible', self.state,
                                          'visible')
Exemplo n.º 17
0
    def __init__(self, viewer_state=None, **kwargs):

        super(WWTLayerState, self).__init__()

        self.viewer_state = viewer_state

        self.ra_att_helper = ComponentIDComboHelper(self,
                                                    'ra_att',
                                                    numeric=True,
                                                    categorical=False,
                                                    world_coord=True,
                                                    pixel_coord=False)
        self.dec_att_helper = ComponentIDComboHelper(self,
                                                     'dec_att',
                                                     numeric=True,
                                                     categorical=False,
                                                     world_coord=True,
                                                     pixel_coord=False)

        self.add_callback('layer', self._layer_changed)

        self.update_from_dict(kwargs)

        if isinstance(self.layer, Subset):
            for layer_state in self.viewer_state.layers:
                if self.layer.data is layer_state.layer:
                    self.viewer_state._sync_attributes_single(
                        layer_state, self)
                    break

        self.add_callback('ra_att', self._att_changed)
        self.add_callback('dec_att', self._att_changed)

        self.color = self.layer.style.color
        self.alpha = self.layer.style.alpha
        self.size = self.layer.style.markersize

        self._sync_color = keep_in_sync(self, 'color', self.layer.style,
                                        'color')
        self._sync_alpha = keep_in_sync(self, 'alpha', self.layer.style,
                                        'alpha')
        self._sync_size = keep_in_sync(self, 'size', self.layer.style,
                                       'markersize')
Exemplo n.º 18
0
    def __init__(self, layer=None, **kwargs):

        self._sync_markersize = None

        super(OpenSpaceLayerState, self).__init__(layer=layer)

        self._sync_color = keep_in_sync(self, 'color', self.layer.style,
                                        'color')
        self._sync_alpha = keep_in_sync(self, 'alpha', self.layer.style,
                                        'alpha')
        self._sync_size = keep_in_sync(self, 'size', self.layer.style,
                                       'markersize')

        self.color = self.layer.style.color
        self.size = self.layer.style.markersize
        self.alpha = self.layer.style.alpha

        # self.size_att_helper = ComponentIDComboHelper(self, 'size_att',
        #                                               numeric=True,
        #                                               categorical=False)
        # self.cmap_att_helper = ComponentIDComboHelper(self, 'cmap_att',
        #                                               numeric=True,
        #                                               categorical=False)

        # self.size_lim_helper = StateAttributeLimitsHelper(self, attribute='size_att',
        #                                                   lower='size_vmin', upper='size_vmax',
        #                                                   cache=self.size_limits_cache)

        # self.cmap_lim_helper = StateAttributeLimitsHelper(self, attribute='cmap_att',
        #                                                   lower='cmap_vmin', upper='cmap_vmax',
        #                                                   cache=self.cmap_limits_cache)

        # self.add_callback('layer', self._on_layer_change)
        # if layer is not None:
        #     self._on_layer_change()

        # self.cmap = colormaps.members[0][1]

        OpenSpaceLayerState.color_mode.set_choices(self, ['Fixed'])
        OpenSpaceLayerState.size_mode.set_choices(self, ['Fixed'])

        self.update_from_dict(kwargs)
Exemplo n.º 19
0
    def __init__(self, layer=None, **kwargs):

        self._sync_markersize = None

        super(OpenSpaceLayerState, self).__init__(layer=layer)

        self._sync_color = keep_in_sync(self, 'color', self.layer.style,
                                        'color')
        self._sync_alpha = keep_in_sync(self, 'alpha', self.layer.style,
                                        'alpha')
        self._sync_size = keep_in_sync(self, 'size', self.layer.style,
                                       'markersize')

        self.color = self.layer.style.color
        self.size = self.layer.style.markersize
        self.alpha = self.layer.style.alpha

        OpenSpaceLayerState.color_mode.set_choices(self, ['Fixed'])
        OpenSpaceLayerState.size_mode.set_choices(self, ['Fixed'])

        self.update_from_dict(kwargs)
Exemplo n.º 20
0
    def __init__(self, axes, viewer_state, layer_state=None, layer=None):

        super(MatplotlibLayerArtist, self).__init__(layer)

        # Keep a reference to the layer (data or subset) and axes
        self.axes = axes
        self._viewer_state = viewer_state

        # Set up a state object for the layer artist
        self.layer = layer or layer_state.layer
        self.state = layer_state or self._layer_state_cls(viewer_state=viewer_state,
                                                          layer=self.layer)
        if self.state not in self._viewer_state.layers:
            self._viewer_state.layers.append(self.state)

        self.mpl_artists = []

        self.zorder = self.state.zorder
        self.visible = self.state.visible

        self._sync_zorder = keep_in_sync(self, 'zorder', self.state, 'zorder')
        self._sync_visible = keep_in_sync(self, 'visible', self.state, 'visible')
Exemplo n.º 21
0
Arquivo: state.py Projeto: PennyQ/glue
    def __init__(self, viewer_state=None, layer=None, **kwargs):

        super(ScatterLayerState, self).__init__(viewer_state=viewer_state, layer=layer)

        self.limits_cache = {}

        self.cmap_lim_helper = StateAttributeLimitsHelper(self, attribute='cmap_att',
                                                          lower='cmap_vmin', upper='cmap_vmax',
                                                          limits_cache=self.limits_cache)

        self.size_lim_helper = StateAttributeLimitsHelper(self, attribute='size_att',
                                                          lower='size_vmin', upper='size_vmax',
                                                          limits_cache=self.limits_cache)

        self.cmap_att_helper = ComponentIDComboHelper(self, 'cmap_att',
                                                      numeric=True, categorical=False)

        self.size_att_helper = ComponentIDComboHelper(self, 'size_att',
                                                      numeric=True, categorical=False)

        self.xerr_att_helper = ComponentIDComboHelper(self, 'xerr_att',
                                                      numeric=True, categorical=False)

        self.yerr_att_helper = ComponentIDComboHelper(self, 'yerr_att',
                                                      numeric=True, categorical=False)

        ScatterLayerState.style.set_choices(self, ['Scatter', 'Line'])
        ScatterLayerState.cmap_mode.set_choices(self, ['Fixed', 'Linear'])
        ScatterLayerState.size_mode.set_choices(self, ['Fixed', 'Linear'])

        linestyle_display = {'solid': '–––––––',
                             'dashed': '– – – – –',
                             'dotted': '· · · · · · · ·',
                             'dashdot': '– · – · – ·'}

        ScatterLayerState.linestyle.set_choices(self, ['solid', 'dashed', 'dotted', 'dashdot'])
        ScatterLayerState.linestyle.set_display_func(self, linestyle_display.get)

        self.add_callback('layer', self._on_layer_change)
        if layer is not None:
            self._on_layer_change()

        self.cmap = colormaps.members[0][1]

        self.size = self.layer.style.markersize

        self._sync_size = keep_in_sync(self, 'size', self.layer.style, 'markersize')

        self.update_from_dict(kwargs)
Exemplo n.º 22
0
    def __init__(self, viewer_state=None, layer=None, **kwargs):

        super(ScatterLayerState, self).__init__(viewer_state=viewer_state,
                                                layer=layer)

        self.limits_cache = {}

        self.cmap_lim_helper = StateAttributeLimitsHelper(
            self,
            attribute='cmap_att',
            lower='cmap_vmin',
            upper='cmap_vmax',
            limits_cache=self.limits_cache)

        self.size_lim_helper = StateAttributeLimitsHelper(
            self,
            attribute='size_att',
            lower='size_vmin',
            upper='size_vmax',
            limits_cache=self.limits_cache)

        self.cmap_att_helper = ComponentIDComboHelper(self,
                                                      'cmap_att',
                                                      numeric=True,
                                                      categorical=False)

        self.size_att_helper = ComponentIDComboHelper(self,
                                                      'size_att',
                                                      numeric=True,
                                                      categorical=False)

        self.xerr_att_helper = ComponentIDComboHelper(self,
                                                      'xerr_att',
                                                      numeric=True,
                                                      categorical=False)

        self.yerr_att_helper = ComponentIDComboHelper(self,
                                                      'yerr_att',
                                                      numeric=True,
                                                      categorical=False)

        self.vx_att_helper = ComponentIDComboHelper(self,
                                                    'vx_att',
                                                    numeric=True,
                                                    categorical=False)

        self.vy_att_helper = ComponentIDComboHelper(self,
                                                    'vy_att',
                                                    numeric=True,
                                                    categorical=False)

        points_mode_display = {
            'auto': 'Density map or markers (auto)',
            'markers': 'Markers',
            'density': 'Density map'
        }

        ScatterLayerState.points_mode.set_choices(
            self, ['auto', 'markers', 'density'])
        ScatterLayerState.points_mode.set_display_func(self,
                                                       points_mode_display.get)

        self.add_callback('points_mode', self._update_density_map_mode)

        ScatterLayerState.cmap_mode.set_choices(self, ['Fixed', 'Linear'])
        ScatterLayerState.size_mode.set_choices(self, ['Fixed', 'Linear'])

        linestyle_display = {
            'solid': '–––––––',
            'dashed': '– – – – –',
            'dotted': '· · · · · · · ·',
            'dashdot': '– · – · – ·'
        }

        ScatterLayerState.linestyle.set_choices(
            self, ['solid', 'dashed', 'dotted', 'dashdot'])
        ScatterLayerState.linestyle.set_display_func(self,
                                                     linestyle_display.get)

        ScatterLayerState.vector_mode.set_choices(self, ['Cartesian', 'Polar'])

        vector_origin_display = {
            'tail': 'Tail of vector',
            'middle': 'Middle of vector',
            'tip': 'Tip of vector'
        }

        ScatterLayerState.vector_origin.set_choices(self,
                                                    ['tail', 'middle', 'tip'])
        ScatterLayerState.vector_origin.set_display_func(
            self, vector_origin_display.get)

        stretch_display = {
            'linear': 'Linear',
            'sqrt': 'Square Root',
            'arcsinh': 'Arcsinh',
            'log': 'Logarithmic'
        }

        ScatterLayerState.stretch.set_choices(
            self, ['linear', 'sqrt', 'arcsinh', 'log'])
        ScatterLayerState.stretch.set_display_func(self, stretch_display.get)

        self.add_callback('layer', self._on_layer_change)
        if layer is not None:
            self._on_layer_change()

        self.cmap = colormaps.members[0][1]

        self.size = self.layer.style.markersize

        self._sync_size = keep_in_sync(self, 'size', self.layer.style,
                                       'markersize')

        self.update_from_dict(kwargs)
Exemplo n.º 23
0
Arquivo: state.py Projeto: hamogu/glue
    def __init__(self, viewer_state=None, layer=None, **kwargs):

        super(ScatterLayerState, self).__init__(viewer_state=viewer_state,
                                                layer=layer)

        self.limits_cache = {}

        self.cmap_lim_helper = StateAttributeLimitsHelper(
            self,
            attribute='cmap_att',
            lower='cmap_vmin',
            upper='cmap_vmax',
            limits_cache=self.limits_cache)

        self.size_lim_helper = StateAttributeLimitsHelper(
            self,
            attribute='size_att',
            lower='size_vmin',
            upper='size_vmax',
            limits_cache=self.limits_cache)

        self.cmap_att_helper = ComponentIDComboHelper(self,
                                                      'cmap_att',
                                                      numeric=True,
                                                      categorical=False)

        self.size_att_helper = ComponentIDComboHelper(self,
                                                      'size_att',
                                                      numeric=True,
                                                      categorical=False)

        self.xerr_att_helper = ComponentIDComboHelper(self,
                                                      'xerr_att',
                                                      numeric=True,
                                                      categorical=False)

        self.yerr_att_helper = ComponentIDComboHelper(self,
                                                      'yerr_att',
                                                      numeric=True,
                                                      categorical=False)

        ScatterLayerState.style.set_choices(self, ['Scatter', 'Line'])
        ScatterLayerState.cmap_mode.set_choices(self, ['Fixed', 'Linear'])
        ScatterLayerState.size_mode.set_choices(self, ['Fixed', 'Linear'])

        linestyle_display = {
            'solid': '–––––––',
            'dashed': '– – – – –',
            'dotted': '· · · · · · · ·',
            'dashdot': '– · – · – ·'
        }

        ScatterLayerState.linestyle.set_choices(
            self, ['solid', 'dashed', 'dotted', 'dashdot'])
        ScatterLayerState.linestyle.set_display_func(self,
                                                     linestyle_display.get)

        self.add_callback('layer', self._on_layer_change)
        if layer is not None:
            self._on_layer_change()

        self.cmap = colormaps.members[0][1]

        self.size = self.layer.style.markersize

        self._sync_size = keep_in_sync(self, 'size', self.layer.style,
                                       'markersize')

        self.update_from_dict(kwargs)
Exemplo n.º 24
0
 def __init__(self, viewer_state=None, **kwargs):
     super(DendrogramLayerState, self).__init__(viewer_state=viewer_state, **kwargs)
     self.linewidth = self.layer.style.linewidth
     self._sync_linewidth = keep_in_sync(self, 'linewidth', self.layer.style, 'linewidth')
Exemplo n.º 25
0
 def __init__(self, viewer_state=None, **kwargs):
     super(DendrogramLayerState, self).__init__(viewer_state=viewer_state,
                                                **kwargs)
     self.linewidth = self.layer.style.linewidth
     self._sync_linewidth = keep_in_sync(self, 'linewidth',
                                         self.layer.style, 'linewidth')
Exemplo n.º 26
0
    def __init__(self, viewer_state=None, layer=None, **kwargs):

        super(ScatterLayerState, self).__init__(viewer_state=viewer_state, layer=layer)

        self.limits_cache = {}

        self.cmap_lim_helper = StateAttributeLimitsHelper(self, attribute='cmap_att',
                                                          lower='cmap_vmin', upper='cmap_vmax',
                                                          limits_cache=self.limits_cache)

        self.size_lim_helper = StateAttributeLimitsHelper(self, attribute='size_att',
                                                          lower='size_vmin', upper='size_vmax',
                                                          limits_cache=self.limits_cache)

        self.cmap_att_helper = ComponentIDComboHelper(self, 'cmap_att',
                                                      numeric=True, categorical=False)

        self.size_att_helper = ComponentIDComboHelper(self, 'size_att',
                                                      numeric=True, categorical=False)

        self.xerr_att_helper = ComponentIDComboHelper(self, 'xerr_att',
                                                      numeric=True, categorical=False)

        self.yerr_att_helper = ComponentIDComboHelper(self, 'yerr_att',
                                                      numeric=True, categorical=False)

        self.vx_att_helper = ComponentIDComboHelper(self, 'vx_att',
                                                    numeric=True, categorical=False)

        self.vy_att_helper = ComponentIDComboHelper(self, 'vy_att',
                                                    numeric=True, categorical=False)

        points_mode_display = {'auto': 'Density map or markers (auto)',
                               'markers': 'Markers',
                               'density': 'Density map'}

        ScatterLayerState.points_mode.set_choices(self, ['auto', 'markers', 'density'])
        ScatterLayerState.points_mode.set_display_func(self, points_mode_display.get)

        self.add_callback('points_mode', self._update_density_map_mode)

        ScatterLayerState.cmap_mode.set_choices(self, ['Fixed', 'Linear'])
        ScatterLayerState.size_mode.set_choices(self, ['Fixed', 'Linear'])

        linestyle_display = {'solid': '–––––––',
                             'dashed': '– – – – –',
                             'dotted': '· · · · · · · ·',
                             'dashdot': '– · – · – ·'}

        ScatterLayerState.linestyle.set_choices(self, ['solid', 'dashed', 'dotted', 'dashdot'])
        ScatterLayerState.linestyle.set_display_func(self, linestyle_display.get)

        ScatterLayerState.vector_mode.set_choices(self, ['Cartesian', 'Polar'])

        vector_origin_display = {'tail': 'Tail of vector',
                                 'middle': 'Middle of vector',
                                 'tip': 'Tip of vector'}

        ScatterLayerState.vector_origin.set_choices(self, ['tail', 'middle', 'tip'])
        ScatterLayerState.vector_origin.set_display_func(self, vector_origin_display.get)

        stretch_display = {'linear': 'Linear',
                           'sqrt': 'Square Root',
                           'arcsinh': 'Arcsinh',
                           'log': 'Logarithmic'}

        ScatterLayerState.stretch.set_choices(self, ['linear', 'sqrt', 'arcsinh', 'log'])
        ScatterLayerState.stretch.set_display_func(self, stretch_display.get)

        self.add_callback('layer', self._on_layer_change)
        if layer is not None:
            self._on_layer_change()

        self.cmap = colormaps.members[0][1]

        self.size = self.layer.style.markersize

        self._sync_size = keep_in_sync(self, 'size', self.layer.style, 'markersize')

        self.update_from_dict(kwargs)
Exemplo n.º 27
0
def link_x(view1, view2):
    sync_x0 = keep_in_sync(view1.state, 'x_min', view2.state, 'x_min')
    sync_x1 = keep_in_sync(view1.state, 'x_max', view2.state, 'x_max')
    return sync_x0, sync_x1
Exemplo n.º 28
0
def link_y_to_x(view1, view2):
    ync_yx0 = keep_in_sync(view1.state, 'y_min', view2.state, 'x_min')
    ync_yx1 = keep_in_sync(view1.state, 'y_max', view2.state, 'x_max')
    return sync_yx0, sync_yx1
Exemplo n.º 29
0
def link_x_to_y(view1, view2):
    sync_xy0 = keep_in_sync(view1.state, 'x_min', view2.state, 'y_min')
    sync_xy1 = keep_in_sync(view1.state, 'x_max', view2.state, 'y_max')
    return sync_xy0, sync_xy1