-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathpltpnts.py
More file actions
90 lines (77 loc) · 2.85 KB
/
pltpnts.py
File metadata and controls
90 lines (77 loc) · 2.85 KB
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
import os
import sys
import numpy as np
import matplotlib.pyplot as plt
from matplotlib.pyplot import figure
#-------------------------------------------------------
# INPUT PARAMETERS
#-------------------------------------------------------
scale = float(sys.argv[1]) #parameter that scales the plot
area = np.pi* float(sys.argv[2]) #controls the size of the particle
v = 3
while (v < len(sys.argv)):
var = sys.argv[v]
#-------------------------------------------------------
# CREATING A PATH DIRECTORY TO EXPORT PICS
#-------------------------------------------------------
path = "sim/out/" + var + "_jpg"
try:
os.mkdir(path)
except OSError:
print ("Creation of the directory %s failed" % path)
else:
print ("Successfully created the directory %s " % path)
#-------------------------------------------------------
# SETTING FIGURE SIZE AND LIMITS
#-------------------------------------------------------
pltctrl = 'sim/out/pltctrl.txt'
pltctrltype=[int, int, float, float, float, float]
pltctrlnames = ["A", "B", "C", "D", "E", "F"]
ary1 = np.genfromtxt(pltctrl, names=pltctrlnames, dtype=pltctrltype)
print(ary1)
nt = ary1['A']
inc = ary1['B']
num = inc
xmin = ary1['C']
xmax = ary1['D']
ymin = ary1['E']
ymax = ary1['F']
L = 1.25*scale*(xmax-xmin)
W = scale*(ymax-ymin)
figure(figsize=(L, W), dpi=80)
#-------------------------------------------------------
# PLOTTING DATA AND EXPORTING TO JPG
#-------------------------------------------------------
n = 1
while (num <= nt):
if num < 10:
fname = 'sim/out/'+var+'_txt/'+var+'00'+str(num)+'.txt'
if num < 100 and num >= 10:
fname = 'sim/out/'+var+'_txt/'+var+'0'+str(num)+'.txt'
if num >= 100:
fname = 'sim/out/'+var+'_txt/'+var+str(num)+'.txt'
ndtype=[float, float, float, float]
names = ["A", "B", "V", "D"]
ary = np.genfromtxt(fname, names=names, dtype=ndtype)
x = ary['A']
y = ary['B']
val = ary['D']
Nx = np.size(ary['A'])
plt.scatter(x, y, s=area, c=val, alpha=1, cmap='jet');
plt.title(var)
plt.colorbar()
plt.savefig('sim/out/'+var+'_jpg/'+var+str(n)+".jpg")
#if n < 10:
# plt.savefig('pictures/'+var+'_jpg/'+var+'0000'+str(n)+".jpg")
#if n < 100 and n >= 10:
# plt.savefig('pictures/'+var+'_jpg/'+var+'000'+str(n)+".jpg")
#if n < 1000 and n >= 100:
# plt.savefig('pictures/'+var+'_jpg/'+var+'00'+str(n)+".jpg")
#if n < 10000 and n >= 1000:
# plt.savefig('pictures/'+var+'_jpg/'+var+'0'+str(n)+".jpg")
#if n >= 10000:
# plt.savefig('pictures/'+var+'_jpg/'+var+str(n)+".jpg")
plt.clf()
n = n + 1
num = num + inc
v = v + 1