Skip to content

Commit

Permalink
Fix some python functionality (#871)
Browse files Browse the repository at this point in the history
  • Loading branch information
marchdf authored Nov 11, 2024
1 parent cdf2dd3 commit 18fda37
Show file tree
Hide file tree
Showing 8 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Exec/RegTests/EB-C1/eb-symmetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_symmetry(self):
# Load the data
fdir = os.path.abspath(".")
fname = os.path.join(fdir, "mmslog")
df = pd.read_csv(fname, delim_whitespace=True)
df = pd.read_csv(fname, sep="\\s+")
npt.assert_allclose(df.u_mms_err, df.v_mms_err, rtol=1e-13)
npt.assert_allclose(df.u_mms_err, df.w_mms_err, rtol=1e-13)
npt.assert_allclose(df.rhou_residual, df.rhov_residual, rtol=1e-13)
Expand Down
2 changes: 1 addition & 1 deletion Exec/RegTests/EB-C7/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@

fields = ["density", "pressure", "u", "Temp"]

exact = pd.read_csv("exact_soln", delim_whitespace=True)
exact = pd.read_csv("exact_soln", sep="\\s+")
for field in fields:
plt.figure(field)
p = plt.plot(exact.x, exact[field], lw=1, color=cmap[-1], label=f"Exact")
Expand Down
8 changes: 4 additions & 4 deletions Exec/RegTests/EB-ConvergingNozzle/plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ def AofX(X, inletdiam, outletdiam, nozzlestart, nozzleend):
nozlen = 9

# load results
results = pd.read_csv("run_01/plt24000.slice", header=2, delim_whitespace=True)
results = pd.read_csv("run_01/plt24000.slice", header=2, sep="\\s+")
results.columns = list(results.columns[1:]) + ["N/A"]
results["Area"] = AofX(results["x"], indiam, outdiam, nozstart, nozstart + nozlen)

Expand Down Expand Up @@ -75,9 +75,9 @@ def AofX(X, inletdiam, outletdiam, nozzlestart, nozzleend):
plt.close()

# Compare different boundary conditions
data_00 = pd.read_csv("run_00/extremalog", delim_whitespace=True)
data_01 = pd.read_csv("run_01/extremalog", delim_whitespace=True)
data_10 = pd.read_csv("run_10/extremalog", delim_whitespace=True)
data_00 = pd.read_csv("run_00/extremalog", sep="\\s+")
data_01 = pd.read_csv("run_01/extremalog", sep="\\s+")
data_10 = pd.read_csv("run_10/extremalog", sep="\\s+")

plt.figure("BCCompare", figsize=(5.5, 4.5))
plt.clf()
Expand Down
2 changes: 1 addition & 1 deletion Exec/RegTests/MMS/symmetry.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_symmetry(self):
# Load the data
fdir = os.path.abspath(".")
fname = os.path.join(fdir, "mmslog")
df = pd.read_csv(fname, delim_whitespace=True)
df = pd.read_csv(fname, sep="\\s+")
npt.assert_allclose(df.u_mms_err, df.v_mms_err, rtol=1e-13)
npt.assert_allclose(df.u_mms_err, df.w_mms_err, rtol=1e-13)
npt.assert_allclose(df.rhou_residual, df.rhov_residual, rtol=1e-13)
Expand Down
8 changes: 4 additions & 4 deletions Exec/RegTests/TGReact/plotter.py
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ def plot_reacting3d_refdata(refdir, ics):
profile_fields["heat_release"] = ["HR", -10.0]

# Read time history files
datdf = pd.read_csv(os.path.join(fdir, datname), delim_whitespace=True)
extradf = pd.read_csv(os.path.join(fdir, extraname), delim_whitespace=True)
datdf = pd.read_csv(os.path.join(fdir, datname), sep="\\s+")
extradf = pd.read_csv(os.path.join(fdir, extraname), sep="\\s+")
tdf = pd.concat(
[datdf.set_index("time"), extradf.set_index("time")], axis=1, join="inner"
).reset_index()
Expand All @@ -313,7 +313,7 @@ def plot_reacting3d_refdata(refdir, ics):
[
pd.read_csv(
os.path.join(datadir, f"{field}.curve"),
delim_whitespace=True,
sep="\\s+",
header=None,
names=["t", field],
comment="#",
Expand All @@ -336,7 +336,7 @@ def plot_reacting3d_refdata(refdir, ics):
for j, fname in enumerate(fnames):
tmp = pd.read_csv(
fname,
delim_whitespace=True,
sep="\\s+",
header=None,
names=["pos", profile_fields[field][0]],
comment="#",
Expand Down
4 changes: 2 additions & 2 deletions Exec/RegTests/zeroD/extract_data_yt.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
outfile.close()

# plot
ref = pd.read_csv("cantera_soln", delim_whitespace=True)
df = pd.read_csv(fname, delim_whitespace=True, header=None, names=["t", "temp"])
ref = pd.read_csv("cantera_soln", sep="\\s+")
df = pd.read_csv(fname, sep="\\s+", header=None, names=["t", "temp"])

plt.figure()
plt.plot(ref["Time(s)"], ref["Temperature(K)"], label="Ref.")
Expand Down
2 changes: 1 addition & 1 deletion Tests/test_masscons.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ def test_conservation(self):
# Load the data
fdir = os.path.abspath(".")
fname = os.path.join(fdir, "datlog")
df = pd.read_csv(fname, delim_whitespace=True)
df = pd.read_csv(fname, sep="\\s+")
npt.assert_allclose(df.mass, df.mass[0], rtol=1e-13)
npt.assert_allclose(df.rho_E, df.rho_E[0], rtol=1e-13)

Expand Down
2 changes: 1 addition & 1 deletion Tests/test_second_order.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ def load_pelec_error(fdir, theory_order):
for k, (res, resdir) in enumerate(zip(resolutions, resdirs)):

fname = os.path.join(resdir, "mmslog")
df = pd.read_csv(fname, delim_whitespace=True)
df = pd.read_csv(fname, sep="\\s+")

idx = -1
print(
Expand Down

0 comments on commit 18fda37

Please sign in to comment.