Пример #1
0
def testInteg():
    from peakBBA import peakFitBBA
    from monDimReduce import SAXSDimReduce
    from input_file_parsing import parse_config
    calibList = getAllCalibPath()

    dataPath = expUsr('~/allSampleTest/')
    configPath = expUsr('~/monHiTp/config')
    fileList = glob.glob(os.path.join(dataPath, '*.tif'))

    fileGen = (x for x in fileList)
    config = parse_config(configPath)
    if config:
        QRange = (config['Qmin'], config['Qmax'])
        ChiRange = (config['ChiMin'], config['ChiMax'])
        # require all bounds to exist, currently can't check default limits
        if (any(isinstance(n, str) for n in QRange)
                or any(isinstance(m, str) for m in ChiRange)):
            print('Pass found, ignoring Q,Chi limits')
            QRange, ChiRange = None, None
        peakShape = config['peakShape']
        peakNo = config['peakNo']
        fit_order = config['fit_order']
        hiLimit = config['highlightLimit']

        config['bkgdPath'] = expUsr('~/monHiTp/')
    else:
        #Qrange, peakShape, peakNo, fit_order, hiLimit = None, None, None, None, None
        print('no config file')

    start = time.time()
    for f in fileGen:
        if any(x in f for x in ['k1', 'k2', 'k3', 'a1', 'k5']):
            c = calibList[0]
        elif any(x in f for x in ['k6', 'k7']):
            c = calibList[5]
        elif any(x in f for x in ['k8a']):
            c = calibList[1]
        elif any(x in f for x in ['k9a']):
            c = calibList[2]
        elif any(x in f for x in ['r5', 'r15']):
            c = calibList[4]
        else:
            c = calibList[3]

        print(f + '\n<===>\n' + c)

        SAXSDimReduce(c, f, config)
        peakFitBBA(f, config)

    end = time.time()

    print(end - start)
    print(len(fileList))
Пример #2
0
    def process_IN_CREATE(self, event):
        print('file created: {0}'.format(event.pathname))
        filename = os.path.basename(event.pathname)
        fileRoot, ext = os.path.splitext(filename)
        if ext == '.tif':
            print(filename + ' detected, processing')
            ########## Begin data reduction scripts ###########################
            SAXSDimReduce(self.calibPath, event.pathname)
            peakFitBBA(event.pathname)

            FWHMmap(event.pathname)
            print(filename + ' completed')
            print(
                '====================================================== Waiting...'
            )
            print('\n')
    def process_IN_CREATE(self, event):
        print('file created: {0}'.format(event.pathname))
        filename = os.path.basename(event.pathname)
        fileRoot, ext = os.path.splitext(filename)
        if ext == '.tif':
            print(filename + ' detected, processing')
            ########## Begin data reduction scripts ###########################
            SAXSDimReduce(self.calibPath, event.pathname,
                          self.config)  #QRange=QRange, ChiRange=ChiRange)

            peakFitBBA(event.pathname, self.config)
            ########## Visualization #########################################
            # Pulling info from master CSV
            FWHMmap(event.pathname)
            contrastMap(event.pathname, self.config['highlightLimit'])

            print(event.pathname + ' completed')
            print(
                '====================================================== Waiting...'
            )
            print('\n')
        has1DcsvFile = os.path.isfile(procPath)
        if has1DcsvFile:
            print('Skipping file: {}'.format(procPath))
            continue

    start = time.time()

    print('{0}'.format(filePath))
    print(filename + ' detected, processing')

    ########## Begin data reduction scripts ###########################
    SAXSDimReduce(calibPath, filePath,
                  config)  #QRange=QRange, ChiRange=ChiRange)
    stage1int = time.time()

    peakFitBBA(filePath, config)
    stage2int = time.time()
    ########## Visualization #########################################
    # Pulling info from master CSV
    FWHMmap(filePath)
    contrastMap(filePath, hiLimit)

    print(filename + ' completed')

    end = time.time()
    loopTime += [(end - start)]
    stage1Time += [(stage1int - start)]
    stage2Time += [(stage2int - stage1int)]

    #break
Пример #5
0
            continue 
    
    start = time.time()
    
    print('{0}'.format(filePath))
    print(filename + ' detected, processing')

    # fake a path in prev folder
    # Assume name of format xxxxx_[index]_1D.csv
    fakeName = filename[:-7]+'.tif'
    fakePath = dataPath + fakeName
    print(fakePath)
    ########## Begin data reduction scripts ###########################
    stage1int = time.time()

    peakFitBBA(fakePath, config)
    stage2int = time.time()
    ########## Visualization #########################################
    # Pulling info from master CSV
    FWHMmap(fakePath)
    contrastMap(fakePath, hiLimit)

    print(filename + ' completed')

    end = time.time()
    loopTime += [(end-start)]
    stage2Time += [(stage2int - stage1int)]


    #break