forked from justinbois/bootcamp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlesson23_24_exercise5.py
37 lines (30 loc) · 1.12 KB
/
lesson23_24_exercise5.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import numpy as np
import scipy.stats
import bootcamp_utils
import matplotlib.pyplot as plt
import seaborn as sns
rc = {'lines.linewidth' : 2, 'axes.labelsize' : 18,
'axes.titlesize' : 18}
sns.set(rc=rc)
# Load Data
xa_high = np.loadtxt('data/xa_high_food.csv',comments='#')
xa_low = np.loadtxt('data/xa_low_food.csv',comments='#')
x_high, y_high = bootcamp_utils.ecdf(xa_high)
x_low, y_low = bootcamp_utils.ecdf(xa_low)
x = np.linspace(1600, 2500, 400)
cdf_high = scipy.stats.norm.cdf(x,
loc=np.mean(xa_high),
scale=np.std(xa_high))
cdf_low = scipy.stats.norm.cdf(x,
loc=np.mean(xa_low),
scale=np.std(xa_low))
plt.plot(x_high, y_high, marker='.', linestyle='none', markersize=20,
alpha=0.5)
plt.plot(x_low, y_low, marker='.', linestyle= 'none', markersize=20,
alpha=0.5)
plt.plot(x, cdf_high, color='gray')
plt.plot(x, cdf_low, color='grey')
plt.xlabel('Cross-sectional area ($\mu$m)')
plt.ylabel('eCDF')
plt.legend(('High Food', 'Low Food'), loc='lower right')
plt.show()