-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
51 lines (45 loc) · 845 Bytes
/
Copy pathtest.py
File metadata and controls
51 lines (45 loc) · 845 Bytes
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
#!/usr/bin/env python
import csv
import numpy as np
import matplotlib
matplotlib.use('Agg')
import matplotlib.pyplot as plt
gb=1024*1024*1024
x=np.arange(0,gb+1)
y=[0]*(gb+1)
with open('/share/pyi/zipfian_distribution/dataTest.txt', 'r') as csvfile:
plots = csv.reader(csvfile, delimiter='\n')
for row in plots:
j=map(int, row)[0]
y[j]+=1;
point20=0
cx=[]
cy=[]
s=0
flag=0
for i in range(0,2000000):
cy.append(y[i])
if flag==0:
s=s+y[i]
if s>=(gb/5):
point20=i
flag=1
cx.append(i)
print("point:")
print(point20)
print("0")
plt.figure()
print("1")
#plt.plot(x,y)
plt.plot(cx,cy)
print("2")
plt.title('Zipfian data gen Test')
print("3")
plt.xlabel('address')
print("4")
plt.ylabel('count')
print("5")
plt.savefig('subresult1.png')
print("6")
plt.close()
print("7")