-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsieveAnalysis.py
103 lines (77 loc) · 2.12 KB
/
sieveAnalysis.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
import plotly
import plotly.plotly as py
import plotly.graph_objs as go
import xml.etree.ElementTree as ET
import tkinter as tk
from tkinter import filedialog
root = tk.Tk()
root.withdraw()
version = input("Enter the Diggs schema version (eg '2.0.b'):")
print (version)
address = '{http://diggsml.org/schemas/' + version +'}'
address2= '{http://diggsml.org/schemas/' + version +'/geotechnical}'
user = input("Enter your plotly Username:")
print (user)
API = input("Enter your plotly API:")
print (API)
graphName = input("Enter the name for your graoh")
plotly.tools.set_credentials_file(username=user, api_key=API)
file_path = filedialog.askopenfilename()
tree = ET.parse(file_path)
root = tree.getroot()
names=[]
for test in root.iter(address+'Test'):
temp=str(test.attrib)
names.append(temp)
print(names)
sizesArrays = []
sizes=[]
i=0
j=0
for size in root.iter( address2 + 'particleSize'):
print(i)
if sizes != []:
if float(size.text) > sizes[len(sizes)-1]:
i += 1
j = 0
sizesArrays.append(sizes)
sizes=[]
sizes.append(float(size.text))
print(sizes)
print(sizesArrays)
passingArrays = []
i=0
j=0
percentPassing=[]
for passing in root.iter(address2 +'percentPassing'):
print(i)
if percentPassing != []:
if float(passing.text) > percentPassing[len(percentPassing) - 1]:
i += 1
j = 0
passingArrays.append(percentPassing)
percentPassing = []
percentPassing.append(float(passing.text))
print(percentPassing)
print(passingArrays)
i=0
data=[]
for x in range(0,len(names)-1):
trace=go.Scatter(
x = sizesArrays[i],
y = passingArrays[i],
name = names[i],
line = dict(
color = ('rgb(i*10,i*10,i*10)'),
width = 4
)
)
i+=1
data.append(trace)
layout = dict(title = 'Seive Analysis',
xaxis = dict(title = 'Sieve Size(mm)',
type = 'log'),
yaxis = dict(title = 'Percent Passing(%)'),
)
fig = dict(data=data,layout=layout)
py.iplot(fig, filename = graphName)