Skip to content

Commit 9869d24

Browse files
transferred scripts from separate repo
1 parent e50cffb commit 9869d24

14 files changed

Lines changed: 1068 additions & 0 deletions
1.97 KB
Binary file not shown.
8.16 KB
Binary file not shown.
545 Bytes
Binary file not shown.

python/combined_template.xml

Lines changed: 197 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,197 @@
1+
<svg id="main-plot" baseProfile="full" version="1.1" xmlns="http://www.w3.org/2000/svg"
2+
font-family="Helvetica" style="height: 50vh; max-width: 100%; overflow: hide;"
3+
viewBox="0 0 460 300">
4+
<g transform="translate(0 265)" fill="none" font-size="10" font-family="sans-serif"
5+
text-anchor="middle">
6+
<path class="domain" stroke="currentColor" d="M40.5,-6V0.5H290.5V-6"></path>
7+
<g class="tick" opacity="1" transform="translate(40.5,0)">
8+
<line stroke="currentColor" y2="-6"></line>
9+
<text fill="currentColor" y="-9" dy="0em"></text>
10+
</g>
11+
<g class="tick" opacity="1" transform="translate(65.5,0)">
12+
<line stroke="currentColor" y2="-6"></line>
13+
<text fill="currentColor" y="-9" dy="0em"></text>
14+
</g>
15+
<g class="tick" opacity="1" transform="translate(90.5,0)">
16+
<line stroke="currentColor" y2="-6"></line>
17+
<text fill="currentColor" y="-9" dy="0em"></text>
18+
</g>
19+
<g class="tick" opacity="1" transform="translate(115.5,0)">
20+
<line stroke="currentColor" y2="-6"></line>
21+
<text fill="currentColor" y="-9" dy="0em"></text>
22+
</g>
23+
<g class="tick" opacity="1" transform="translate(140.5,0)">
24+
<line stroke="currentColor" y2="-6"></line>
25+
<text fill="currentColor" y="-9" dy="0em"></text>
26+
</g>
27+
<g class="tick" opacity="1" transform="translate(165.5,0)">
28+
<line stroke="currentColor" y2="-6"></line>
29+
<text fill="currentColor" y="-9" dy="0em"></text>
30+
</g>
31+
<g class="tick" opacity="1" transform="translate(190.5,0)">
32+
<line stroke="currentColor" y2="-6"></line>
33+
<text fill="currentColor" y="-9" dy="0em"></text>
34+
</g>
35+
<g class="tick" opacity="1" transform="translate(215.5,0)">
36+
<line stroke="currentColor" y2="-6"></line>
37+
<text fill="currentColor" y="-9" dy="0em"></text>
38+
</g>
39+
<g class="tick" opacity="1" transform="translate(240.5,0)">
40+
<line stroke="currentColor" y2="-6"></line>
41+
<text fill="currentColor" y="-9" dy="0em"></text>
42+
</g>
43+
<g class="tick" opacity="1" transform="translate(265.5,0)">
44+
<line stroke="currentColor" y2="-6"></line>
45+
<text fill="currentColor" y="-9" dy="0em"></text>
46+
</g>
47+
<g class="tick" opacity="1" transform="translate(290.5,0)">
48+
<line stroke="currentColor" y2="-6"></line>
49+
<text fill="currentColor" y="-9" dy="0em"></text>
50+
</g>
51+
</g>
52+
<g transform="translate(0 30)" fill="none" font-size="10" font-family="sans-serif"
53+
text-anchor="middle">
54+
<path class="domain" stroke="currentColor" d="M40.5,6V0.5H290.5V6"></path>
55+
<g class="tick" opacity="1" transform="translate(40.5,0)">
56+
<line stroke="currentColor" y2="6"></line>
57+
<text fill="currentColor" y="9" dy="0.71em"></text>
58+
</g>
59+
<g class="tick" opacity="1" transform="translate(65.5,0)">
60+
<line stroke="currentColor" y2="6"></line>
61+
<text fill="currentColor" y="9" dy="0.71em"></text>
62+
</g>
63+
<g class="tick" opacity="1" transform="translate(90.5,0)">
64+
<line stroke="currentColor" y2="6"></line>
65+
<text fill="currentColor" y="9" dy="0.71em"></text>
66+
</g>
67+
<g class="tick" opacity="1" transform="translate(115.5,0)">
68+
<line stroke="currentColor" y2="6"></line>
69+
<text fill="currentColor" y="9" dy="0.71em"></text>
70+
</g>
71+
<g class="tick" opacity="1" transform="translate(140.5,0)">
72+
<line stroke="currentColor" y2="6"></line>
73+
<text fill="currentColor" y="9" dy="0.71em"></text>
74+
</g>
75+
<g class="tick" opacity="1" transform="translate(165.5,0)">
76+
<line stroke="currentColor" y2="6"></line>
77+
<text fill="currentColor" y="9" dy="0.71em"></text>
78+
</g>
79+
<g class="tick" opacity="1" transform="translate(190.5,0)">
80+
<line stroke="currentColor" y2="6"></line>
81+
<text fill="currentColor" y="9" dy="0.71em"></text>
82+
</g>
83+
<g class="tick" opacity="1" transform="translate(215.5,0)">
84+
<line stroke="currentColor" y2="6"></line>
85+
<text fill="currentColor" y="9" dy="0.71em"></text>
86+
</g>
87+
<g class="tick" opacity="1" transform="translate(240.5,0)">
88+
<line stroke="currentColor" y2="6"></line>
89+
<text fill="currentColor" y="9" dy="0.71em"></text>
90+
</g>
91+
<g class="tick" opacity="1" transform="translate(265.5,0)">
92+
<line stroke="currentColor" y2="6"></line>
93+
<text fill="currentColor" y="9" dy="0.71em"></text>
94+
</g>
95+
<g class="tick" opacity="1" transform="translate(290.5,0)">
96+
<line stroke="currentColor" y2="6"></line>
97+
<text fill="currentColor" y="9" dy="0.71em"></text>
98+
</g>
99+
</g>
100+
<g transform="translate(40 0)" fill="none" font-size="10" font-family="sans-serif"
101+
text-anchor="start">
102+
<path class="domain" stroke="currentColor" d="M6,265.5H0.5V30.5H6"></path>
103+
<g class="tick" opacity="1" transform="translate(0,265.5)">
104+
<line stroke="currentColor" x2="6"></line>
105+
<text fill="currentColor" x="9" dy="0.32em"></text>
106+
</g>
107+
<g class="tick" opacity="1" transform="translate(0,242)">
108+
<line stroke="currentColor" x2="6"></line>
109+
<text fill="currentColor" x="9" dy="0.32em"></text>
110+
</g>
111+
<g class="tick" opacity="1" transform="translate(0,218.5)">
112+
<line stroke="currentColor" x2="6"></line>
113+
<text fill="currentColor" x="9" dy="0.32em"></text>
114+
</g>
115+
<g class="tick" opacity="1" transform="translate(0,195)">
116+
<line stroke="currentColor" x2="6"></line>
117+
<text fill="currentColor" x="9" dy="0.32em"></text>
118+
</g>
119+
<g class="tick" opacity="1" transform="translate(0,171.5)">
120+
<line stroke="currentColor" x2="6"></line>
121+
<text fill="currentColor" x="9" dy="0.32em"></text>
122+
</g>
123+
<g class="tick" opacity="1" transform="translate(0,148)">
124+
<line stroke="currentColor" x2="6"></line>
125+
<text fill="currentColor" x="9" dy="0.32em"></text>
126+
</g>
127+
<g class="tick" opacity="1" transform="translate(0,124.5)">
128+
<line stroke="currentColor" x2="6"></line>
129+
<text fill="currentColor" x="9" dy="0.32em"></text>
130+
</g>
131+
<g class="tick" opacity="1" transform="translate(0,101.00000000000001)">
132+
<line stroke="currentColor" x2="6"></line>
133+
<text fill="currentColor" x="9" dy="0.32em"></text>
134+
</g>
135+
<g class="tick" opacity="1" transform="translate(0,77.49999999999999)">
136+
<line stroke="currentColor" x2="6"></line>
137+
<text fill="currentColor" x="9" dy="0.32em"></text>
138+
</g>
139+
<g class="tick" opacity="1" transform="translate(0,53.99999999999999)">
140+
<line stroke="currentColor" x2="6"></line>
141+
<text fill="currentColor" x="9" dy="0.32em"></text>
142+
</g>
143+
<g class="tick" opacity="1" transform="translate(0,30.5)">
144+
<line stroke="currentColor" x2="6"></line>
145+
<text fill="currentColor" x="9" dy="0.32em"></text>
146+
</g>
147+
</g>
148+
<g transform="translate(290 0)" fill="none" font-size="10" font-family="sans-serif"
149+
text-anchor="end">
150+
<path class="domain" stroke="currentColor" d="M-6,265.5H0.5V30.5H-6"></path>
151+
<g class="tick" opacity="1" transform="translate(0,265.5)">
152+
<line stroke="currentColor" x2="-6"></line>
153+
<text fill="currentColor" x="-9" dy="0.32em"></text>
154+
</g>
155+
<g class="tick" opacity="1" transform="translate(0,242)">
156+
<line stroke="currentColor" x2="-6"></line>
157+
<text fill="currentColor" x="-9" dy="0.32em"></text>
158+
</g>
159+
<g class="tick" opacity="1" transform="translate(0,218.5)">
160+
<line stroke="currentColor" x2="-6"></line>
161+
<text fill="currentColor" x="-9" dy="0.32em"></text>
162+
</g>
163+
<g class="tick" opacity="1" transform="translate(0,195)">
164+
<line stroke="currentColor" x2="-6"></line>
165+
<text fill="currentColor" x="-9" dy="0.32em"></text>
166+
</g>
167+
<g class="tick" opacity="1" transform="translate(0,171.5)">
168+
<line stroke="currentColor" x2="-6"></line>
169+
<text fill="currentColor" x="-9" dy="0.32em"></text>
170+
</g>
171+
<g class="tick" opacity="1" transform="translate(0,148)">
172+
<line stroke="currentColor" x2="-6"></line>
173+
<text fill="currentColor" x="-9" dy="0.32em"></text>
174+
</g>
175+
<g class="tick" opacity="1" transform="translate(0,124.5)">
176+
<line stroke="currentColor" x2="-6"></line>
177+
<text fill="currentColor" x="-9" dy="0.32em"></text>
178+
</g>
179+
<g class="tick" opacity="1" transform="translate(0,101.00000000000001)">
180+
<line stroke="currentColor" x2="-6"></line>
181+
<text fill="currentColor" x="-9" dy="0.32em"></text>
182+
</g>
183+
<g class="tick" opacity="1" transform="translate(0,77.49999999999999)">
184+
<line stroke="currentColor" x2="-6"></line>
185+
<text fill="currentColor" x="-9" dy="0.32em"></text>
186+
</g>
187+
<g class="tick" opacity="1" transform="translate(0,53.99999999999999)">
188+
<line stroke="currentColor" x2="-6"></line>
189+
<text fill="currentColor" x="-9" dy="0.32em"></text>
190+
</g>
191+
<g class="tick" opacity="1" transform="translate(0,30.5)">
192+
<line stroke="currentColor" x2="-6"></line>
193+
<text fill="currentColor" x="-9" dy="0.32em"></text>
194+
</g>
195+
</g>
196+
<line x1="165" x2="165" y1="265" y2="30" stroke="gray" stroke-width="1" stroke-dasharray="5,5"
197+
opacity="0.5"></line>

