-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Add MPI box count tools * Minor typo * Fixed typo in processing.sh so that any number of levels is read correctly. Put into directory Boxcounter with README Co-authored-by: Amelia Drew <[email protected]>
- Loading branch information
amelialdrew
and
Amelia Drew
authored
Jun 3, 2021
1 parent
a85a8f7
commit fa2af5b
Showing
5 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
The bash script processing.sh takes a pout.0 from a run and parses it so that it is in a format that reads 'level, time, boxes on this proc, total boxes'. Run using './processing.sh' in the same directory as the pout.0 and it outputs pout.0_parsed | ||
|
||
This pout.0_parsed can then be processed by running 'python extractboxes.py' to plot the total number of boxes per refinement level. Must manually set max refinement level to plot in L16. Outputs a graph for each level i which includes all levels < i, easily modifiable. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import csv | ||
import matplotlib.pyplot as plt | ||
|
||
'''Run processing.sh with pout.0 - outputs level, time, boxes on proc 0, total boxes''' | ||
'''Only works on output with verbosity 0''' | ||
|
||
i=0 | ||
|
||
data = open('pout.0_parsed') | ||
with data as csvfile: | ||
filereader = csv.reader(csvfile, delimiter=',') | ||
timelist = [] #col 1 | ||
totalboxlist = [] #col 3 | ||
|
||
'''Hardcoded max level to plot''' | ||
while i < 10: | ||
for row in filereader: | ||
if int(row[0]) == i: | ||
'''Can input max time''' | ||
# if float(row[1]) < 300: | ||
timelist.append(float(row[1])) | ||
totalboxlist.append(int(row[3])) | ||
|
||
plt.plot(timelist, totalboxlist, label='%s' % i) | ||
plt.legend() | ||
plt.savefig('boxplot_level_%s.png' % i) | ||
|
||
timelist.clear() | ||
totalboxlist.clear() | ||
|
||
'''Resets file loop''' | ||
data.seek(0) | ||
|
||
i+=1 | ||
|
||
print('%s' % i) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
sed -n '/GRAMRLevel::/,$p' ./pout.0 > ./pout.0_temp | ||
sed -e 's!GRAMRLevel::advance level !!' ./pout.0_temp > ./pout.0_temp2 | ||
sed -r 's/\s+/, /' ./pout.0_temp2 > ./pout.0_temp | ||
sed -e 's!at time !!' ./pout.0_temp > ./pout.0_temp2 | ||
sed -e 's/ (.*:/,/' ./pout.0_temp2 > ./pout.0_temp | ||
sed -e 's/ \//,/' ./pout.0_temp > ./pout.0_parsed | ||
rm ./pout.0_temp ./pout.0_temp2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import csv | ||
import matplotlib.pyplot as plt | ||
|
||
'''Run processing.sh with pout.0 - outputs level, time, boxes on proc 0, total boxes''' | ||
'''Only works on output with verbosity 0''' | ||
|
||
i=0 | ||
|
||
data = open('pout.0_parsed') | ||
with data as csvfile: | ||
filereader = csv.reader(csvfile, delimiter=',') | ||
timelist = [] #col 1 | ||
totalboxlist = [] #col 3 | ||
|
||
'''Hardcoded max level to plot''' | ||
while i < 10: | ||
for row in filereader: | ||
if int(row[0]) == i: | ||
'''Can input max time''' | ||
# if float(row[1]) < 300: | ||
timelist.append(float(row[1])) | ||
totalboxlist.append(int(row[3])) | ||
|
||
plt.plot(timelist, totalboxlist, label='%s' % i) | ||
plt.legend() | ||
plt.savefig('boxplot_level_%s.png' % i) | ||
|
||
timelist.clear() | ||
totalboxlist.clear() | ||
|
||
'''Resets file loop''' | ||
data.seek(0) | ||
|
||
i+=1 | ||
|
||
print('%s' % i) | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
sed -n '/GRAMRLevel::/,$p' ./pout.0 > ./pout.0_temp | ||
sed -e 's!GRAMRLevel::advance level !!' ./pout.0_temp > ./pout.0_temp2 | ||
sed -r 's/\s+/, /' ./pout.0_temp2 > ./pout.0_temp | ||
sed -e 's!at time !!' ./pout.0_temp > ./pout.0_temp2 | ||
sed -e 's/ (.*:/,/' ./pout.0_temp2 > ./pout.0_temp | ||
sed -e 's/ \//,/' ./pout.0_temp > ./pout.0_parsed | ||
rm ./pout.0_temp ./pout.0_temp2 |