-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
switch NFSim_test1 to python script for portability
- Loading branch information
Showing
3 changed files
with
68 additions
and
61 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import subprocess | ||
import sys | ||
|
||
# get the directory of this script | ||
test_dir = os.path.dirname(os.path.realpath(__file__)) | ||
|
||
exe = sys.argv[1] | ||
|
||
input_file = os.path.join(test_dir, "SimID_273069657_0_.nfsimInput") | ||
output = os.path.join(test_dir, "SimID_273069657_0_.gdat") | ||
expected_output = os.path.join(test_dir, "SimID_273069657_0_.gdat.expected") | ||
species = os.path.join(test_dir, "SimID_273069657_0_.species") | ||
expected_species = os.path.join(test_dir, "SimID_273069657_0_.species.expected") | ||
|
||
if not os.path.isfile(exe): | ||
print(f"NFsim executable {exe} not found. Exiting...") | ||
sys.exit(1) | ||
|
||
if not os.path.isfile(input_file): | ||
print(f"Input file {input_file} not found. Exiting...") | ||
sys.exit(1) | ||
|
||
if not os.path.isfile(expected_output): | ||
print(f"Expected output file {expected_output} not found. Exiting...") | ||
sys.exit(1) | ||
|
||
if not os.path.isfile(expected_species): | ||
print(f"Expected species file {expected_species} not found. Exiting...") | ||
sys.exit(1) | ||
|
||
command = [exe, "-seed", "505790288", "-vcell", "-xml", input_file, "-o", output, "-sim", "1.0", "-ss", species, "-oStep", "20", "-notf", "-utl", "1000", "-cb", "-pcmatch", "-tid", "0"] | ||
print(" ".join(command)) | ||
|
||
try: | ||
subprocess.check_call(command) | ||
except subprocess.CalledProcessError: | ||
print("NFsim failed to run. Exiting...") | ||
sys.exit(1) | ||
|
||
# verify that the output files exist | ||
if not os.path.isfile(output): | ||
print(f"Output file {output} not found. Exiting...") | ||
sys.exit(1) | ||
|
||
if not os.path.isfile(species): | ||
print(f"Species file {species} not found. Exiting...") | ||
sys.exit(1) | ||
|
||
# verify that the output files match the expected output files | ||
if open(output).read() != open(expected_output).read(): | ||
print(f"Output file {output} does not match expected output {expected_output}. Exiting...") | ||
sys.exit(1) | ||
|
||
if open(species).read() != open(expected_species).read(): | ||
print(f"Species file {species} does not match expected species {expected_species}. Exiting...") | ||
sys.exit(1) | ||
|
||
print("NFsim solver completed and solution matched expected output. Exiting...") | ||
sys.exit(0) |
This file was deleted.
Oops, something went wrong.