forked from Michael-Gong/visualization-script-for-LPI
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path3d_scatter_particle.py
93 lines (80 loc) · 2.8 KB
/
3d_scatter_particle.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
%matplotlib inline
#import sdf
import matplotlib
#matplotlib.use('agg')
import matplotlib.pyplot as plt
import numpy as np
from numpy import ma
from matplotlib import colors, ticker, cm
from matplotlib.mlab import bivariate_normal
from optparse import OptionParser
import os
from mpl_toolkits.mplot3d import Axes3D
import random
font = {'family' : 'monospace',
'color' : 'black',
'weight' : 'normal',
'size' : 20,
}
part_number=1000
nsteps=2
insert1='./Data/'
#t=np.loadtxt(insert+'t'+'.txt')
z1=np.loadtxt(insert1+'z'+'.txt')
y1=np.loadtxt(insert1+'y'+'.txt')
x1=np.loadtxt(insert1+'x'+'.txt')
#px=np.loadtxt(insert+'px'+'.txt')
#py=np.loadtxt(insert+'py'+'.txt')
#pz=np.loadtxt(insert+'pz'+'.txt')
#ey=np.loadtxt(insert+'e_part'+'.txt')
#bz=np.loadtxt(insert+'b_part'+'.txt')
#ay=np.loadtxt(insert+'a_part'+'.txt')
#radn=np.loadtxt(insert+'radn'+'.txt')
#radt=np.loadtxt(insert+'radt'+'.txt')
#opt=np.loadtxt(insert+'opt'+'.txt')
#eta=np.loadtxt(insert+'eta'+'.txt')
#t=np.reshape(t,(part_number,nsteps))
x1=np.reshape(x1,(part_number,nsteps))
y1=np.reshape(y1,(part_number,nsteps))
z1=np.reshape(z1,(part_number,nsteps))
#px=np.reshape(px,(part_number,nsteps))
#py=np.reshape(py,(part_number,nsteps))
#pz=np.reshape(pz,(part_number,nsteps))
#ey=np.reshape(ey,(part_number,nsteps))
#ay=np.reshape(ay,(part_number,nsteps))
#radn=np.reshape(radn,(part_number,nsteps))
#radt=np.reshape(radt,(part_number,nsteps))
#opt=np.reshape(opt,(part_number,nsteps))
#eta=np.reshape(eta,(part_number,nsteps))
#print(np.where(py[:,-1] > 0))
#gamma=np.sqrt(px**2+py**2+1)
insert1='./Data/'
#t=np.loadtxt(insert+'t'+'.txt')
z1=np.loadtxt(insert1+'z'+'.txt')
y1=np.loadtxt(insert1+'y'+'.txt')
x1=np.loadtxt(insert1+'x'+'.txt')
x1=np.reshape(x1,(part_number,nsteps))
y1=np.reshape(y1,(part_number,nsteps))
z1=np.reshape(z1,(part_number,nsteps))
insert2='./Datar_5/'
#t=np.loadtxt(insert+'t'+'.txt')
z2=np.loadtxt(insert2+'z'+'.txt')
y2=np.loadtxt(insert2+'y'+'.txt')
x2=np.loadtxt(insert2+'x'+'.txt')
x2=np.reshape(x2,(part_number,nsteps))
y2=np.reshape(y2,(part_number,nsteps))
z2=np.reshape(z2,(part_number,nsteps))
makersize=20
fig = plt.figure()
ax = Axes3D(fig)
ax.scatter(x1[:,-1]/2/np.pi,y1[:,-1]/2/np.pi,z1[:,-1]/2/np.pi,s=makersize,depthshade=True,c=(192/255.0,0,0),edgecolor='none')
#ax.scatter(x1[:,0]/2/np.pi,y1[:,0]/2/np.pi,z1[:,0]/2/np.pi,s=makersize,depthshade=True,c=(192/255.0,0,0),edgecolor='none')
ax.scatter(x2[:,-1]/2/np.pi,y2[:,-1]/2/np.pi,z2[:,-1]/2/np.pi,s=makersize,depthshade=True,c=(0,192/255.0,0),edgecolor='none')
#ax.scatter(x2[:,0]/2/np.pi,y2[:,0]/2/np.pi,z2[:,0]/2/np.pi,s=makersize,depthshade=True,c=(192/255.0,0,0),edgecolor='none')
ax.set_xlabel('X Label')
ax.set_ylabel('Y Label')
ax.set_zlabel('Z Label')
ax.set_xlim([0,100])
ax.set_ylim([-50,50])
ax.set_zlim([-50,50])
ax.view_init(elev=30, azim=-60)