Beispiel #1
0
def test():
    import logging
    from PyMca5.PyMcaCore.LoggingLevel import getLoggingLevel
    sys.excepthook = qt.exceptionHandler
    app = qt.QApplication([])
    app.lastWindowClosed.connect(app.quit)

    import getopt
    options=''
    longoptions=["nativefiledialogs=", "transpose=", "fileindex=",
                 "logging=", "debug="]
    opts, args = getopt.getopt(
                    sys.argv[1:],
                    options,
                    longoptions)
    transpose=False
    for opt,arg in opts:
        if opt in '--nativefiledialogs':
            if int(arg):
                PyMcaDirs.nativeFileDialogs=True
            else:
                PyMcaDirs.nativeFileDialogs=False
        elif opt in '--transpose':
            if int(arg):
                transpose=True
        elif opt in '--fileindex':
            if int(arg):
                transpose=True

    logging.basicConfig(level=getLoggingLevel(opts))

    filelist=args
    w = PyMcaPostBatch()
    w.layout().setContentsMargins(11, 11, 11, 11)
    if not len(filelist):
        filelist = w._getStackOfFiles()
    if not len(filelist):
        print("Usage:")
        print("python PyMcaPostBatch.py PyMCA_BATCH_RESULT_DOT_DAT_FILE")
        sys.exit(app.quit())
    if len(filelist) == 1:
        if filelist[0].lower().endswith("dat"):
            try:
                w.addBatchDatFile(filelist[0])
            except ValueError:
                w.addFileList(filelist)
        else:
            w.addFileList(filelist)
    else:
        w.addFileList(filelist)
    if transpose:
        w.transposeImages()
    w.show()
    app.exec_()
Beispiel #2
0
def test():
    import logging
    from PyMca5.PyMcaCore.LoggingLevel import getLoggingLevel
    sys.excepthook = qt.exceptionHandler
    app = qt.QApplication([])
    app.lastWindowClosed.connect(app.quit)

    import getopt
    options = ''
    longoptions = [
        "nativefiledialogs=", "transpose=", "fileindex=", "logging=", "debug="
    ]
    opts, args = getopt.getopt(sys.argv[1:], options, longoptions)
    transpose = False
    for opt, arg in opts:
        if opt in '--nativefiledialogs':
            if int(arg):
                PyMcaDirs.nativeFileDialogs = True
            else:
                PyMcaDirs.nativeFileDialogs = False
        elif opt in '--transpose':
            if int(arg):
                transpose = True
        elif opt in '--fileindex':
            if int(arg):
                transpose = True

    logging.basicConfig(level=getLoggingLevel(opts))

    filelist = args
    w = PyMcaPostBatch()
    w.layout().setContentsMargins(11, 11, 11, 11)
    if not len(filelist):
        filelist = w._getStackOfFiles()
    if not len(filelist):
        print("Usage:")
        print("python PyMcaPostBatch.py PyMCA_BATCH_RESULT_DOT_DAT_FILE")
        sys.exit(app.quit())
    if len(filelist) == 1:
        if filelist[0].lower().endswith("dat"):
            try:
                w.addBatchDatFile(filelist[0])
            except ValueError:
                w.addFileList(filelist)
        else:
            w.addFileList(filelist)
    else:
        w.addFileList(filelist)
    if transpose:
        w.transposeImages()
    w.show()
    app.exec_()
Beispiel #3
0
def main():
    from PyMca5.PyMcaCore.LoggingLevel import getLoggingLevel
    sys.excepthook = qt.exceptionHandler
    app = qt.QApplication([])
    app.lastWindowClosed.connect(app.quit)

    import getopt
    options = ''
    longoptions = [
        "nativefiledialogs=", "transpose=", "fileindex=", "logging=", "debug=",
        "shape="
    ]
    opts, args = getopt.getopt(sys.argv[1:], options, longoptions)
    transpose = False
    image_shape = None
    for opt, arg in opts:
        if opt in '--nativefiledialogs':
            if int(arg):
                PyMcaDirs.nativeFileDialogs = True
            else:
                PyMcaDirs.nativeFileDialogs = False
        elif opt in '--transpose':
            if int(arg):
                transpose = True
        elif opt in '--fileindex':
            if int(arg):
                transpose = True
        elif opt in '--shape':
            if 'x' in arg:
                split_on = "x"
            else:
                split_on = ","
            image_shape = tuple(int(n) for n in arg.split(split_on))

    logging.basicConfig(level=getLoggingLevel(opts))

    filelist = args
    w = PyMcaPostBatch(image_shape=image_shape)
    w.layout().setContentsMargins(11, 11, 11, 11)
    if not filelist:
        filelist = w._getStackOfFiles()
    if filelist:
        w.addFileList(filelist)
    else:
        print("Usage:")
        print("python PyMcaPostBatch.py PyMCA_BATCH_RESULT_DOT_DAT_FILE")
    if transpose:
        w.transposeImages()
    w.show()
    app.exec_()
