예제 #1
0
    print('Hierarchy version took %f seconds' % hierarchy_time)

def size():
    """
    lst = []
    for i in range(100):
        for j in range(i):
            lst.append(i)
    """
    lst = list(range(100000))

    return dc.means(dc.cluster_sizes(lst))
if __name__ == '__main__':
    #benchmark()
    L, com_lipids, com_chol = trajIO.decompress("comTraj.npz")
    
    import pickle

    pickle_off = open("clusters.dict","rb")
    clusters = pickle.load(pickle_off)
    X = clusters[0][28]['lipid'][0][0]

    assert dc.mean_cluster_size(X,L[0],1.15,dc.dbscan_wrapper) == dc.mean_cluster_size(X,L[0],1.15,dc.hierarchy_wrapper)
    #print(dc.mean_cluster_size(X,L[0],1.15,dc.dbscan_wrapper))
    #print(dc.meanRandom(com_lipids[28],L[0],1.15,319,))
    print(dc.normSize(X,L[0],1.15,com_lipids[0]))

    #print(size())
    

    
예제 #2
0
            #print(t) #progress tracker
            upper, lower = trajIO.layering(com_lipids[t])
            original = {}
            original['upper'] = upper
            original['lower'] = lower

            for layer in ['upper', 'lower']:
                #clustering
                clusters = percentages.cluster(original[layer], percentage)

                for size in cluster_sizes:
                    for i in range(size):
                        Nparticles = len(clusters[i])
                        normSizes[block][time][layer][size][
                            i], weightedNormSizes[block][time][layer][size][
                                i] = dc.mean_cluster_size(
                                    clusters[i], L[t], cutoff)

                        if time == 1:
                            alpha, beta = dc.meanRandom(
                                original[layer], L[t], cutoff, Nparticles)
                            logNorm[size][i] += alpha
                            logWeighted[size][i] += beta

    #linear
    #linearNorm = linearWeighted =

    for block in range(Nblock):
        start = block * nlog
        linear_t = displacement.linear_gen(start, Nconf)

        com_lipids = displacement.linear_displacement(L, com_lipids, start,
예제 #3
0
        for time in times:
            t = start + time
            #print(t) #progress tracker
            upper,lower = trajIO.layering(com_lipids[t])
            original = {}
            original['upper'] = upper
            original['lower'] = lower

            for layer in ['upper','lower']:
                #clustering
                clusters = percentages.cluster(original[layer],percentage)

                for size in cluster_sizes:
                    for i in range(size):
                        Nparticles = len(clusters[i])
                        normSizes[block][time][layer][size][i],weightedNormSizes[block][time][layer][size][i] = dc.mean_cluster_size(clusters[i],L[t],cutoff)
                        
                        if time == 1:
                            alpha,beta = dc.meanRandom(original[layer],L[t],cutoff,Nparticles)
                            logNorm[size][i] += alpha
                            logWeighted[size][i] += beta

    #linear
    #linearNorm = linearWeighted = 

    for block in range(Nblock):
        start = block*nlog
        linear_t = displacement.linear_gen(start,Nconf)

        com_lipids = displacement.linear_displacement(L,com_lipids,start,Nconf)