-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplasma_beta.py
77 lines (60 loc) · 3.17 KB
/
plasma_beta.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
import os
import pandas as pd
import matplotlib as mpl
import matplotlib.pyplot as plt
import numpy as np
#To refresh data:
###On Andes:
#$cd /gpfs/alpine/ast154/scratch/sshanka/carpetx_github/CCSN_12000km_analysis
#$python copy_files.py
###On my laptop
#$cd /home/swapnnil/Desktop/000_carpetX/NERSC_GPU_Hackathon/Balsara_files/test-GRHydroX-GPU-1/CCSN_12000km_analysis
#$rsync -rtv [email protected]:/gpfs/alpine/ast154/scratch/sshanka/carpetx_github/CCSN_12000km_analysis/ .
hydro_vars = ["1:iteration", "2:time", "3:grhydrox::plasma_beta.min", "4:grhydrox::plasma_beta.max", "5:grhydrox::plasma_beta.sum", "6:grhydrox::plasma_beta.avg", "7:grhydrox::plasma_beta.stddev", "8:grhydrox::plasma_beta.volume", "9:grhydrox::plasma_beta.L1norm", "10:grhydrox::plasma_beta.L2norm", "11:grhydrox::plasma_beta.maxabs", "12:grhydrox::plasma_beta.minloc[0]", "13:grhydrox::plasma_beta.minloc[1]", "14:grhydrox::plasma_beta.minloc[2]", "15:grhydrox::plasma_beta.maxloc[0]", "16:grhydrox::plasma_beta.maxloc[1]", "17:grhydrox::plasma_beta.maxloc[2]"]
#------------------------------------------------------------------------------
#Determine the latest output number that is already present in out_path (files before that will not be copied)
var_name = "grhydrox-plasma_beta"
os.system("ls norms/ | grep {} > temp2.txt".format(var_name))
file1 = open('temp2.txt', 'r')
Lines = file1.readlines()
out_list = []
for line in Lines:
tempvar = int(line.strip().split('-')[3].split('.')[0])
out_list.append(tempvar)
latest_copied_output = 0
if(len(out_list) > 0):
latest_copied_output = max(out_list)
#------------------------------------------------------------------------------
plt.clf()
#TODO: Following parameters control plot characteristics
#------------------------------------------------------------------------------
#Do we want to see separation of different checkpoints?
separate_chkpts = False #True
display_physical_time = True
if display_physical_time:
time_factor = 203.0
offset = 71928/203.0
#plt.xlim(-0.4, 150)
plt.xlim(100, 160)
else:
time_factor = 1.0
offset = 0.0
plt.xlim(71800, 73500)
#------------------------------------------------------------------------------
plt.title("{}".format(var_name))
#plt.ylim(0.0004, 0.00063)
ring_marker_size = 40
dot_marker_size = 20
style = False #Always start with false so that dot is plotted first, especially when separate_chkpts=False
for output_number in range(59, latest_copied_output+1):
file_name = "norms/{}-output-{}.tsv".format(var_name, str(output_number).zfill(4))
data = pd.read_csv(file_name, sep='\t', names=hydro_vars, comment="#");
if style:
plt.scatter(data["2:time"]/time_factor-offset, data["3:grhydrox::plasma_beta.min"], s=ring_marker_size, marker="o", facecolors='none', edgecolors='b')
else:
#plt.scatter(data["2:time"]/time_factor-offset, data["3:grhydrox::plasma_beta.min"], s=dot_marker_size, marker=".", facecolors='r', edgecolors='r')
plt.semilogy(data["2:time"]/time_factor-offset, data["3:grhydrox::plasma_beta.min"], color='r')
#Only toggle styles if we want to separate checkpoints
if separate_chkpts:
style = not style
plt.show()