Skip to content

Commit

Permalink
modified how to separate last_fn into prefix and last_it.
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinRayAngus committed Aug 16, 2024
1 parent b6be1f5 commit 1a6826b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 14 deletions.
12 changes: 5 additions & 7 deletions Examples/Tests/collision/analysis_collision_2d.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@
b = -0.11588277796546632

last_fn = sys.argv[1]
# Remove trailing '/' from file name, if necessary
last_fn.rstrip('/')
# Find last iteration in file name, such as 'test_name_plt000001' (last_it = '000001')
last_it = re.search('\d+', last_fn).group()
# Find output prefix in file name, such as 'test_name_plt000001' (prefix = 'test_name_plt')
prefix = last_fn[:-len(last_it)]
if (last_fn[-1] == "/"): last_fn = last_fn[:-1]
last_it = last_fn[-6:] # i.e., 000150
prefix = last_fn[:-6] # i.e., diags/diag1

# Collect all output files in fn_list (names match pattern prefix + arbitrary number)
fn_list = glob.glob(prefix + '*[0-9]')

Expand Down Expand Up @@ -92,7 +90,7 @@
if "Python" in last_fn:
exit()

## In the second past of the test, we verify that the diagnostic particle filter function works as
## In the second part of the test, we verify that the diagnostic particle filter function works as
## expected. For this, we only use the last simulation timestep.

dim = "2d"
Expand Down
12 changes: 5 additions & 7 deletions Examples/Tests/collision/analysis_collision_3d.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,12 +55,10 @@
b = -0.083851393560288

last_fn = sys.argv[1]
# Remove trailing '/' from file name, if necessary
last_fn.rstrip('/')
# Find last iteration in file name, such as 'test_name_plt000001' (last_it = '000001')
last_it = re.search('\d+', last_fn).group()
# Find output prefix in file name, such as 'test_name_plt000001' (prefix = 'test_name_plt')
prefix = last_fn[:-len(last_it)]
if (last_fn[-1] == "/"): last_fn = last_fn[:-1]
last_it = last_fn[-6:] # i.e., 000150
prefix = last_fn[:-6] # i.e., diags/diag1

# Collect all output files in fn_list (names match pattern prefix + arbitrary number)
fn_list = glob.glob(prefix + '*[0-9]')

Expand Down Expand Up @@ -89,7 +87,7 @@
assert(error < tolerance)


## In the second past of the test, we verify that the diagnostic particle filter function works as
## In the second part of the test, we verify that the diagnostic particle filter function works as
## expected. For this, we only use the last simulation timestep.

dim = "3d"
Expand Down

0 comments on commit 1a6826b

Please sign in to comment.