Example #1
0
def plotprofiles(workspaces, labels=None, style='l', xscale='linear', yscale='linear'):
    """Plot line profile workspaces.

    Plots the given single histogram cut workspaces.

    :param workspaces: a single workspace or a list thereof
    :type workspaces: str, :class:`mantid.api.MatrixWorkspace` or a :class:`list` thereof
    :param labels: a list of cut labels for the plot legend
    :type labels: str, a :class:`list` of strings or None
    :param style: plot style: 'l' for lines, 'm' for markers, 'lm' for both
    :type style: str
    :param xscale: horizontal axis scaling: 'linear', 'log', 'symlog', 'logit'
    :type xscale: str
    :param yscale: vertical axis scaling: 'linear', 'log', 'symlog', 'logit'
    :type yscale: str
    :returns: a tuple of (:mod:`matplotlib.Figure`, :mod:`matplotlib.Axes`)
    """
    _validate._styleordie(style)
    workspaces = _normwslist(workspaces)
    for ws in workspaces:
        _validate._singlehistogramordie(ws)
    figure, axes = _plotsinglehistogram(workspaces, labels, style, xscale, yscale)
    xUnit = workspaces[0].getAxis(0).getUnit().unitID()
    if xUnit == 'DeltaE':
        _finalizeprofileQ(workspaces, axes)
    elif xUnit == 'MomentumTransfer':
        _finalizeprofileE(axes)
    return figure, axes
Example #2
0
def plotprofiles(workspaces,
                 labels=None,
                 style='l',
                 xscale='linear',
                 yscale='linear'):
    """Plot line profile workspaces.

    Plots the given single histogram cut workspaces.

    :param workspaces: a single workspace or a list thereof
    :type workspaces: str, :class:`mantid.api.MatrixWorkspace` or a :class:`list` thereof
    :param labels: a list of cut labels for the plot legend
    :type labels: str, a :class:`list` of strings or None
    :param style: plot style: 'l' for lines, 'm' for markers, 'lm' for both
    :type style: str
    :param xscale: horizontal axis scaling: 'linear', 'log', 'symlog', 'logit'
    :type xscale: str
    :param yscale: vertical axis scaling: 'linear', 'log', 'symlog', 'logit'
    :type yscale: str
    :returns: a tuple of (:mod:`matplotlib.Figure`, :mod:`matplotlib.Axes`)
    """
    _validate._styleordie(style)
    workspaces = _normwslist(workspaces)
    for ws in workspaces:
        _validate._singlehistogramordie(ws)
    figure, axes = _plotsinglehistogram(workspaces, labels, style, xscale,
                                        yscale)
    xUnit = workspaces[0].getAxis(0).getUnit().unitID()
    if xUnit == 'DeltaE':
        _finalizeprofileQ(workspaces, axes)
    elif xUnit == 'MomentumTransfer':
        _finalizeprofileE(axes)
    return figure, axes
Example #3
0
def plotDOS(workspaces, labels=None, style='l', xscale='linear', yscale='linear'):
    """Plot density of state workspaces.

    Plots the given DOS workspaces.

    :param workspaces: a single workspace or a list thereof
    :type workspaces: str, :class:`mantid.api.MatrixWorkspace` or a :class:`list` thereof
    :param labels: a list of labels for the plot legend
    :type labels: str, a :class:`list` of strings or None
    :param style: plot style: 'l' for lines, 'm' for markers, 'lm' for both
    :type style: str
    :param xscale: horizontal axis scaling: 'linear', 'log', 'symlog', 'logit'
    :type xscale: str
    :param yscale: vertical axis scaling: 'linear', 'log', 'symlog', 'logit'
    :type yscale: str
    :returns: a tuple of (:mod:`matplotlib.Figure`, :mod:`matplotlib.Axes`)
    """
    _validate._styleordie(style)
    workspaces = _normwslist(workspaces)
    for ws in workspaces:
        _validate._singlehistogramordie(ws)
        if not _validate._isDOS(ws):
            logger.warning("The workspace '{}' does not look like proper DOS data. Trying to plot nonetheless.".format(ws))
    if labels is None:
        labels = [_workspacelabel(ws) for ws in workspaces]
    figure, axes = _plotsinglehistogram(workspaces, labels, style, xscale, yscale)
    _dostitle(workspaces, axes)
    if len(workspaces) > 1:
        axes.legend()
    return figure, axes
Example #4
0
def plotDOS(workspaces, labels=None, style='l', xscale='linear', yscale='linear'):
    """Plot density of state workspaces.

    Plots the given DOS workspaces.

    :param workspaces: a single workspace or a list thereof
    :type workspaces: str, :class:`mantid.api.MatrixWorkspace` or a :class:`list` thereof
    :param labels: a list of labels for the plot legend
    :type labels: str, a :class:`list` of strings or None
    :param style: plot style: 'l' for lines, 'm' for markers, 'lm' for both
    :type style: str
    :param xscale: horizontal axis scaling: 'linear', 'log', 'symlog', 'logit'
    :type xscale: str
    :param yscale: vertical axis scaling: 'linear', 'log', 'symlog', 'logit'
    :type yscale: str
    :returns: a tuple of (:mod:`matplotlib.Figure`, :mod:`matplotlib.Axes`)
    """
    _validate._styleordie(style)
    workspaces = _normwslist(workspaces)
    for ws in workspaces:
        _validate._singlehistogramordie(ws)
        if not _validate._isDOS(ws):
            logger.warning("The workspace '{}' does not look like proper DOS data. Trying to plot nonetheless.".format(ws))
    if labels is None:
        labels = [_workspacelabel(ws) for ws in workspaces]
    figure, axes = _plotsinglehistogram(workspaces, labels, style, xscale, yscale)
    _dostitle(workspaces, axes)
    if len(workspaces) > 1:
        axes.legend()
    return figure, axes