# Licensed under an MIT open source license - see LICENSE

'''
KS p-values for different properties.
'''

import numpy as np
from pandas import read_csv
import matplotlib.pyplot as p
import numpy as np
import seaborn as sn
sn.set_context('talk')
sn.set_style('ticks')
sn.mpl.rc("figure", figsize=(7, 9))

# Widths

widths = read_csv("width_ks_table_pvals.csv")

widths.index = widths["Unnamed: 0"]
del widths["Unnamed: 0"]

widths_arr = np.asarray(widths)

widths_arr[np.arange(0, 14), np.arange(0, 14)] = 1.0

widths_arr = -np.log10(widths_arr)

# p.figure(figsize=(12, 10))
p.subplot(211)
# p.xlabel("Widths")
p.imshow(widths_arr, origin='lower', cmap='binary', interpolation='nearest')
p.xticks(np.arange(0, 14), [], rotation=90)
p.yticks(np.arange(0, 14), widths.columns)

p.figtext(0.05, 0.95, "a)", fontsize=20)

cb = p.colorbar()
cb.set_label(r'$-\log_{10}$ p-value')
cb.solids.set_edgecolor("face")
p.tight_layout()

p.show()
# Curvature

curve = read_csv("curvature_branches_ks_table_pvals.csv")

curve.index = curve["Unnamed: 0"]
del curve["Unnamed: 0"]

curve_arr = np.asarray(curve)

curve_arr[np.arange(0, 14), np.arange(0, 14)] = 1.0

curve_arr = -np.log10(curve_arr)

# p.figure(figsize=(12, 10))
p.subplot(212)
# p.xlabel("Curvature")
p.imshow(curve_arr, interpolation='nearest', origin='lower', cmap='binary')
p.xticks(np.arange(0, 14), curve.columns, rotation=90)
p.yticks(np.arange(0, 14), curve.columns)

p.figtext(0.05, 0.55, "b)", fontsize=20)

cb = p.colorbar()
cb.set_label(r'$-\log_{10}$ p-value')
cb.solids.set_edgecolor("face")

p.tight_layout()

p.show()

@@ -261,16 +261,18 @@
 ticks')%0A
+# 
 sn.mpl.r
@@ -581,17 +581,17 @@
 subplot(
-2
+1
 11)%0A# p.
@@ -710,16 +710,74 @@
 (0, 14),
+ widths.columns, rotation=90)%0A# p.xticks(np.arange(0, 14),
  %5B%5D, rot
@@ -822,32 +822,34 @@
 idths.columns)%0A%0A
+# 
 p.figtext(0.05, 
@@ -1002,16 +1002,18 @@
 vature%0A%0A
+# 
 curve = 
@@ -1036,17 +1036,8 @@
 ure_
-branches_
 ks_t
@@ -1054,16 +1054,18 @@
 .csv%22)%0A%0A
+# 
 curve.in
@@ -1086,24 +1086,26 @@
 nnamed: 0%22%5D%0A
+# 
 del curve%5B%22U
@@ -1117,16 +1117,18 @@
 d: 0%22%5D%0A%0A
+# 
 curve_ar
@@ -1150,16 +1150,18 @@
 curve)%0A%0A
+# 
 curve_ar
@@ -1205,16 +1205,18 @@
  = 1.0%0A%0A
+# 
 curve_ar
@@ -1237,24 +1237,26 @@
 curve_arr)%0A%0A
+# 
 # p.figure(f
@@ -1264,32 +1264,34 @@
 gsize=(12, 10))%0A
+# 
 p.subplot(212)%0A#
@@ -1290,16 +1290,18 @@
 t(212)%0A#
+ #
  p.xlabe
@@ -1315,16 +1315,18 @@
 ature%22)%0A
+# 
 p.imshow
@@ -1393,16 +1393,18 @@
 inary')%0A
+# 
 p.xticks
@@ -1442,32 +1442,34 @@
 s, rotation=90)%0A
+# 
 p.yticks(np.aran
@@ -1495,16 +1495,18 @@
 lumns)%0A%0A
+# 
 p.figtex
@@ -1531,32 +1531,34 @@
 , fontsize=20)%0A%0A
+# 
 cb = p.colorbar(
@@ -1551,32 +1551,34 @@
  = p.colorbar()%0A
+# 
 cb.set_label(r'$
@@ -1591,32 +1591,34 @@
 %7B10%7D$ p-value')%0A
+# 
 cb.solids.set_ed
@@ -1634,16 +1634,18 @@
 face%22)%0A%0A
+# 
 p.tight_
@@ -1642,29 +1642,31 @@
 # p.tight_layout()%0A%0A
+# 
 p.show()%0A

Remove curvature from KS plot