python/composite.py

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
import numpy as np
2+
import csv
3+
import xml.dom.minidom as dom
4+
import argparse
5+
import math
6+
7+
class Composite:
8+
def __init__(self, xmin=None, xmax=None, sense=[], anti=[]):
9+
self.xmin = xmin
10+
self.xmax = xmax
11+
self.sense = sense
12+
self.anti = anti
13+
14+
def __str__(self):
15+
return "Sense: " + str(self.sense) + "\nAnti: " + str(self.anti) + "\nXMin: " + str(self.xmin) + "\nXMax: " + str(self.xmax)
16+
17+
def parseComposite(file):
18+
fileArr = open(file, "r").read().split("\n")
19+
xmin = None
20+
xmax = None
21+
sense = []
22+
anti = []
23+
xmin_curr = 0
24+
xmax_curr = 0
25+
offset = 0
26+
for line in fileArr:
27+
print("line")
28+
# Skip empty
29+
if len(line.strip()) == 0 :
30+
continue
31+
# Separate fields
32+
fields = line.split("\t")
33+
if fields[0] == "" or fields[0] == "NAME":
34+
print("name")
35+
xmin_curr = int(float(fields[1]))
36+
xmax_curr = int(float(fields[-1]))
37+
# If the x domain starts at 0 shift it to the left
38+
if xmin_curr == 0:
39+
xmin_curr -= math.floor(xmax_curr / 2)
40+
xmax_curr -= math.floor(xmax_curr / 2)
41+
# If the x domain is not defined yet, define it
42+
if xmin == None or xmax == None:
43+
xmin = xmin_curr
44+
xmax = xmax_curr
45+
# Redefine min and max if necessary
46+
xmax = max(xmax_curr, xmax)
47+
xmin = min(xmin_curr, xmin)
48+
sense = [0] * (xmax - xmin + 1)
49+
anti = [0] * (xmax - xmin + 1)
50+
51+
# Add the values to sense and anti arrays
52+
if "sense" in fields[0].lower():
53+
print("sense")
54+
i = 1
55+
while i < len(fields):
56+
sense[offset + i - 1] += float(fields[i])
57+
i += 1
58+
elif "anti" in fields[0].lower():
59+
i = 1
60+
while i < len(fields):
61+
anti[offset + i - 1] += float(fields[i])
62+
i += 1
63+
# If the first field is not empty or "NAME" and does not contain "sense" or "anti" parse as combined or midpoint data
64+
elif not (fields[0] == "" or fields[0] == "NAME"):
65+
i = 1
66+
while i < len(fields):
67+
sense[offset + i - 1] += float(fields[i]) / 2
68+
anti[offset + i - 1] += float(fields[i]) / 2
69+
return Composite(xmin, xmax, sense, anti)
70+
71+
72+
def main():
73+
c = parseComposite("sample.out")
74+
print(c)
75+
76+
if __name__ == "__main__":
77+
main()

python/composite_average copy.out

Lines changed: 9 additions & 0 deletions
Large diffs are not rendered by default.

python/composite_average.out

Lines changed: 9 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)