time average made possible
This commit is contained in:
+45
-13
@@ -6,7 +6,7 @@ import argparse
|
||||
import time
|
||||
import numpy as np
|
||||
import disk_postprocess as dp
|
||||
|
||||
from functools import reduce
|
||||
|
||||
storage_in = "/home/nbrucy/simus/"
|
||||
storage_out = "/home/nbrucy/visus/"
|
||||
@@ -97,6 +97,10 @@ parser.add_argument(
|
||||
"-z", help="z position of the central point", type=float, default=1.0
|
||||
)
|
||||
|
||||
parser.add_argument(
|
||||
"-ta", "--time_avg", help="Plot time averaged comparaison", action="store_true"
|
||||
)
|
||||
|
||||
|
||||
parser.add_argument(
|
||||
"--colormap", help="Colormap used", choices=dp.P.colormaps(), default="plasma"
|
||||
@@ -125,6 +129,9 @@ dp.out_ext = "." + args.format
|
||||
dp.P.rcParams["image.cmap"] = args.colormap
|
||||
dp.P.rcParams["savefig.dpi"] = args.dpi
|
||||
|
||||
# List of id that were successfully computed
|
||||
run_succeded = {}
|
||||
|
||||
for run in runs:
|
||||
path_suffix = project + "/" + run
|
||||
path_in = storage_in + path_suffix
|
||||
@@ -138,6 +145,8 @@ for run in runs:
|
||||
except:
|
||||
pass
|
||||
|
||||
run_succeded[run] = []
|
||||
|
||||
for i in range(first, last + 1, step):
|
||||
failures = 0
|
||||
success = False
|
||||
@@ -196,8 +205,10 @@ for run in runs:
|
||||
interactive=args.interactive,
|
||||
)
|
||||
print("[{}, {}] pdf computed".format(run, i))
|
||||
# If we are here, success !
|
||||
success = True
|
||||
except ValueError as e:
|
||||
run_succeded[run].append(i)
|
||||
except (ValueError, IOError) as e:
|
||||
print(e)
|
||||
if args.watch and failures < args.allowed_failures:
|
||||
failures = failures + 1
|
||||
@@ -212,24 +223,45 @@ for run in runs:
|
||||
else:
|
||||
raise
|
||||
if args.evolution:
|
||||
print("[{}] plotting evolution".format(run))
|
||||
dp.evolution(
|
||||
path_out,
|
||||
range(first, last + 1, step),
|
||||
run_succeded[run],
|
||||
force=args.force_redo,
|
||||
interactive=args.interactive,
|
||||
pdf=args.pdf,
|
||||
)
|
||||
print("[{}] evolution plotted".format(run))
|
||||
|
||||
if args.compare:
|
||||
path_suffix = project
|
||||
path = storage_out + path_suffix
|
||||
|
||||
for i in range(first, last + 1, step):
|
||||
dp.compare(
|
||||
path,
|
||||
runs,
|
||||
i,
|
||||
force=args.force_redo,
|
||||
interactive=args.interactive,
|
||||
Q_in_name=(not args.pdf),
|
||||
pdf=args.pdf,
|
||||
)
|
||||
if args.time_avg:
|
||||
# Select output availables for all runs
|
||||
output_ok = reduce(np.intersect1d, [run_succeded[run] for run in runs])
|
||||
print(output_ok)
|
||||
if len(output_ok) >= 1:
|
||||
dp.compare(
|
||||
path,
|
||||
runs,
|
||||
output_ok,
|
||||
force=args.force_redo,
|
||||
interactive=args.interactive,
|
||||
Q_in_name=(not args.pdf),
|
||||
pdf=args.pdf,
|
||||
)
|
||||
else:
|
||||
for i in range(first, last + 1, step):
|
||||
# Select usable runs
|
||||
runs_ok = [run for run in runs if i in run_succeded[run]]
|
||||
if len(runs_ok) > 1:
|
||||
dp.compare(
|
||||
path,
|
||||
runs_ok,
|
||||
i,
|
||||
force=args.force_redo,
|
||||
interactive=args.interactive,
|
||||
Q_in_name=(not args.pdf),
|
||||
pdf=args.pdf,
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user