aboutsummaryrefslogtreecommitdiff
path: root/Tools/plot_parallel.py
diff options
context:
space:
mode:
authorGravatar Dave Grote <grote1@llnl.gov> 2019-09-18 13:28:56 -0700
committerGravatar Dave Grote <grote1@llnl.gov> 2019-09-18 13:28:56 -0700
commit7e462e9a62cd4c5abab6c4ed916cff102b83a1cf (patch)
tree5ecf029a89ed47bd0913880a66c527817ddb6370 /Tools/plot_parallel.py
parent3137ac637dd4b6fea7e4fd5df571f1ef524c9396 (diff)
downloadWarpX-7e462e9a62cd4c5abab6c4ed916cff102b83a1cf.tar.gz
WarpX-7e462e9a62cd4c5abab6c4ed916cff102b83a1cf.tar.zst
WarpX-7e462e9a62cd4c5abab6c4ed916cff102b83a1cf.zip
Generalized plot_Ey_max_evolution in plot_parallel.py
Diffstat (limited to 'Tools/plot_parallel.py')
-rw-r--r--Tools/plot_parallel.py20
1 files changed, 10 insertions, 10 deletions
diff --git a/Tools/plot_parallel.py b/Tools/plot_parallel.py
index f2f2c7ecf..56b243aca 100644
--- a/Tools/plot_parallel.py
+++ b/Tools/plot_parallel.py
@@ -20,7 +20,7 @@ between MPI ranks.
This script also proposes an option to plot one quantity over all timesteps.
The data of all plotfiles are gathered to rank 0, and the quantity evolution
is plotted and saved to file. For the illustration, this quantity is the max
-of Ey. Use " --plot_Ey_max_evolution " to activate this option.
+of Ey. Use " --plot_max_evolution Ey" to activate this option.
To get help, run
> python plot_parallel --help
@@ -47,10 +47,11 @@ parser.add_argument('--parallel', dest='parallel', action='store_true', default=
help='whether or not to do the analysis in parallel (e.g., 1 plotfile per MPI rank)')
parser.add_argument('--species', dest='pslist', nargs='+', type=str, default=None,
help='Species to be plotted, e.g., " --species beam plasma_e ". By default, all species in the simulation are shown')
-parser.add_argument('--plot_Ey_max_evolution', dest='plot_Ey_max_evolution', action='store_true', default=False,
- help='Whether to plot evolution of max(Ey) to illustrate how to plot one quantity across all plotfiles.')
+parser.add_argument('--plot_max_evolution', type=str, default=None,
+ help='Quantity to plot the max of across all data files')
args = parser.parse_args()
+plot_max_evolution = args.plot_max_evolution
# Sanity check
if int(sys.version[0]) != 3:
print('WARNING: Parallel analysis was only tested with Python3')
@@ -162,15 +163,14 @@ def plot_field_max(zwin_arr, maxF_arr):
plt.figure()
plt.plot(zwin_arr, maxF_arr)
plt.xlabel('z (m)')
- plt.ylabel('Field (S.I.)')
+ plt.ylabel('%s (S.I.)'%plot_max_evolution)
plt.title('Field max evolution')
- plt.savefig('max_field_evolution.pdf', bbox_inches='tight')
+ plt.savefig('max_%s_evolution.pdf'%plot_max_evolution, bbox_inches='tight')
### Analysis ###
# Get list of plotfiles
plotlib = args.plotlib
-plot_Ey_max_evolution = args.plot_Ey_max_evolution
file_list = glob.glob(args.path + '/plt?????')
file_list.sort()
nfiles = len(file_list)
@@ -194,7 +194,7 @@ if rank == 0:
print('Number of plotfiles: %s'%nfiles)
print('list of species: ', pslist)
-if plot_Ey_max_evolution:
+if plot_max_evolution is not None:
# Fill with a value less than any possible value
zwin = np.full(nfiles, np.finfo(float).min)
maxF = np.full(nfiles, np.finfo(float).min)
@@ -207,10 +207,10 @@ for count, filename in enumerate(file_list):
continue
plot_snapshot( filename )
- if plot_Ey_max_evolution:
- zwin[count], maxF[count] = get_field_max( filename, 'Ey' )
+ if plot_max_evolution is not None:
+ zwin[count], maxF[count] = get_field_max( filename, plot_max_evolution )
-if plot_Ey_max_evolution:
+if plot_max_evolution is not None:
if size > 1:
global_zwin = np.empty_like(zwin)
global_maxF = np.empty_like(maxF)