Esempio n. 1
0
def make_1D_control_box(title):
    """
    init docstring

    Parameters
    ----------
    name : str
        Name of the control widget
    """
    self = None
    ctl_box = ControlContainer(title)

    ctl_box.create_pairspinner('x_shift', init_min=0,
                               init_max=100, init_step=.1)
    ctl_box.create_pairspinner('y_shift', init_min=0,
                               init_max=100, init_step=.1)

    # declare a checkbox to turn on/off auto-scaling functionality
    autoscale_box = QtGui.QCheckBox(parent=self)
    ctl_box._add_widget('auto_scale', autoscale_box)

    ctl_box.create_combobox('cmap_combo', key_list=datad.keys())

    # declare button to clear data from plot
    _btn_dataclear = QtGui.QPushButton("clear data", parent=self)
    ctl_box._add_widget('clear', _btn_dataclear)
    # padding to make it look nice
    ctl_box.addStretch()

    return ctl_box
Esempio n. 2
0
def make_1D_control_box(title):
    """
    init docstring

    Parameters
    ----------
    name : str
        Name of the control widget
    """
    self = None
    ctl_box = ControlContainer(title)

    ctl_box.create_pairspinner('x_shift',
                               init_min=0,
                               init_max=100,
                               init_step=.1)
    ctl_box.create_pairspinner('y_shift',
                               init_min=0,
                               init_max=100,
                               init_step=.1)

    # declare a checkbox to turn on/off auto-scaling functionality
    autoscale_box = QtGui.QCheckBox(parent=self)
    ctl_box._add_widget('auto_scale', autoscale_box)

    ctl_box.create_combobox('cmap_combo', key_list=datad.keys())

    # declare button to clear data from plot
    _btn_dataclear = QtGui.QPushButton("clear data", parent=self)
    ctl_box._add_widget('clear', _btn_dataclear)
    # padding to make it look nice
    ctl_box.addStretch()

    return ctl_box
Esempio n. 3
0
# Authors: Frederic Petit <*****@*****.**>,
#          Gael Varoquaux <*****@*****.**>
# Copyright (c) 2007-2020, Enthought, Inc.
# License: BSD Style.

import os
import numpy as np

from matplotlib.cm import datad, get_cmap
from matplotlib._cm_listed import cmaps
from mayavi.core import lut as destination_module
from apptools.persistence import state_pickler
target_dir = os.path.dirname(destination_module.__file__)

values = np.linspace(0., 1., 256)

lut_dic = {}

# Some of the cmaps are listed in cm.datad, and others in _cm_listed.cmaps
cmap_names = datad.keys()
cmap_names.extend(cmaps.keys())

for name in cmap_names:
    if name.endswith('_r'):
        continue
    lut_dic[name] = get_cmap(name)(values.copy())

out_name = os.path.join(target_dir, 'pylab_luts.pkl')
state_pickler.dump(lut_dic, out_name)

Esempio n. 4
0
#    @QtCore.Slot(object, tuple)
    def sl_update_limit_func(self, limit_func, new_limits):
        """
        Updates the type of limit computation function used
        """
        self._xsection.set_limit_func(limit_func, new_limits)

    @QtCore.Slot(tuple)
    def sl_update_color_limits(self, new_limits):
        """
        Update the values passed to the limit computation function
        """
        self._xsection.update_color_limits(new_limits)


_CMAPS = datad.keys()
_CMAPS.sort()


class StackScannerWidget(QtGui.QWidget):
    """
    This object contains the CrossSectionViewer (2D Image Display) and 
    finish the doc string...
    """
    # set up the signals
    sig_update_cmap = QtCore.Signal(str)
    sig_update_image = QtCore.Signal(np.ndarray)
    sig_update_norm = QtCore.Signal(matplotlib.colors.Normalize)
    sig_update_limit_function = QtCore.Signal(object, tuple)
    sig_update_color_limits = QtCore.Signal(tuple)
