示例#1
0
def analyseFile(filename):
    print(filename)
    seriesName = os.path.splitext(os.path.split(filename)[-1])[0]
    PL.ExtendContext({'seriesName': seriesName})
    try:
        pipe = Pipeline(filename)
    except RuntimeError:
        print(('Error opening %s' % filename))
        PL.PopContext()
        return

    #only look at first 7k frames
    #pipe.filterKeys['t'] = (0, 7000)
    pipe.Rebuild()

    autoDrift.correctDrift(pipe)

    imb = visHelpers.ImageBounds.estimateFromSource(pipe)

    jitVals = 1.0 * pipe['error_x']
    im = visHelpers.rendJitTriang(pipe['x'], pipe['y'], 20, jitVals, 1, imb, 5)

    pipe.CloseFiles()

    PL.PopContext()
示例#2
0
def analyseFile(filename):
    print(filename)
    seriesName = os.path.splitext(os.path.split(filename)[-1])[0]
    PL.ExtendContext({'seriesName':seriesName})
    try:
        pipe = Pipeline(filename)
    except RuntimeError:
        print(('Error opening %s' % filename))
        PL.PopContext()
        return
    
    #only look at first 7k frames
    pipe.filterKeys['t'] = (0, 7000)
    pipe.Rebuild()
    
    trackUtils.findTracks(pipe, 'error_x', 2, 20)
    pipe.Rebuild()

    extraParams = {}    
    extraParams['cycleTime'] = pipe.mdh['Camera.CycleTime']
    nPhot = kinModels.getPhotonNums(pipe.colourFilter, pipe.mdh)
    extraParams['MedianPhotons'] = np.median(nPhot)
    extraParams['MeanPhotons'] = np.mean(nPhot)
    extraParams['NEvents'] = len(nPhot)
    extraParams['MeanBackground'] = pipe['fitResults_background'].mean() - pipe.mdh['Camera.ADOffset']
    extraParams['MedianBackground'] = np.median(pipe['fitResults_background']) - pipe.mdh['Camera.ADOffset']
    extraParams['MeanClumpSize'] = pipe['clumpSize'].mean()
    extraParams['MeanClumpPhotons'] = (pipe['clumpSize']*nPhot).mean()
    
    PL.AddRecord('/Photophysics/ExtraParams', dictToRecarray(extraParams))
    
    kinModels.fitDecay(pipe)
    kinModels.fitFluorBrightness(pipe)
    #kinModels.fitFluorBrightnessT(pipe)

    #max_off_ts = [3,5,10,20,40]
    #max_off_ts = [20]

    #for ot in max_off_ts:
        #PL.ExtendContext({'otMax':ot})
        #find molecules appearing across multiple frames 
        
    kinModels.fitOnTimes(pipe)
        #PL.PopContext()
    
    pipe.CloseFiles()
     
    PL.PopContext()
示例#3
0
    def colfcnwrap(pipeline):
        colourFilter = pipeline.colourFilter
        metadata = pipeline.mdh
        chans = colourFilter.getColourChans()

        if USE_GUI:
            figure(os.path.split(pipeline.filename)[-1] + ' - ' + fcn.__name__)

        if len(chans) == 0:
            fcn(colourFilter, metadata)
        else:
            curChan = colourFilter.currentColour

            if 'rng' in args:
                nPh = getPhotonNums(colourFilter, metadata)
                rng = 6 * nPh.mean()

            chanNames = chans[:]

            if 'Sample.Labelling' in metadata.getEntryNames():
                lab = metadata.getEntry('Sample.Labelling')

                for i in range(len(lab)):
                    if lab[i][0] in chanNames:
                        chanNames[chanNames.index(lab[i][0])] = lab[i][1]

            for ch, i in zip(chans, range(len(chans))):
                colourFilter.setColour(ch)
                PL.ExtendContext({'chan': chanNames[i]})
                if 'rng' in args:
                    fcn(colourFilter, metadata, chanNames[i], i, rng)
                else:
                    fcn(colourFilter, metadata, chanNames[i], i)
                PL.PopContext()
            colourFilter.setColour(curChan)