In [2]:
%pylab inline
from scipy import stats
In [30]:
def make_KS_test(edge_file):
edge_data = loadtxt(edge_file)
edge_length = sqrt(edge_data[:,0]**2 + edge_data[:,2]**2)
#pick a unit vector over the sphere
#phi = 0.5*pi/180.0
#theta = pi/4.0
#x_unit = sin(theta) * cos(phi)
#y_unit = sin(theta) * sin(phi)
#z_unit = cos(theta)
x_unit = 0.0
y_unit = 0.0
z_unit = 1.0
print x_unit, y_unit, z_unit
#get the cosinus of the angle between the edges
mu = arccos(abs((edge_data[:,0]*x_unit + edge_data[:,2]*z_unit))/edge_length)
n_points = size(mu)
mu_flat = linspace(0.0,pi/2.0,n_points)
#plot(sort(mu))
plot(sort(mu_flat)-sort(mu))
KS_stat, p_value = stats.ks_2samp(mu, mu_flat)
return KS_stat, p_value
In [53]:
ks_value, p_value = make_KS_test("../data/skeleton/edge_xyz_BSkeleton_sdss3_11_RSD_1_OM_0.30_OL_0.70_W_-1.0_theta_90.0_180.0_phi_0.0_1.0_r_0.0_2000.0_MASS_1.0E+13_FRAC_1.0000_BETA_5.dat")
print ks_value, p_value
In [54]:
ks_value, p_value = make_KS_test("../data/skeleton/edge_xyz_BSkeleton_sdss3_11_RSD_1_OM_0.50_OL_0.50_W_-1.2_theta_90.0_180.0_phi_0.0_1.0_r_0.0_2000.0_MASS_1.0E+13_FRAC_1.0000_BETA_5.dat")
print ks_value, p_value
In [ ]: