Esempio n. 1
0
def newTiledWindow(name=None, sources=None, ncols=None):
    """Create an empty tiled window.

    Args:
        name: The name to give to the window (if None, a unique name will be generated).

    Returns:
        A handle to the created window.
    """
    if name is None:
        proxy = new_proxy(proxies.TiledWindowProxy, _qti.app.newTiledWindow)
    else:
        proxy = new_proxy(proxies.TiledWindowProxy, _qti.app.newTiledWindow,
                          name)

    if ncols is None:
        ncols = proxy.columnCount()

    if sources is not None:
        row = 0
        col = 0
        for source in sources:
            if isinstance(source, tuple):
                ws = source[0]
                indices = source[1]
                source = plotSpectrum(ws, indices)
            proxy.addWidget(source, row, col)
            col += 1
            if col == ncols:
                col = 0
                row += 1

    return proxy
Esempio n. 2
0
def newTiledWindow(name=None, sources = None, ncols = None):
    """Create an empty tiled window.

    Args:
        name: The name to give to the window (if None, a unique name will be generated).

    Returns:
        A handle to the created window.
    """
    if name is None:
        proxy = new_proxy(proxies.TiledWindowProxy, _qti.app.newTiledWindow)
    else:
        proxy = new_proxy(proxies.TiledWindowProxy, _qti.app.newTiledWindow, name)

    if ncols is None:
        ncols = proxy.columnCount()

    if not sources is None:
        row = 0
        col = 0
        for source in sources:
            if isinstance(source, tuple):
                ws = source[0]
                indices = source[1]
                source = plotSpectrum(ws, indices)
            proxy.addWidget(source, row, col)
            col += 1
            if col == ncols:
                col = 0
                row += 1

    return proxy
Esempio n. 3
0
def newNote(name=None):
    """Create a note.

    Args:
        name: The name to give to the note (if None, a unique name will be generated).

    Returns:
        A handle to the created note.
    """
    if name is None:
        return new_proxy(proxies.MDIWindow, _qti.app.newNote)
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.newNote, name)
Esempio n. 4
0
def newTiledWindow(name=None):
    """Create an empty tiled window.

    Args:
        name: The name to give to the window (if None, a unique name will be generated).

    Returns:
        A handle to the created window.
    """
    if name is None:
        return new_proxy(proxies.TiledWindowProxy, _qti.app.newTiledWindow)
    else:
        return new_proxy(proxies.TiledWindowProxy, _qti.app.newTiledWindow, name)
Esempio n. 5
0
def newNote(name=None):
    """Create a note.

    Args:
        name: The name to give to the note (if None, a unique name will be generated).

    Returns:
        A handle to the created note.
    """
    if name is None:
        return new_proxy(proxies.MDIWindow, _qti.app.newNote)
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.newNote, name)
Esempio n. 6
0
def newMatrix(name=None, rows=32, columns=32):
    """Create a matrix (N.B. This is not the same as a 'MantidMatrix').

    Args:
        name: The name to give to the matrix (if None, a unique name will be generated).
        row: The number of rows in the matrix (default: 32).
        columns: The number of columns in the matrix (default: 32).

    Returns:
        A handle to the created matrix.
    """
    if name is None:
        return new_proxy(proxies.MDIWindow, _qti.app.newMatrix)
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.newMatrix, name, rows, columns)
Esempio n. 7
0
def newTable(name=None, rows=30, columns=2):
    """Create a table.

    Args:
        name: The name to give to the table (if None, a unique name will be generated).
        row: The number of rows in the table (default: 30).
        columns: The number of columns in the table (default: 2).

    Returns:
        A handle to the created table.
    """
    if name is None:
        return new_proxy(proxies.MDIWindow, _qti.app.newTable)
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.newTable, name, rows, columns)
Esempio n. 8
0
def newMatrix(name=None, rows=32, columns=32):
    """Create a matrix (N.B. This is not the same as a 'MantidMatrix').

    Args:
        name: The name to give to the matrix (if None, a unique name will be generated).
        row: The number of rows in the matrix (default: 32).
        columns: The number of columns in the matrix (default: 32).

    Returns:
        A handle to the created matrix.
    """
    if name is None:
        return new_proxy(proxies.MDIWindow, _qti.app.newMatrix)
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.newMatrix, name, rows, columns)
Esempio n. 9
0
def newTable(name=None, rows=30, columns=2):
    """Create a table.

    Args:
        name: The name to give to the table (if None, a unique name will be generated).
        row: The number of rows in the table (default: 30).
        columns: The number of columns in the table (default: 2).

    Returns:
        A handle to the created table.
    """
    if name is None:
        return new_proxy(proxies.MDIWindow, _qti.app.newTable)
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.newTable, name, rows, columns)
Esempio n. 10
0
def newGraph(name=None, layers=1, rows=1, columns=1):
    """Create a graph window.

    Args:
        name: The name to give to the graph (if None, a unique name will be generated).
        layers: The number of plots (a.k.a. layers) to put in the graph window (default: 1).
        rows: The number of rows of to put in the graph window (default: 1).
        columns: The number of columns of to put in the graph window (default: 1).

    Returns:
        A handle to the created graph widget.
    """
    if name is None:
        return new_proxy(proxies.Graph, _qti.app.newGraph)
    else:
        return new_proxy(proxies.Graph, _qti.app.newGraph, name, layers, rows, columns)
