def gs9(data, vmin, vmax, percentile, stretch, cmap): load_plugins() if cmap is not None: for cmap_name, cmap_obj in colormaps.members: if cmap == cmap_name: cmap = cmap_obj break else: colormaps.add(cmap, cm.get_cmap(cmap)) cmap = cm.get_cmap(cmap) ga = GlueApplication() image = ga.new_data_viewer(ImageViewer) datasets = [] for filename in data: datasets.append(load_data(filename)) # Add datasets all in one go to do all linking in one pass ga.add_datasets(datasets) for d in ga.data_collection: image.add_data(d) for layer_state in image.state.layers: if vmin is not None: layer_state.v_min = vmin if vmax is not None: layer_state.v_min = vmax if percentile is not None: choices = ImageLayerState.percentile.get_choices(layer_state) for choice in choices: if percentile == choice: percentile = choice break layer_state.percentile = percentile if stretch is not None: layer_state.stretch = stretch if cmap is not None: layer_state.cmap = cmap image.viewer_size = (600, 600) ga.gather_current_tab() ga.start(maximized=False, size=(1024, 768))
def setup(): ImageViewer.tools.append('solar:pixel_extraction') ImageViewer.tools.append('timestamp_button') for name, ctable in sorted(cmlist.items()): colormaps.add(ctable.name, ctable)
# from glue.viewers.common.qt.tool import CheckableTool # from glue.viewers.common.qt.tool import Tool # OD registry for all of my functions gfncs = OD([]) # plot viewer sizes big = (900, 650) small = (600, 400) # Colormaps # options: https://matplotlib.org/examples/color/colormaps_reference.html from glue.config import colormaps from matplotlib.cm import Paired colormaps.add('Paired', Paired) from matplotlib.cm import Dark2 colormaps.add('Dark2', Dark2) from matplotlib.cm import nipy_spectral colormaps.add('nipy', nipy_spectral) from matplotlib.cm import tab20 colormaps.add('nipy', tab20) # link functions # @link_function(info="Link 'star_index' to 'other'", output_labels=['other']) # def sidx_to_other2(sidx): # other = np.asarray([i[-1] for i in sidx]) # return other