def main():
    import sys
    import getopt
    import glob
    from PyMca5.PyMcaCore.LoggingLevel import getLoggingLevel
    app = qt.QApplication(sys.argv)
    winpalette = qt.QPalette(qt.QColor(230, 240, 249),
                             qt.QColor(238, 234, 238))
    app.setPalette(winpalette)
    options = ''
    longoptions = ['logging=', 'debug=']
    opts, args = getopt.getopt(sys.argv[1:], options, longoptions)
    logging.basicConfig(level=getLoggingLevel(opts))
    _logger.setLevel(getLoggingLevel(opts))
    filelist = args
    if len(filelist) == 1:
        if sys.platform.startswith("win") and '*' in filelist[0]:
            filelist = glob.glob(filelist[0])
    app.lastWindowClosed.connect(app.quit)
    w = EdfFileSimpleViewer()
    if len(filelist):
        w.setFileList(filelist)
    w.show()
    app.exec()
Beispiel #5
0
def test():
    import logging
    app = qt.QApplication([])
    app.lastWindowClosed.connect(app.quit)
    if 0:
        graphWidget = RGBCorrelatorGraph.RGBCorrelatorGraph()
        graph = graphWidget.graph
        w = RGBCorrelator(graph=graph)
    else:
        w = RGBCorrelator()
        w.resize(800, 600)
    import getopt
    from PyMca5.PyMcaCore.LoggingLevel import getLoggingLevel
    options = ''
    longoptions = ["logging=", "debug="]
    opts, args = getopt.getopt(
                    sys.argv[1:],
                    options,
                    longoptions)

    logging.basicConfig(level=getLoggingLevel(opts))
    filelist=args
    if len(filelist):
        try:
            import DataSource
            DataReader = DataSource.DataSource
        except:
            import EdfFileDataSource
            DataReader = EdfFileDataSource.EdfFileDataSource
        for fname in filelist:
            source = DataReader(fname)
            for key in source.getSourceInfo()['KeyList']:
                dataObject = source.getDataObject(key)
                w.addImage(dataObject.data, os.path.basename(fname)+" "+key)
    else:
        print("This is a just test method using 100 x 100 matrices.")
        print("Run PyMcaPostBatch to have file loading capabilities.")
        array1 = numpy.arange(10000)
        array2 = numpy.resize(numpy.arange(10000), (100, 100))
        array2 = numpy.transpose(array2)
        array3 = array1 * 1
        w.addImage(array1)
        w.addImage(array2)
        w.addImage(array3)
        w.setImageShape([100, 100])
    w.show()
    app.exec_()
Beispiel #6
0
def test():
    import logging
    app = qt.QApplication([])
    app.lastWindowClosed.connect(app.quit)
    if 0:
        graphWidget = RGBCorrelatorGraph.RGBCorrelatorGraph()
        graph = graphWidget.graph
        w = RGBCorrelator(graph=graph)
    else:
        w = RGBCorrelator()
        w.resize(800, 600)
    import getopt
    from PyMca5.PyMcaCore.LoggingLevel import getLoggingLevel
    options = ''
    longoptions = ["logging=", "debug="]
    opts, args = getopt.getopt(
                    sys.argv[1:],
                    options,
                    longoptions)

    logging.basicConfig(level=getLoggingLevel(opts))
    filelist=args
    if len(filelist):
        try:
            import DataSource
            DataReader = DataSource.DataSource
        except:
            import EdfFileDataSource
            DataReader = EdfFileDataSource.EdfFileDataSource
        for fname in filelist:
            source = DataReader(fname)
            for key in source.getSourceInfo()['KeyList']:
                dataObject = source.getDataObject(key)
                w.addImage(dataObject.data, os.path.basename(fname)+" "+key)
    else:
        print("This is a just test method using 100 x 100 matrices.")
        print("Run PyMcaPostBatch to have file loading capabilities.")
        array1 = numpy.arange(10000)
        array2 = numpy.resize(numpy.arange(10000), (100, 100))
        array2 = numpy.transpose(array2)
        array3 = array1 * 1
        w.addImage(array1)
        w.addImage(array2)
        w.addImage(array3)
        w.setImageShape([100, 100])
    w.show()
    app.exec_()
Beispiel #7
0
def main():
    import sys
    import getopt
    from PyMca5.PyMcaCore.LoggingLevel import getLoggingLevel
    app = qt.QApplication(sys.argv)
    winpalette = qt.QPalette(qt.QColor(230, 240, 249),
                             qt.QColor(238, 234, 238))
    app.setPalette(winpalette)
    options = ''
    longoptions = ['logging=', 'debug=']
    opts, args = getopt.getopt(sys.argv[1:], options, longoptions)

    logging.basicConfig(level=getLoggingLevel(opts))
    filelist = args
    app.lastWindowClosed.connect(app.quit)
    w = EdfFileSimpleViewer()
    if len(filelist):
        w.setFileList(filelist)
    w.show()
    app.exec_()