Esempio n. 11
0
def newGraph(name=None, layers=1, rows=1, columns=1):
    """Create a graph window.

    Args:
        name: The name to give to the graph (if None, a unique name will be generated).
        layers: The number of plots (a.k.a. layers) to put in the graph window (default: 1).
        rows: The number of rows of to put in the graph window (default: 1).
        columns: The number of columns of to put in the graph window (default: 1).

    Returns:
        A handle to the created graph widget.
    """
    if name is None:
        return new_proxy(proxies.Graph, _qti.app.newGraph)
    else:
        return new_proxy(proxies.Graph, _qti.app.newGraph, name, layers, rows, columns)
Esempio n. 12
0
def importMatrixWorkspace(name,
                          firstIndex=None,
                          lastIndex=None,
                          showDialog=False,
                          visible=False):
    """Create a MantidMatrix object from the named workspace.

    Args:
        name: The name of the workspace.
        firstIndex: The workspace index to start at (default: the first one).
        lastIndex: The workspace index to stop at (default: the last one).
        showDialog: Whether to bring up a dialog to allow options to be entered manually (default: no).
        visible: Whether to initially show the created matrix (default: no).

    Returns:
        A handle to the created matrix.
    """
    # Turn the optional arguments into the magic numbers that the C++ expects
    if firstIndex is None:
        firstIndex = -1
    if lastIndex is None:
        lastIndex = -1
    return new_proxy(proxies.MantidMatrix,
                     _qti.app.mantidUI.importMatrixWorkspace, name, firstIndex,
                     lastIndex, showDialog, visible)
Esempio n. 13
0
def importImage(filename):
    """Load an image file into a matrix.

    Args:
        filename: The name of the file to load.

    Returns:
        A handle to the matrix containing the image data.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.importImage, filename)
Esempio n. 14
0
def note(name):
    """Get a handle on a note.

    Args:
        name: The name of the note.

    Returns:
        A handle to the note.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.note, name)
Esempio n. 15
0
def graph(name):
    """Get a handle on a graph widget.

    Args:
        name: The name of the graph window.

    Returns:
        A handle to the graph.
    """
    return new_proxy(proxies.Graph, _qti.app.graph, name)
Esempio n. 16
0
def matrix(name):
    """Get a handle on a matrix.

    Args:
        name: The name of the matrix.

    Returns:
        A handle to the matrix.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.matrix, name)
Esempio n. 17
0
def table(name):
    """Get a handle on a table.

    Args:
        name: The name of the table.

    Returns:
        A handle to the table.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.table, name)
Esempio n. 18
0
def matrix(name):
    """Get a handle on a matrix.

    Args:
        name: The name of the matrix.

    Returns:
        A handle to the matrix.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.matrix, name)
Esempio n. 19
0
def note(name):
    """Get a handle on a note.

    Args:
        name: The name of the note.

    Returns:
        A handle to the note.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.note, name)
Esempio n. 20
0
def graph(name):
    """Get a handle on a graph widget.

    Args:
        name: The name of the graph window.

    Returns:
        A handle to the graph.
    """
    return new_proxy(proxies.Graph, _qti.app.graph, name)
Esempio n. 21
0
def table(name):
    """Get a handle on a table.

    Args:
        name: The name of the table.

    Returns:
        A handle to the table.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.table, name)
Esempio n. 22
0
def importImage(filename):
    """Load an image file into a matrix.

    Args:
        filename: The name of the file to load.

    Returns:
        A handle to the matrix containing the image data.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.importImage, filename)
