Пример #1
0
 def run(self):
     self.br=BGrate.calcBGrate(self.dbname,20,400,T0=600.0)
     self.burst=BurstSearch.findBurst(self.br,self.dbname,["All"])
     self.burstSeff, self.burstFRET,self.wei,self.H,self.xedges, \
         self.yedges=fretAndS.FretAndS(self.dbname,self.burst,(27,27),self.br)
     #self.timer.stop()
     self.viewbox.canvas.drawHist(self.H,self.xedges,self.yedges)
     if self.mainui is not None:
         print ("copy burst")
         self.mainui.burst=copy.deepcopy(self.burst)
         print(self.mainui.burst["SyncResolution"])
Пример #2
0
def main(comm, dbname, n_states, Sth):
    rank = comm.Get_rank()
    clsize = comm.Get_size()
    #print("============size=====",clsize)
    if rank == 0:
        br = BGrate.calcBGrate(dbname, 20, 400)
        burst = BurstSearch.findBurst(br, dbname, ["All"])
        burstSeff, burstFRET, wei, H, xedges, yedges = fretAndS.FretAndS(
            dbname, burst, (27, 27), br)
        n_burst = len(burst["All"]['chl'])
        if n_burst < clsize:
            clsize = n_burst
        chunkLists = list(chunks(range(n_burst), clsize))

        #gsml=GS_MLE(burst,0.891)
        #gsml.n_states=2
        #gsml.MaxLikehood([0.3,0.7,0.2, 3,3,3, 3,3,3])

        #endtime = datetime.datetime.now()
        #print (endtime - starttime)

    else:
        burst = dict()

        chunkLists = list()
    clsize = comm.bcast(clsize, root=0)
    burst = comm.bcast(burst, root=0)

    burstIdxRange = comm.scatter(chunkLists, root=0)
    #print(burstIdxRange,rank)
    gsml = GS_MLE(burst, comm, burstIdxRange, Sth)
    gsml.n_states = n_states

    params = [0.38, 0.6, 675.0, 325.0, 3, 3, 3, 3, 3]
    params = params[:n_states * n_states]
    #print(params)
    stop = [0]
    if rank == 0:
        gsml.MaxLikehood(params)
        #gsml.lnLikelihood(params,stop)
    else:
        while stop[0] == 0:
            gsml.lnLikelihood(params, stop)
Пример #3
0
        return None
    matP = np.empty([n, 1])
    ap = 0
    for i in range(n):
        ap += matK[i, i]
    for i in range(n):
        matP[i, 0] = matK[i, i] / ap
    return matP


if __name__ == '__main__':
    import matplotlib
    import datetime
    starttime = datetime.datetime.now()

    dbname = '/home/liuk/sf/oc/data/38.sqlite'
    dbname = 'E:/liuk/proj/ptu/data/55.sqlite'
    #dbname='E:/sf/oc/data/38.sqlite'
    dbname = "E:/dbox/sf/oc/data/1min.sqlite"
    br = BGrate.calcBGrate(dbname, 20, 400)
    burst = BurstSearch.findBurst(br, dbname, ["All"])
    burstSeff, burstFRET, wei, H, xedges, yedges = fretAndS.FretAndS(
        dbname, burst, (27, 27), br)
    #matplotlib.pyplot.plot(burst["All"].s)
    gsml = GS_MLE(burst, 0.891)
    gsml.n_states = 3
    gsml.MaxLikehood([0.3, 0.7, 0.2, 3, 3, 3, 3, 3, 3])

    endtime = datetime.datetime.now()
    print(endtime - starttime)