In [1]:
%matplotlib inline

In [2]:
import sys
# This is needed for large-ish dataset KD-tree construction. Fingers crossed that it actually works...
sys.setrecursionlimit(10000)

In [3]:
import sklearn

In [4]:
%time %run CategorizedDistances.py


No Worms within 10000.000000 meters.
No Worms within 10000.000000 meters.
No Worms within 10000.000000 meters.
No Worms within 10000.000000 meters.
No Worms within 10000.000000 meters.
No Worms within 10000.000000 meters.
No Worms within 10000.000000 meters.
No Worms within 10000.000000 meters.
No Worms within 10000.000000 meters.
No Worms within 10000.000000 meters.
No Worms within 10000.000000 meters.
No Worms within 10000.000000 meters.
No Worms within 10000.000000 meters.
No Worms within 10000.000000 meters.
No Worms within 10000.000000 meters.
No Worms within 10000.000000 meters.
CPU times: user 1min 3s, sys: 2.4 s, total: 1min 5s
Wall time: 1min 6s

In [ ]:
%debug


> /bonzo_pool/korin_work/LevelJoiner/CategorizedDistances.py(118)<module>()
    117 if not engine.dialect.has_table(connect, points_name):
--> 118     raise AttributeError('The Points table is missing.')
    119 if not engine.dialect.has_table(connect, levels_name):

ipdb> p points_name
'gpfa_ab_gravity_worm_data.AppBasinMergedBGA2500Final_points'

In [5]:
from matplotlib import pyplot as plt

In [6]:
all_dists = min_dist_to_nodes[2] + min_dist_to_nodes[3] + min_dist_to_nodes[4] + min_dist_to_nodes[5]

In [7]:
plt.hist(all_dists, bins=25, cumulative=False)
plt.xlabel('Distance (meters)')
plt.ylabel('Count')
plt.title('Histogram of Distances from EQs to All Categorized Worm Points')
plt.savefig('AppBasinBGA_EQDistToCatAllWormsHistogram.png')



In [30]:
names = ['Censored or End','','Moderately Low', 'Moderate', 'Moderately High','High']
cats = [0,1,2,3,4,5]
heights = np.zeros((6),np.int)

for i in classes:
    if i == None:
        idx = 0
    else:
        idx = i
    heights[idx] += 1

#plt.hist([c for c in classes if c != None], bins=4, cumulative=False)
fig, ax = plt.subplots()
ax.bar(cats,heights, color=['black','black','lawngreen','yellow','orange','red'])
ax.set_xticklabels(names, rotation=45, fontsize=13)
plt.xlabel('Risk Categories',fontsize=14)
plt.ylabel('Count',fontsize=14)
plt.title('Histogram of Categories of Closest Gravity Worm Points to EQs',fontsize=16, y= 1.08)
#plt.legend()
plt.savefig('AppBasinRiskHistogram.png')



In [9]:
print heights


[64  0 93 20 19 51]

In [ ]:
print min_dist_to_nodes

In [ ]:
len(min_dist_to_nodes)

In [ ]:
bad_depth_hit_count = 1372
good_depth_hit_count = 2605
total_EQs = 5712
print float(good_depth_hit_count + bad_depth_hit_count)/float(total_EQs)

print eq_query.count()

In [ ]:
depths = []
for e in eq_query.all():
    dpth = e[0]._Depth_km_
    if dpth == None:
        continue
    depths += [dpth*1000.]

In [ ]:
plt.hist(depths,range=(0,35000),bins=70,log=True)

In [ ]:
plt.hist?

In [ ]:
plt.hist(worm_pt_coords[:,2])

In [ ]: