Beispiel #1
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)
Beispiel #2
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)
Beispiel #3
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)
Beispiel #4
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)
Beispiel #5
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)
Beispiel #6
0
 def _callPlotBin(workspace, indexes, errors, graph_type):
     if isinstance(workspace, str):
         wkspname = workspace
     else:
         wkspname = workspace.getName()
     if type(indexes) == int:
         indexes = [indexes]
     return new_proxy(proxies.Graph,_qti.app.mantidUI.plotBin,wkspname, indexes, errors,graph_type)
Beispiel #7
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)
Beispiel #8
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)
Beispiel #9
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)
Beispiel #10
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)
Beispiel #11
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)
Beispiel #12
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)
Beispiel #13
0
def getInstrumentView(name, tab=-1):
    """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.
        
    Returns:
        A handle to the created instrument view widget.
    """
    return new_proxy(proxies.MDIWindow, _qti.app.mantidUI.getInstrumentView, name,tab)
Beispiel #14
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)
Beispiel #15
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)
Beispiel #16
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)
Beispiel #17
0
def getInstrumentView(name, tab=InstrumentWindow.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=InstrumentWindow.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.InstrumentWindow, _qti.app.mantidUI.getInstrumentView, name, tab)
Beispiel #18
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)
Beispiel #19
0
def clone(window):
    return new_proxy(proxies.MDIWindow, _qti.app.clone, window._getHeldObject())
Beispiel #20
0
def getMantidMatrix(name):
    """Get a handle to the named Mantid matrix"""
    return new_proxy(proxies.MantidMatrix, _qti.app.mantidUI.getMantidMatrix, name)
Beispiel #21
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())
Beispiel #22
0
def matrixToTable(matrix, conversionType=_qti.app.Direct):
    return new_proxy(proxies.MDIWindow, _qti.app.matrixToTable, matrix._getHeldObject(),conversionType)
Beispiel #23
0
def newPlot3D():
    return new_proxy(proxies.Graph3D, _qti.app.newPlot3D)
Beispiel #24
0
def openTemplate(filename):
    """Load a previously saved window template"""
    return new_proxy(proxies.MDIWindow,_qti.app.openTemplate, filename)
Beispiel #25
0
def activeFolder():
    """Get a handle to the currently active folder."""
    return new_proxy(proxies.Folder, _qti.app.activeFolder)
Beispiel #26
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:])
Beispiel #27
0
def rootFolder():
    """Get a handle to the top-level folder."""
    return new_proxy(proxies.Folder, _qti.app.rootFolder)
Beispiel #28
0
def tableToMatrix(table):
    return new_proxy(proxies.MDIWindow, _qti.app.tableToMatrix, table._getHeldObject())