Esempio n. 23
0
def importTableWorkspace(name, visible=False):
    """Create a MantidPlot table from a table workspace.

    Args:
        name: The name of the workspace.
        visible: Whether to initially show the created matrix (default: no).

    Returns:
        A handle to the newly created table.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.mantidUI.importTableWorkspace, name, False, visible)
Esempio n. 24
0
def waterfallPlot(table, columns):
    """Create a waterfall plot from data in a table.

    Args:
        table: A reference to the table containing the data to plot
        columns: A tuple of the column numbers whose data to plot

    Returns:
        A handle to the created plot (Layer).
    """
    return new_proxy(proxies.Graph, _qti.app.waterfallPlot, table._getHeldObject(), columns)
Esempio n. 25
0
def waterfallPlot(table, columns):
    """Create a waterfall plot from data in a table.

    Args:
        table: A reference to the table containing the data to plot
        columns: A tuple of the column numbers whose data to plot

    Returns:
        A handle to the created plot (Layer).
    """
    return new_proxy(proxies.Graph, _qti.app.waterfallPlot, table._getHeldObject(), columns)
Esempio n. 26
0
def importTableWorkspace(name, visible=False):
    """Create a MantidPlot table from a table workspace.

    Args:
        name: The name of the workspace.
        visible: Whether to initially show the created matrix (default: no).

    Returns:
        A handle to the newly created table.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.mantidUI.importTableWorkspace, name, False, visible)
Esempio n. 27
0
def addFolder(name, parentFolder=None):
    """Create a new folder.

    Args:
        name: The name of the folder to create.
        parentFolder: If given, make the new folder a subfolder of this one.

    Returns:
        A handle to the newly created folder.
    """
    if parentFolder is not None:
        parentFolder = parentFolder._getHeldObject()
    return new_proxy(proxies.Folder, _qti.app.addFolder, name, parentFolder)
Esempio n. 28
0
def addFolder(name, parentFolder=None):
    """Create a new folder.

    Args:
        name: The name of the folder to create.
        parentFolder: If given, make the new folder a subfolder of this one.

    Returns:
        A handle to the newly created folder.
    """
    if parentFolder is not None:
        parentFolder = parentFolder._getHeldObject()
    return new_proxy(proxies.Folder, _qti.app.addFolder, name, parentFolder)
Esempio n. 29
0
def createDetectorTable(source):
    try:
        import mantidqtpython
    except:
        print("Could not find module mantidqtpython. Cannot open the detector table.")
        return

    workspace_names = getWorkspaceNames(source)

    if len(workspace_names) != 1:
        raise Exception("Please specify only one workspace.")
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.mantidUI.createDetectorTable, workspace_names[0])
Esempio n. 30
0
def createDetectorTable(source):
    try:
        import mantidqtpython
    except:
        print "Could not find module mantidqtpython. Cannot open the detector table."
        return

    workspace_names = getWorkspaceNames(source)

    if len(workspace_names) != 1:
        raise Exception("Please specify only one workspace.")
    else:
        return new_proxy(proxies.MDIWindow, _qti.app.mantidUI.createDetectorTable, workspace_names[0])
Esempio n. 31
0
def plot(source, *args, **kwargs):
    """Create a new plot given a workspace, table or matrix.

    Args:
        source: what to plot; if it is a Workspace, will
                call plotSpectrum()

    Returns:
        A handle to the created Graph widget.
    """
    if hasattr(source, '_getHeldObject') and isinstance(source._getHeldObject(), QtCore.QObject):
        return new_proxy(proxies.Graph,_qti.app.plot, source._getHeldObject(), *args, **kwargs)
    else:
        return plotSpectrum(source, *args, **kwargs)
Esempio n. 32
0
def getInstrumentView(name, tab=InstrumentWidget.RENDER):
    """Create an instrument view window based on the given workspace.

    Args:
        name: The name of the workspace.
        tab: The index of the tab to display initially, (default=InstrumentWidget.RENDER)

    Returns:
        A handle to the created instrument view widget.
    """
    ads = _get_analysis_data_service()
    if name not in ads:
        raise ValueError("Workspace '%s' does not exist" % name)
    return new_proxy(proxies.InstrumentView, _qti.app.mantidUI.getInstrumentView, name, tab)
Esempio n. 33
0
def getInstrumentView(name, tab=InstrumentWidget.RENDER):
    """Create an instrument view window based on the given workspace.

    Args:
        name: The name of the workspace.
        tab: The index of the tab to display initially, (default=InstrumentWidget.RENDER)

    Returns:
        A handle to the created instrument view widget.
    """
    ads = _get_analysis_data_service()
    if name not in ads:
        raise ValueError("Workspace '%s' does not exist" % name)
    return new_proxy(proxies.InstrumentView, _qti.app.mantidUI.getInstrumentView, name, tab)
