Exemplo n.º 1
0
 def __init__(self, plotWindow, **kw):
     Plugin1DBase.Plugin1DBase.__init__(self, plotWindow, **kw)
     self.methodDict = {
         'Invert': [self.invert, "Multiply active curve by -1", swapsign],
         'Derivate':
         [self.derivate, "Derivate zoomed active curve", derive]
     }
     self.simpleMath = SimpleMath.SimpleMath()
def _pymca_average(xdats, zdats):
    """ call to SimpleMath.average() method from PyMca/SimpleMath.py

    Parameters
    ----------
    - xdats, ydats : lists of arrays contaning the data to merge

    Returns
    -------
    - xmrg, zmrg : 1D arrays containing the merged data
    """
    if HAS_SIMPLEMATH:
        sm = SimpleMath.SimpleMath()
        print("Merging data...")
        return sm.average(xdats, zdats)
    else:
        raise NameError("SimpleMath is not available -- this operation cannot be performed!")
Exemplo n.º 3
0
"""
import copy

from silx.gui.plot.actions import PlotAction

from PyMca5.PyMcaGui import PyMcaQt as qt
from PyMca5.PyMcaMath import SimpleMath
from PyMca5.PyMcaGui.plotting.PyMca_Icons import IconDict

if hasattr(qt, 'QString'):
    QString = qt.QString
else:
    QString = qt.safe_str

_simpleMath = SimpleMath.SimpleMath()


def _getOneCurve(plot, qwarning=True):
    """Return active curve if any,
    else if there is a single curve return it,
    else return None.

    :param plot: Plot instance
    :param bool qwarning: If True, display a warning popup to
        inform that a curve must be selected when function is not
        successful.
    """
    curve = plot.getActiveCurve()
    if curve is None:
        curves = plot.getAllCurves()