Esempio n. 5
0
# Authors: Frederic Petit <*****@*****.**>,
#          Gael Varoquaux <*****@*****.**>
# Copyright (c) 2007-2009, Enthought, Inc.
# License: BSD Style.

import os
import numpy as np

from matplotlib.cm import datad, get_cmap
from matplotlib._cm_listed import cmaps
from mayavi.core import lut as destination_module
from apptools.persistence import state_pickler
target_dir = os.path.dirname(destination_module.__file__)

values = np.linspace(0., 1., 256)

lut_dic = {}

# Some of the cmaps are listed in cm.datad, and others in _cm_listed.cmaps
cmap_names = datad.keys()
cmap_names.extend(cmaps.keys())

for name in cmap_names:
    if name.endswith('_r'):
        continue
    lut_dic[name] = get_cmap(name)(values.copy())

out_name = os.path.join(target_dir, 'pylab_luts.pkl')
state_pickler.dump(lut_dic, out_name)

Esempio n. 6
0
                      Typed, Dict)
import numpy as np
import sys
from bubblegum.backend.mpl.cross_section_2d import (CrossSection,
                                                    fullrange_limit_factory,
                                                    absolute_limit_factory,
                                                    percentile_limit_factory)
from dataportal.muxer import DataMuggler, DmImgSequence
from datetime import datetime
from matplotlib.figure import Figure
from matplotlib import colors
from .histogram_model import HistogramModel

# create the colormap list
from matplotlib.cm import datad
mpl_colors = datad.keys()
mpl_colors.sort()
mpl_colors.pop(mpl_colors.index('jet'))
mpl_colors.pop(mpl_colors.index('jet_r'))

interpolation = [
    'none', 'nearest', 'bilinear', 'bicubic', 'spline16', 'spline36',
    'hanning', 'hamming', 'hermite', 'kaiser', 'quadric', 'catrom', 'gaussian',
    'bessel', 'mitchell', 'sinc', 'lanczos'
]

import logging
logger = logging.getLogger(__name__)

__author__ = 'edill'
Esempio n. 7
0
#!/usr/bin/env python
"""
Script used to create lut lists used by mayavi from matplotlib colormaps.
This requires matlplotlib to be installed and should not be ran by the
user, but only once in a while to synchronize with MPL developpement.
"""
# Authors: Frederic Petit <*****@*****.**>,
#          Gael Varoquaux <*****@*****.**>
# Copyright (c) 2007-2009, Enthought, Inc.
# License: BSD Style.

import os
import numpy as np

from matplotlib.cm import datad, get_cmap
from enthought.mayavi.core import lut as destination_module
from enthought.persistence import state_pickler
target_dir = os.path.dirname(destination_module.__file__)

values = np.linspace(0., 1., 256)

lut_dic = {}

for name in datad.keys():
    if name.endswith('_r'):
        continue
    lut_dic[name] = get_cmap(name)(values.copy())

out_name = os.path.join(target_dir, 'pylab_luts.pkl')
state_pickler.dump(lut_dic, out_name)
Esempio n. 8
0
"""
Script used to create lut lists used by mayavi from matplotlib colormaps.
This requires matlplotlib to be installed and should not be ran by the
user, but only once in a while to synchronize with MPL developpement.
"""
# Authors: Frederic Petit <*****@*****.**>, 
#          Gael Varoquaux <*****@*****.**>
# Copyright (c) 2007-2009, Enthought, Inc.
# License: BSD Style.

import os
import numpy as np 

from matplotlib.cm import datad, get_cmap
from enthought.mayavi.core import lut as destination_module
from enthought.persistence import state_pickler
target_dir = os.path.dirname(destination_module.__file__)

values = np.linspace(0., 1., 256)

lut_dic = {}

for name in datad.keys():
    if name.endswith('_r'):
        continue
    lut_dic[name] = get_cmap(name)(values.copy())

out_name = os.path.join(target_dir, 'pylab_luts.pkl')
state_pickler.dump(lut_dic, out_name)