Esempio n. 34
0
def importMatrixWorkspace(name, firstIndex=None, lastIndex=None, showDialog=False, visible=False):
    """Create a MantidMatrix object from the named workspace.

    Args:
        name: The name of the workspace.
        firstIndex: The workspace index to start at (default: the first one).
        lastIndex: The workspace index to stop at (default: the last one).
        showDialog: Whether to bring up a dialog to allow options to be entered manually (default: no).
        visible: Whether to initially show the created matrix (default: no).

    Returns:
        A handle to the created matrix.
    """
    # Turn the optional arguments into the magic numbers that the C++ expects
    if firstIndex is None:
        firstIndex = -1
    if lastIndex is None:
        lastIndex = -1
    return new_proxy(proxies.MantidMatrix, _qti.app.mantidUI.importMatrixWorkspace, name,
                     firstIndex, lastIndex, showDialog, visible)
Esempio n. 35
0
def tableToMatrix(table):
    return new_proxy(proxies.MDIWindow, _qti.app.tableToMatrix, table._getHeldObject())
Esempio n. 36
0
def clone(window):
    return new_proxy(proxies.MDIWindow, _qti.app.clone, window._getHeldObject())
Esempio n. 37
0
def openTemplate(filename):
    """Load a previously saved window template"""
    return new_proxy(proxies.MDIWindow, _qti.app.openTemplate, filename)
Esempio n. 38
0
def openTemplate(filename):
    """Load a previously saved window template"""
    return new_proxy(proxies.MDIWindow, _qti.app.openTemplate, filename)
Esempio n. 39
0
def getMantidMatrix(name):
    """Get a handle to the named Mantid matrix"""
    return new_proxy(proxies.MantidMatrix, _qti.app.mantidUI.getMantidMatrix, name)
Esempio n. 40
0
def newPlot3D():
    return new_proxy(proxies.Graph3D, _qti.app.newPlot3D)
Esempio n. 41
0
def matrixToTable(matrix, conversionType=_qti.app.Direct):
    return new_proxy(proxies.MDIWindow, _qti.app.matrixToTable,
                     matrix._getHeldObject(), conversionType)
Esempio n. 42
0
def mergePlots(graph1, graph2):
    """Combine two graphs into a single plot"""
    return new_proxy(proxies.Graph, _qti.app.mantidUI.mergePlots,
                     graph1._getHeldObject(), graph2._getHeldObject())
Esempio n. 43
0
def rootFolder():
    """Get a handle to the top-level folder."""
    return new_proxy(proxies.Folder, _qti.app.rootFolder)
Esempio n. 44
0
def getMantidMatrix(name):
    """Get a handle to the named Mantid matrix"""
    return new_proxy(proxies.MantidMatrix, _qti.app.mantidUI.getMantidMatrix,
                     name)
Esempio n. 45
0
def plot3D(*args):
    if isinstance(args[0], str):
        return new_proxy(proxies.Graph3D, _qti.app.plot3D, *args)
    else:
        return new_proxy(proxies.Graph3D, _qti.app.plot3D,
                         args[0]._getHeldObject(), *args[1:])
Esempio n. 46
0
def matrixToTable(matrix, conversionType=_qti.app.Direct):
    return new_proxy(proxies.MDIWindow, _qti.app.matrixToTable, matrix._getHeldObject(), conversionType)
Esempio n. 47
0
def mergePlots(graph1, graph2):
    """Combine two graphs into a single plot"""
    return new_proxy(proxies.Graph, _qti.app.mantidUI.mergePlots, graph1._getHeldObject(), graph2._getHeldObject())
Esempio n. 48
0
def plot3D(*args):
    if isinstance(args[0], str):
        return new_proxy(proxies.Graph3D, _qti.app.plot3D, *args)
    else:
        return new_proxy(proxies.Graph3D, _qti.app.plot3D, args[0]._getHeldObject(), *args[1:])
Esempio n. 49
0
def activeFolder():
    """Get a handle to the currently active folder."""
    return new_proxy(proxies.Folder, _qti.app.activeFolder)
Esempio n. 50
0
def rootFolder():
    """Get a handle to the top-level folder."""
    return new_proxy(proxies.Folder, _qti.app.rootFolder)
Esempio n. 51
0
def clone(window):
    return new_proxy(proxies.MDIWindow, _qti.app.clone,
                     window._getHeldObject())
Esempio n. 52
0
def tableToMatrix(table):
    return new_proxy(proxies.MDIWindow, _qti.app.tableToMatrix,
                     table._getHeldObject())
Esempio n. 53
0
def activeFolder():
    """Get a handle to the currently active folder."""
    return new_proxy(proxies.Folder, _qti.app.activeFolder)
Esempio n. 54
0
def newPlot3D():
    return new_proxy(proxies.Graph3D, _qti.app.newPlot3D)