Beispiel #8
0
def main():
    import sys
    import getopt
    from PyMca5.PyMcaCore.LoggingLevel import getLoggingLevel
    app=qt.QApplication(sys.argv)
    winpalette = qt.QPalette(qt.QColor(230,240,249),qt.QColor(238,234,238))
    app.setPalette(winpalette)
    options=''
    longoptions=['logging=', 'debug=']
    opts, args = getopt.getopt(
                    sys.argv[1:],
                    options,
                    longoptions)

    logging.basicConfig(level=getLoggingLevel(opts))
    filelist = args
    app.lastWindowClosed.connect(app.quit)
    w=EdfFileSimpleViewer()
    if len(filelist):
        w.setFileList(filelist)
    w.show()
    app.exec_()
Beispiel #9
0
def main():
    import logging
    from PyMca5.PyMcaCore.LoggingLevel import getLoggingLevel
    import getopt
    options = 'f'
    longoptions = ['outdir=', 'listfile=', 'mcastep=', 'logging=', 'debug=']
    filelist = None
    outdir = None
    listfile = None
    mcastep = 1
    opts, args = getopt.getopt(sys.argv[1:], options, longoptions)
    for opt, arg in opts:
        if opt in ('--outdir'):
            outdir = arg
        elif opt in ('--listfile'):
            listfile = arg
        elif opt in ('--mcastep'):
            mcastep = int(arg)

    logging.basicConfig(level=getLoggingLevel(opts))
    if listfile is None:
        filelist = []
        for item in args:
            filelist.append(item)
    else:
        fd = open(listfile)
        filelist = fd.readlines()
        fd.close()
        for i in range(len(filelist)):
            filelist[i] = filelist[i].replace('\n', '')
    app = qt.QApplication(sys.argv)
    winpalette = qt.QPalette(qt.QColor(230, 240, 249),
                             qt.QColor(238, 234, 238))
    app.setPalette(winpalette)
    app.lastWindowClosed.connect(app.quit)
    if len(filelist) == 0:
        w = Mca2EdfGUI(actions=1)
        w.show()
        sys.exit(app.exec_())
    else:
        text = "Batch from %s to %s" % (os.path.basename(filelist[0]), \
                                        os.path.basename(filelist[-1]))
        window = Mca2EdfWindow(name=text, actions=1)
        b = Mca2EdfBatch(window, filelist, outdir, mcastep)

        def cleanup():
            b.pleasePause = 0
            b.pleaseBreak = 1
            b.wait()
            qApp = qt.QApplication.instance()
            qApp.processEvents()

        def pause():
            if b.pleasePause:
                b.pleasePause = 0
                window.pauseButton.setText("Pause")
            else:
                b.pleasePause = 1
                window.pauseButton.setText("Continue")

        window.pauseButton.clicked.connect(pause)
        window.abortButton.clicked.connect(window.close)
        app.aboutToQuit.connect(cleanup)
        window.show()
        b.start()
        sys.exit(app.exec_())
Beispiel #10
0
def main():
    import logging
    from PyMca5.PyMcaCore.LoggingLevel import getLoggingLevel
    import getopt
    options     = 'f'
    longoptions = ['outdir=', 'listfile=', 'mcastep=',
                   'logging=', 'debug=']
    filelist = None
    outdir   = None
    listfile = None
    mcastep  = 1
    opts, args = getopt.getopt(
                    sys.argv[1:],
                    options,
                    longoptions)
    for opt, arg in opts:
        if opt in ('--outdir'):
            outdir = arg
        elif opt in  ('--listfile'):
            listfile  = arg
        elif opt in  ('--mcastep'):
            mcastep  = int(arg)

    logging.basicConfig(level=getLoggingLevel(opts))
    if listfile is None:
        filelist=[]
        for item in args:
            filelist.append(item)
    else:
        fd = open(listfile)
        filelist = fd.readlines()
        fd.close()
        for i in range(len(filelist)):
            filelist[i]=filelist[i].replace('\n','')
    app=qt.QApplication(sys.argv)
    winpalette = qt.QPalette(qt.QColor(230,240,249),qt.QColor(238,234,238))
    app.setPalette(winpalette)
    app.lastWindowClosed.connect(app.quit)
    if len(filelist) == 0:
        w = Mca2EdfGUI(actions=1)
        w.show()
        sys.exit(app.exec_())
    else:
        text = "Batch from %s to %s" % (os.path.basename(filelist[0]), \
                                        os.path.basename(filelist[-1]))
        window =  Mca2EdfWindow(name=text,actions=1)
        b = Mca2EdfBatch(window,filelist,outdir,mcastep)
        def cleanup():
            b.pleasePause = 0
            b.pleaseBreak = 1
            b.wait()
            qApp = qt.QApplication.instance()
            qApp.processEvents()

        def pause():
            if b.pleasePause:
                b.pleasePause=0
                window.pauseButton.setText("Pause")
            else:
                b.pleasePause=1
                window.pauseButton.setText("Continue")
        window.pauseButton.clicked.connect(pause)
        window.abortButton.clicked.connect(window.close)
        app.aboutToQuit.connect(cleanup)
        window.show()
        b.start()
        sys.exit(app.exec_())