Page Menu
Home
c4science
Search
Configure Global Search
Log In
Files
F61296164
prof.py
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Subscribers
None
File Metadata
Details
File Info
Storage
Attached
Created
Sun, May 5, 18:51
Size
2 KB
Mime Type
text/x-python
Expires
Tue, May 7, 18:51 (2 d)
Engine
blob
Format
Raw Data
Handle
17492212
Attached To
rFUTILS futils
prof.py
View Options
#
# @file prof.py
#
# @brief
#
# @copyright
# Copyright (©) 2021 EPFL (Ecole Polytechnique Fédérale de Lausanne)
# SPC (Swiss Plasma Center)
#
# futils is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the Free
# Software Foundation, either version 3 of the License, or (at your option)
# any later version.
#
# futils is distributed in the hope that it will be useful, but WITHOUT ANY
# WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>.
#
# @authors
# (in alphabetical order)
# @author Trach-Minh Tran <trach-minh.tran@epfl.ch>
#
#!/usr/bin/env python
import
h5py
import
numpy
#from pylab import *
#from matplotlib.pylab import *
from
matplotlib.pyplot
import
*
f
=
h5py
.
File
(
"prof.h5"
,
"r"
)
timeid
=
f
[
'/profile_1d/time'
]
xid
=
f
[
'/profile_1d/xgrid'
]
phiid
=
f
[
'/profile_1d/phi'
]
timeid
=
f
[
'/profile_2d/time'
]
xgid
=
f
[
'/profile_2d/xg'
]
ygid
=
f
[
'/profile_2d/yg'
]
phi2id
=
f
[
'/profile_2d/phi'
]
title_ann
=
f
[
'/'
]
.
attrs
[
'title'
]
time_ann
=
timeid
.
attrs
[
'title'
]
x_ann
=
xid
.
attrs
[
'title'
]
phi_ann
=
phiid
.
attrs
[
'title'
]
#
# Profiles of 1D potential
hold
(
True
)
nsteps
=
numpy
.
size
(
timeid
)
for
i
in
range
(
10
):
label
=
"t=
%.1f
"
%
(
timeid
[
i
],)
plot
(
xid
[:],
phiid
[
i
,:],
label
=
label
)
legend
(
loc
=
'best'
)
xlabel
(
x_ann
)
ylabel
(
phi_ann
)
title
(
title_ann
)
#
# Time evolution of 1D phi at some positions x
figure
()
hold
(
True
)
n
=
numpy
.
size
(
xid
)
for
i
in
range
(
0
,
n
/
2
,
8
):
plot
(
timeid
[:
10
],
phiid
[:
10
,
i
],
label
=
"X=
%.2f
"
%
xid
[
i
])
legend
(
loc
=
'best'
)
xlabel
(
time_ann
)
ylabel
(
phi_ann
)
title
(
title_ann
)
grid
(
True
)
#
# Contour plots of phi(x,t)
figure
()
hold
(
True
)
#contourf(xid[:],timeid[:],phiid[:,:],10)
cset
=
contour
(
xid
[:],
timeid
[:
10
],
phiid
[:
10
,:],
10
,
linewidths
=
2
)
clabel
(
cset
,
inline
=
1
,
fmt
=
'
%1.1f
'
,
fontsize
=
10
)
#hot()
#colorbar()
xlabel
(
time_ann
)
ylabel
(
x_ann
)
title
(
phi_ann
)
show
()
Event Timeline
Log In to Comment