From 5eab7d57b04fa8415563d7391b64d0d695b13fc2 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Wed, 5 Jun 2024 04:42:23 -0400 Subject: [PATCH 1/8] updated script to build all samples --- beta/test_build_all.sh | 55 ----------------------- beta/test_build_samples.sh | 91 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 91 insertions(+), 55 deletions(-) delete mode 100644 beta/test_build_all.sh create mode 100644 beta/test_build_samples.sh diff --git a/beta/test_build_all.sh b/beta/test_build_all.sh deleted file mode 100644 index a79902e9e..000000000 --- a/beta/test_build_all.sh +++ /dev/null @@ -1,55 +0,0 @@ -# Copy this file to the root dir and run it from a bash shell: sh test_build_all.sh -# (created from the following info) -# -# $ make list-projects -# Sample projects: template biorobots-sample cancer-biorobots-sample cancer-immune-sample -# celltypes3-sample heterogeneity-sample pred-prey-farmer virus-macrophage-sample -# worm-sample interaction-sample -# -# Sample intracellular projects: ode-energy-sample physiboss-cell-lines-sample cancer-metabolism-sample -# - -make reset -make template -make -j2 -make reset -make biorobots-sample -make -make reset -make cancer-biorobots-sample -make -make reset -make cancer-immune-sample -make -make reset -make celltypes3-sample -make -make reset -make heterogeneity-sample -make -make reset -make pred-prey-farmer -make -make reset -make virus-macrophage-sample -make -make reset -make worm-sample -make -make reset -make interaction-sample -make -make reset -make mechano-sample -make - -# now the intracellular models, requiring additional libs -make reset -make ode-energy-sample -make -make reset -make physiboss-cell-lines-sample cancer-metabolism-sample -make -make reset -make cancer-metabolism-sample -make diff --git a/beta/test_build_samples.sh b/beta/test_build_samples.sh new file mode 100644 index 000000000..8b684b131 --- /dev/null +++ b/beta/test_build_samples.sh @@ -0,0 +1,91 @@ +# Copy this file to the root dir and run it from a Unix bash shell: sh test_build_samples.sh +# +# WARNING: this is primarily intended to be used by core developers when testing a new release. +# It will create new directories in /user_projects +# +# Based on the following: +# +# $ make list-projects +# Sample projects: template biorobots-sample cancer-biorobots-sample cancer-immune-sample +# celltypes3-sample heterogeneity-sample pred-prey-farmer virus-macrophage-sample +# worm-sample interaction-sample mechano-sample rules-sample physimess-sample +# +# Note that it does not currently test building the intracellular projects: +# Sample intracellular projects: template_BM ode-energy-sample physiboss-cell-lines-sample +# cancer-metabolism-sample physiboss-tutorial physiboss-tutorial-invasion +# +# +# After running the script, you can clean up with: +# $ rm template biorobots cancer_biorobots cancer_immune_3D celltypes3 heterogeneity pred_prey virus-sample worm interaction_demo mechano rules-sample physimess-sample +# and then: +# $ cd user_projects +# $ rm -rf template biorobots cancer_biorobots cancer_immune celltypes3 hetero pred_prey virus_mac worm interaction mechano rules physimess + +make reset +make template +make +mv project template +make save PROJ=template +# +make reset +make biorobots-sample +make +make save PROJ=biorobots +# +make reset +make cancer-biorobots-sample +make +make save PROJ=cancer_biorobots +# +make reset +make cancer-immune-sample +make +make save PROJ=cancer_immune +# +make reset +make celltypes3-sample +make +make save PROJ=celltypes3 +# +make reset +make heterogeneity-sample +make +make save PROJ=hetero +# +make reset +make pred-prey-farmer +make +make save PROJ=pred_prey +# +make reset +make virus-macrophage-sample +make +make save PROJ=virus_mac +# +make reset +make worm-sample +make +make save PROJ=worm +# +make reset +make interaction-sample +make +make save PROJ=interaction +# +make reset +make mechano-sample +make +mv project mechano-sample +make save PROJ=mechano +# +make reset +make rules-sample +make +mv project rules-sample +make save PROJ=rules +# +make reset +make physimess-sample +make +mv project physimess-sample +make save PROJ=physimess From f2f62aa79aa1a471b99fd10df0154fb35e5b4098 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Wed, 5 Jun 2024 07:44:13 -0400 Subject: [PATCH 2/8] prettify a tiny bit --- beta/test_build_samples.sh | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/beta/test_build_samples.sh b/beta/test_build_samples.sh index 8b684b131..4eb673e8d 100644 --- a/beta/test_build_samples.sh +++ b/beta/test_build_samples.sh @@ -15,10 +15,13 @@ # cancer-metabolism-sample physiboss-tutorial physiboss-tutorial-invasion # # -# After running the script, you can clean up with: -# $ rm template biorobots cancer_biorobots cancer_immune_3D celltypes3 heterogeneity pred_prey virus-sample worm interaction_demo mechano rules-sample physimess-sample +# After running the script, you can : +# 1) confirm all executables were created +# $ ls -l template biorobots cancer_biorobots cancer_immune_3D celltypes3 heterogeneity pred_prey virus-sample worm interaction_demo mechano rules-sample physimess-sample # and then: +# 2) confirm the user_projects were created; delete them # $ cd user_projects +# $ ls # $ rm -rf template biorobots cancer_biorobots cancer_immune celltypes3 hetero pred_prey virus_mac worm interaction mechano rules physimess make reset @@ -27,63 +30,75 @@ make mv project template make save PROJ=template # +echo "\n-----------------------------------------" make reset make biorobots-sample make make save PROJ=biorobots # +echo "\n-----------------------------------------" make reset make cancer-biorobots-sample make make save PROJ=cancer_biorobots # +echo "\n-----------------------------------------" make reset make cancer-immune-sample make make save PROJ=cancer_immune # +echo "\n-----------------------------------------" make reset make celltypes3-sample make make save PROJ=celltypes3 # +echo "\n-----------------------------------------" make reset make heterogeneity-sample make make save PROJ=hetero # +echo "\n-----------------------------------------" make reset make pred-prey-farmer make make save PROJ=pred_prey # +echo "\n-----------------------------------------" make reset make virus-macrophage-sample make make save PROJ=virus_mac # +echo "\n-----------------------------------------" make reset make worm-sample make make save PROJ=worm # +echo "\n-----------------------------------------" make reset make interaction-sample make make save PROJ=interaction # +echo "\n-----------------------------------------" make reset make mechano-sample make mv project mechano-sample make save PROJ=mechano # +echo "\n-----------------------------------------" make reset make rules-sample make mv project rules-sample make save PROJ=rules # +echo "\n-----------------------------------------" make reset make physimess-sample make From 798f92e4e70a219ef746ca80bcf5a152b48623dc Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Wed, 5 Jun 2024 07:49:35 -0400 Subject: [PATCH 3/8] fix a suffix --- beta/test_build_samples.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/beta/test_build_samples.sh b/beta/test_build_samples.sh index 4eb673e8d..5a1825410 100644 --- a/beta/test_build_samples.sh +++ b/beta/test_build_samples.sh @@ -17,7 +17,7 @@ # # After running the script, you can : # 1) confirm all executables were created -# $ ls -l template biorobots cancer_biorobots cancer_immune_3D celltypes3 heterogeneity pred_prey virus-sample worm interaction_demo mechano rules-sample physimess-sample +# $ ls -l template biorobots cancer_biorobots cancer_immune_3D celltypes3 heterogeneity pred_prey virus-sample worm interaction_demo mechano-sample rules-sample physimess-sample # and then: # 2) confirm the user_projects were created; delete them # $ cd user_projects From aca4e0f1b3411c646ca6d1472371f20ed7b82340 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Thu, 6 Jun 2024 02:48:31 -0400 Subject: [PATCH 4/8] fix renaming execs with a dash bug --- beta/test_build_samples.sh | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/beta/test_build_samples.sh b/beta/test_build_samples.sh index 5a1825410..63b2cb554 100644 --- a/beta/test_build_samples.sh +++ b/beta/test_build_samples.sh @@ -17,7 +17,7 @@ # # After running the script, you can : # 1) confirm all executables were created -# $ ls -l template biorobots cancer_biorobots cancer_immune_3D celltypes3 heterogeneity pred_prey virus-sample worm interaction_demo mechano-sample rules-sample physimess-sample +# $ ls -l template_sample biorobots cancer_biorobots cancer_immune_3D celltypes3 heterogeneity pred_prey virus_sample worm interaction_demo mechano_sample rules_sample physimess_sample # and then: # 2) confirm the user_projects were created; delete them # $ cd user_projects @@ -27,7 +27,7 @@ make reset make template make -mv project template +mv project template_sample make save PROJ=template # echo "\n-----------------------------------------" @@ -88,19 +88,19 @@ echo "\n-----------------------------------------" make reset make mechano-sample make -mv project mechano-sample +mv project mechano_sample make save PROJ=mechano # echo "\n-----------------------------------------" make reset make rules-sample make -mv project rules-sample +mv project rules_sample make save PROJ=rules # echo "\n-----------------------------------------" make reset make physimess-sample make -mv project physimess-sample +mv project physimess_sample make save PROJ=physimess From b37a6d7c06cd1f173fccd74804b2aacb6e52ebb6 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Tue, 11 Jun 2024 04:51:33 -0400 Subject: [PATCH 5/8] update --- beta/test_run_samples.py | 138 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 138 insertions(+) create mode 100644 beta/test_run_samples.py diff --git a/beta/test_run_samples.py b/beta/test_run_samples.py new file mode 100644 index 000000000..7262c27f8 --- /dev/null +++ b/beta/test_run_samples.py @@ -0,0 +1,138 @@ +# Copy this file to the root dir and run it to: +# - load each sample project (from user_projects) +# - compile it +# - modify each one's .xml: max_time, # threads, output folder +# - run it +# +# WARNING: this is primarily intended to be used by core developers when testing a new release. +# It will create new output directories ("output_") +# +# Reminder: +# $ ls user_projects/ +# biorobots/ hetero/ pred_prey/ worm/ +# cancer_biorobots/ interaction/ rules/ +# cancer_immune/ mechano/ template/ +# celltypes3/ physimess/ virus_mac/ + +# Sample projects: template biorobots-sample cancer-biorobots-sample cancer-immune-sample +# celltypes3-sample heterogeneity-sample pred-prey-farmer virus-macrophage-sample +# worm-sample interaction-sample mechano-sample rules-sample physimess-sample +# +# It does not currently test running the intracellular projects: +# Sample intracellular projects: template_BM ode-energy-sample physiboss-cell-lines-sample +# cancer-metabolism-sample physiboss-tutorial physiboss-tutorial-invasion +# +# +# If you want to cleanup the created execs: +# $ rm -rf template biorobots cancer_biorobots cancer_immune celltypes3 hetero pred_prey virus_mac worm interaction mechano rules physimess + +import subprocess +import xml.etree.ElementTree as ET +import os +import time + +user_proj = ["template", "biorobots", "cancer_biorobots", "celltypes3", "hetero", "pred_prey", "virus_mac", "worm", "interaction", "mechano", "rules", "physimess"] # +model_execs = ["project", "biorobots", "cancer_biorobots", "celltypes3", "heterogeneity", "pred_prey", "virus-sample", "worm", "interaction_demo", "project", "project", "project"] + +# $ rm -rf template biorobots cancer_biorobotscancer_immune celltypes3 hetero pred_prey virus_mac worm interaction mechano rules physimess +max_times = [120, 10, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99] + +for (uproj, myexec, max_time) in zip(user_proj, model_execs, max_times): + print("\n\n------------ ",uproj,myexec, " ----------------------------------") + subprocess.run(["make","reset"]) + # make load PROJ=template + s= "PROJ=" + uproj + print("\n ---- doing: make load ",s) + subprocess.run(["make","load",s]) + subprocess.run(["make"]) + + # update max_time and omp_num_threads (=1) + tree = ET.parse('config/PhysiCell_settings.xml') + root = tree.getroot() + root.find(".//max_time").text = str(max_time) + root.find(".//omp_num_threads").text = "1" + new_output_dir = "output_" + uproj + root.find(".//save//folder").text = new_output_dir + tree.write('config/PhysiCell_settings.xml') + try: + os.makedirs(new_output_dir) + except: + pass + time.sleep(1) + + subprocess.run([myexec]) + +# +# echo "\n-----------------------------------------" +# make reset +# make load PROJ=biorobots +# make +# +# echo "\n-----------------------------------------" +# make reset +# make cancer-biorobots-sample +# make +# make save PROJ=cancer_biorobots +# # +# echo "\n-----------------------------------------" +# make reset +# make cancer-immune-sample +# make +# make save PROJ=cancer_immune +# # +# echo "\n-----------------------------------------" +# make reset +# make celltypes3-sample +# make +# make save PROJ=celltypes3 +# # +# echo "\n-----------------------------------------" +# make reset +# make heterogeneity-sample +# make +# make save PROJ=hetero +# # +# echo "\n-----------------------------------------" +# make reset +# make pred-prey-farmer +# make +# make save PROJ=pred_prey +# # +# echo "\n-----------------------------------------" +# make reset +# make virus-macrophage-sample +# make +# make save PROJ=virus_mac +# # +# echo "\n-----------------------------------------" +# make reset +# make worm-sample +# make +# make save PROJ=worm +# # +# echo "\n-----------------------------------------" +# make reset +# make interaction-sample +# make +# make save PROJ=interaction +# # +# echo "\n-----------------------------------------" +# make reset +# make mechano-sample +# make +# mv project mechano_sample +# make save PROJ=mechano +# # +# echo "\n-----------------------------------------" +# make reset +# make rules-sample +# make +# mv project rules_sample +# make save PROJ=rules +# # +# echo "\n-----------------------------------------" +# make reset +# make physimess-sample +# make +# mv project physimess_sample +# make save PROJ=physimess From eca546ca05993c125fc1426b56b415866a371146 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Tue, 11 Jun 2024 09:10:34 -0400 Subject: [PATCH 6/8] cleanup --- beta/test_run_samples.py | 84 +++------------------------------------- 1 file changed, 5 insertions(+), 79 deletions(-) diff --git a/beta/test_run_samples.py b/beta/test_run_samples.py index 7262c27f8..230d25c3a 100644 --- a/beta/test_run_samples.py +++ b/beta/test_run_samples.py @@ -1,7 +1,7 @@ -# Copy this file to the root dir and run it to: +# Copy this Python script to the root dir and run it to: # - load each sample project (from user_projects) # - compile it -# - modify each one's .xml: max_time, # threads, output folder +# - modify each project's .xml: max_time, # threads, output folder # - run it # # WARNING: this is primarily intended to be used by core developers when testing a new release. @@ -31,10 +31,11 @@ import os import time +# skip over the 3D cancer_immune_sample for now user_proj = ["template", "biorobots", "cancer_biorobots", "celltypes3", "hetero", "pred_prey", "virus_mac", "worm", "interaction", "mechano", "rules", "physimess"] # model_execs = ["project", "biorobots", "cancer_biorobots", "celltypes3", "heterogeneity", "pred_prey", "virus-sample", "worm", "interaction_demo", "project", "project", "project"] -# $ rm -rf template biorobots cancer_biorobotscancer_immune celltypes3 hetero pred_prey virus_mac worm interaction mechano rules physimess +# using dummy values of 99; users can change max_times = [120, 10, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99] for (uproj, myexec, max_time) in zip(user_proj, model_execs, max_times): @@ -60,79 +61,4 @@ pass time.sleep(1) - subprocess.run([myexec]) - -# -# echo "\n-----------------------------------------" -# make reset -# make load PROJ=biorobots -# make -# -# echo "\n-----------------------------------------" -# make reset -# make cancer-biorobots-sample -# make -# make save PROJ=cancer_biorobots -# # -# echo "\n-----------------------------------------" -# make reset -# make cancer-immune-sample -# make -# make save PROJ=cancer_immune -# # -# echo "\n-----------------------------------------" -# make reset -# make celltypes3-sample -# make -# make save PROJ=celltypes3 -# # -# echo "\n-----------------------------------------" -# make reset -# make heterogeneity-sample -# make -# make save PROJ=hetero -# # -# echo "\n-----------------------------------------" -# make reset -# make pred-prey-farmer -# make -# make save PROJ=pred_prey -# # -# echo "\n-----------------------------------------" -# make reset -# make virus-macrophage-sample -# make -# make save PROJ=virus_mac -# # -# echo "\n-----------------------------------------" -# make reset -# make worm-sample -# make -# make save PROJ=worm -# # -# echo "\n-----------------------------------------" -# make reset -# make interaction-sample -# make -# make save PROJ=interaction -# # -# echo "\n-----------------------------------------" -# make reset -# make mechano-sample -# make -# mv project mechano_sample -# make save PROJ=mechano -# # -# echo "\n-----------------------------------------" -# make reset -# make rules-sample -# make -# mv project rules_sample -# make save PROJ=rules -# # -# echo "\n-----------------------------------------" -# make reset -# make physimess-sample -# make -# mv project physimess_sample -# make save PROJ=physimess + subprocess.run([myexec]) \ No newline at end of file From fee87160a09959ac458480a3cb9ef6d27ab6b41e Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Tue, 11 Jun 2024 13:23:01 -0400 Subject: [PATCH 7/8] update --- beta/test_build_samples.sh | 9 ++++++--- beta/test_run_samples.py | 30 ++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/beta/test_build_samples.sh b/beta/test_build_samples.sh index 63b2cb554..f976d5414 100644 --- a/beta/test_build_samples.sh +++ b/beta/test_build_samples.sh @@ -3,7 +3,11 @@ # WARNING: this is primarily intended to be used by core developers when testing a new release. # It will create new directories in /user_projects # -# Based on the following: +# This script is intended to serve as a first step in a two-step process. The second step is +# to run the beta/test_run_samples.py Python script (see its header for instructions). +# +# +# This test_build_samples.sh script is based on the following: # # $ make list-projects # Sample projects: template biorobots-sample cancer-biorobots-sample cancer-immune-sample @@ -14,8 +18,7 @@ # Sample intracellular projects: template_BM ode-energy-sample physiboss-cell-lines-sample # cancer-metabolism-sample physiboss-tutorial physiboss-tutorial-invasion # -# -# After running the script, you can : +# After running the script, you can: # 1) confirm all executables were created # $ ls -l template_sample biorobots cancer_biorobots cancer_immune_3D celltypes3 heterogeneity pred_prey virus_sample worm interaction_demo mechano_sample rules_sample physimess_sample # and then: diff --git a/beta/test_run_samples.py b/beta/test_run_samples.py index 230d25c3a..1370e5f63 100644 --- a/beta/test_run_samples.py +++ b/beta/test_run_samples.py @@ -1,5 +1,10 @@ -# Copy this Python script to the root dir and run it to: -# - load each sample project (from user_projects) +# +# This Python script assumes you have run the beta/test_build_sample.sh script first. +# See its header for instructions. +# +# Copy this Python script from /beta to the root dir (in case you want to edit it), then run it +# It will do the following: +# - load each sample project (from user_projects; created by test_build_sample.sh) # - compile it # - modify each project's .xml: max_time, # threads, output folder # - run it @@ -7,6 +12,14 @@ # WARNING: this is primarily intended to be used by core developers when testing a new release. # It will create new output directories ("output_") # +# Run via: +# $ python beta/test_run_samples.py +# or, pipe the terminal output to a file: +# $ python beta/test_run_samples.py > test_run_samples.out +# +# Any serious error should show up in your terminal output. Some "errors" may be benign, e.g., +# "Error: Could not find section of XML config file" +# # Reminder: # $ ls user_projects/ # biorobots/ hetero/ pred_prey/ worm/ @@ -24,19 +37,20 @@ # # # If you want to cleanup the created execs: -# $ rm -rf template biorobots cancer_biorobots cancer_immune celltypes3 hetero pred_prey virus_mac worm interaction mechano rules physimess +# $ rm -rf template biorobots cancer_biorobots cancer_immune_3D celltypes3 hetero pred_prey virus_mac worm interaction mechano rules physimess import subprocess import xml.etree.ElementTree as ET import os import time -# skip over the 3D cancer_immune_sample for now -user_proj = ["template", "biorobots", "cancer_biorobots", "celltypes3", "hetero", "pred_prey", "virus_mac", "worm", "interaction", "mechano", "rules", "physimess"] # -model_execs = ["project", "biorobots", "cancer_biorobots", "celltypes3", "heterogeneity", "pred_prey", "virus-sample", "worm", "interaction_demo", "project", "project", "project"] +user_proj = ["template", "biorobots", "cancer_biorobots", "celltypes3", "hetero", "pred_prey", "virus_mac", "worm", "interaction", "mechano", "rules", "physimess", "cancer_immune"] + +model_execs = ["project", "biorobots", "cancer_biorobots", "celltypes3", "heterogeneity", "pred_prey", "virus-sample", "worm", "interaction_demo", "project", "project", "project", "cancer_immune_3D"] -# using dummy values of 99; users can change -max_times = [120, 10, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99] +# Using dummy max_time values of 99 for many projects; 61 for the more time-consuming cancer_immune_3D. +# Users can change them as they wish. +max_times = [120, 10, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 61] for (uproj, myexec, max_time) in zip(user_proj, model_execs, max_times): print("\n\n------------ ",uproj,myexec, " ----------------------------------") From a72777a6fef8f2aaeff8b9d294f218ea8e868a22 Mon Sep 17 00:00:00 2001 From: Randy Heiland Date: Wed, 26 Jun 2024 17:06:56 -0400 Subject: [PATCH 8/8] init --- beta/test_diffs_svg.py | 78 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 beta/test_diffs_svg.py diff --git a/beta/test_diffs_svg.py b/beta/test_diffs_svg.py new file mode 100644 index 000000000..82616139e --- /dev/null +++ b/beta/test_diffs_svg.py @@ -0,0 +1,78 @@ +# compare diffs between .svg files in different runs +# e.g., +# python beta/test_diffs_svg.py ~/git/new-build-test/samples_test ~/git/fix_constants/samples_test + + +import os +import sys +from pathlib import Path +import glob + +# print(len(sys.argv)) +if (len(sys.argv) < 3): + usage_str = "Usage: %s " % (sys.argv[0]) + print(usage_str) + print("e.g.: python test_diffs_svg.py ~/blah1 ~/blah2") + exit(1) +else: + dir1 = sys.argv[1] + dir2 = sys.argv[2] + + +# svg_files = Path(dir1).glob(f'{dir1}/out_heterog/snap*.svg') +#print("svg_files=",svg_files) + + +#for filename in glob.iglob(f'{dir1}/snap*.svg'): + +# output_biorobots/ output_interaction/ output_template/ +# output_cancer_biorobots/ output_mechano/ output_virus_mac/ +# output_cancer_immune/ output_physimess/ output_worm/ +# output_celltypes3/ output_pred_prey/ +# output_hetero/ output_rules/ + +# note that we omit 'output_physimess' only because, currently, it fails the recursive copy of +# additional files needed in config/subdirs (until the Makefiles and "make load PROJ" is updated) +for out_dir in ['output_template','output_biorobots','output_cancer_biorobots','output_celltypes3','output_heterog','output_interaction','output_mechano','output_pred_prey','output_virus_mac','output_worm','output_rules','output_cancer_immune']: +#for out_dir in ['out_template']: + print("---------- processing ",out_dir) + svg_files = glob.glob(f'{dir1}/{out_dir}/snap*.svg') + svg_files.sort() + for filename in svg_files: + f = os.path.basename(filename) + f1 = os.path.join(dir1,out_dir,f) + f2 = os.path.join(dir2,out_dir,f) + # print(f1,f2) + # cmd = f"diff {f1} {f2} | wc -l" + cmd = f"diff {f1} {f2} | wc -l > diff_result.txt" + print(cmd) + os.system(cmd) + with open('diff_result.txt') as f: + vstr = f.readline() + print(vstr) + # Note: a "diff" will almost certainly return 4 lines, showing different run times + # 1340c1340 + # < 0 days, 0 hours, 1 minutes, and 12.1327 seconds + # --- + # > 0 days, 0 hours, 1 minutes, and 12.4215 seconds + if (int(vstr) == 0): + print("======----------------> WOW: exact match! (same sim time)") + # userinput = input("\nPress Enter to skip remaining files for this sample:") + # break + elif (int(vstr) != 4): # hard-coded "4" + print("======----------------> Warning: not a match!") + userinput = input("\nPress Enter to skip remaining files for this sample:") + # print("Username is: " + username) + break + # sys.exit(1) + +# for fname in os.listdir(dir1): +# fname1 = os.path.join(dir1, fname) +# fname2 = os.path.join(dir2, fname) +# # checking if it is a file +# if os.path.isfile(f): +# print(f) + +# cmd = "diff " + dir1 + "out_heterog" + " > " + log_file + " " + background_str +# print("----- cmd = ",cmd) +# # os.system(cmd) # <------ Execute the simulation