Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 13 additions & 1 deletion Examples/analysis_default_regression.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,14 @@ def main(args):
if __name__ == "__main__":
# define parser
parser = argparse.ArgumentParser()

# add arguments: output path
parser.add_argument(
"--path",
help="path to output file(s)",
type=str,
)

# add arguments: relative tolerance
# Identify whether the test is a restart test,
# if it is, use a 1e-12 tolerance for the restart checksum analysis
Expand All @@ -50,37 +52,47 @@ def main(args):
required=False,
default=default_tolerance,
)

# add arguments: skip fields
parser.add_argument(
"--skip-fields",
help="skip fields when comparing checksums",
action="store_true",
dest="skip_fields",
)

# add arguments: skip particles
parser.add_argument(
"--skip-particles",
help="skip particles when comparing checksums",
action="store_true",
dest="skip_particles",
)

# parse arguments
args = parser.parse_args()

# set args.format automatically
args.format = None # default
try:
yt.load(args.path)
except Exception:
try:
OpenPMDTimeSeries(args.path)
except Exception:
print("Could not open the file as a plotfile or an openPMD time series")
pass # neither format matched
else:
args.format = "openpmd"
else:
args.format = "plotfile"
if args.format is None:
raise ValueError(f"Could not detect format for path: {args.path}")

# set args.do_fields (not parsed, based on args.skip_fields)
args.do_fields = False if args.skip_fields else True

# set args.do_particles (not parsed, based on args.skip_particles)
args.do_particles = False if args.skip_particles else True

# execute main function
main(args)
Loading