Rev. | 2c4ac34d0708edc4b17ce6f3192b33feb7f74c07 |
---|---|
Größe | 799 Bytes |
Zeit | 2012-05-06 21:20:14 |
Autor | lorenzo |
Log Message | I added a small script that extracts the adjacency matrix from the position
|
#! /usr/bin/env python
import scipy as s
import numpy as n
import pylab as p
#from rpy import r
import distance_calc as d_calc
import igraph as ig
density=0.01
threshold=1.06
box_size=(5000./density)**(1./3.) #here the box size does not depend
filename="../read_pos_338"
test=n.loadtxt(filename)
x_pos=test[:,0]
y_pos=test[:,1]
z_pos=test[:,2]
dist_mat=d_calc.distance_calc(x_pos,y_pos,z_pos, box_size)
print "dist_mat is, ", dist_mat
n.savetxt("distance_matrix.dat", dist_mat)
# cluster_obj=ig.Graph.Adjacency((dist_mat <= threshold).tolist(),\
# ig.ADJ_UNDIRECTED)
# cluster_obj.simplify()
# clustering=cluster_obj.clusters()
# print "the number of clusters is, ", len(clustering)
# print "cluster size distribution is, ", clustering.sizes()
print "So far so good"