Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Oct 3, 2023
1 parent d516785 commit a100af2
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 23 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1061,9 +1061,9 @@ def print_errors_for_text(df):
plot_rr_mosdef_mosdef_avg(densityDF.copy())

print_errors_for_text(densityDF.copy())

## Print out relative errors for max and min

import copy

mosdefDF = pd.read_csv("csvs/job_density_data.csv", index_col=0)
Expand All @@ -1082,19 +1082,23 @@ def print_errors_for_text(df):
df = copy.deepcopy(densityDF)
df = _mask_df(df)
init_rows = df.shape[0]
df = df[df["density"].notna()] # drop bad rows
df = df[df["density"].notna()] # drop bad rows
print(f"Removed {init_rows-df.shape[0]} rows")
mosdf = copy.copy(df.loc[df["associated_work"] == "MoSDeF"])

groupREList = ["molecule", "temperature", "forcefield"]
mosdf["Relative_Error"] = mosdf.groupby(groupREList)['density'].transform(calculate_relative_error)
mosdf["Relative_Error"] = mosdf.groupby(groupREList)["density"].transform(
calculate_relative_error
)
maxval = mosdf["Relative_Error"].max()
medval = mosdf["Relative_Error"].median()
print("MoSDeF max and median values: ", maxval, medval)

RRdf = copy.copy(df.loc[df["associated_work"] == "RR"])
groupREList = ["molecule", "temperature", "forcefield", "pressure"]
RRdf["Relative_Error"] = RRDF.groupby(groupREList)['density'].transform(calculate_relative_error)
RRdf["Relative_Error"] = RRDF.groupby(groupREList)["density"].transform(
calculate_relative_error
)
maxval = RRdf["Relative_Error"].max()
medval = RRdf["Relative_Error"].median()
print("Round robin max and median values: ", maxval, medval)
Original file line number Diff line number Diff line change
Expand Up @@ -139,26 +139,62 @@ def _generate_csv_from_PDF(molecule):
headerInt = int(4 * np.floor(i / 4))
header = newDF.iloc[headerInt]["Program(Group)"]
newDF.iloc[i]["Program(Group)"] = header

manAddDict = { #manually add missing densities
(5, 98.0):"648.53", (41, 98.0):"663.17", (70, 98.0):"673.97", (70, 173.0):"606.08"

manAddDict = { # manually add missing densities
(5, 98.0): "648.53",
(41, 98.0): "663.17",
(70, 98.0): "673.97",
(70, 173.0): "606.08",
}
if molecule in [
"OPLS Ethane at 5 MPa", "OPLS Ethane at 41 MPa"
]:
if molecule in ["OPLS Ethane at 5 MPa", "OPLS Ethane at 41 MPa"]:
press = int(molecule.split(" ")[-2])
newDF.loc[(newDF["Program(Group)"] == "TOWHEE(BS)") & (newDF["T / K"] == "98.0"), "ρ / kg m−3"] = manAddDict[
(press, 98.0)]
print(f"ADDED "+ str(newDF.loc[(newDF["Program(Group)"] == "TOWHEE(BS)") & (newDF["T / K"] == "98.0"), "ρ / kg m−3"]))
newDF.loc[
(newDF["Program(Group)"] == "TOWHEE(BS)")
& (newDF["T / K"] == "98.0"),
"ρ / kg m−3",
] = manAddDict[(press, 98.0)]
print(
f"ADDED "
+ str(
newDF.loc[
(newDF["Program(Group)"] == "TOWHEE(BS)")
& (newDF["T / K"] == "98.0"),
"ρ / kg m−3",
]
)
)
elif molecule == "OPLS Ethane at 70 MPa":
press = int(molecule.split(" ")[-2])
newDF.loc[(newDF["Program(Group)"] == "TOWHEE(BS)") & (newDF["T / K"] == "98.0"), "ρ / kg m−3"] = manAddDict[
(press, 98.0)]
newDF.loc[(newDF["Program(Group)"] == "TOWHEE(BS)") & (newDF["T / K"] == "173.0"), "ρ / kg m−3"] = manAddDict[
(press, 173.0)]
print(f"ADDED "+ str(newDF.loc[(newDF["Program(Group)"] == "TOWHEE(BS)") & (newDF["T / K"] == "98.0"), "ρ / kg m−3"]))
print(f"ADDED "+ str(newDF.loc[(newDF["Program(Group)"] == "TOWHEE(BS)") & (newDF["T / K"] == "173.0"), "ρ / kg m−3"]))

newDF.loc[
(newDF["Program(Group)"] == "TOWHEE(BS)")
& (newDF["T / K"] == "98.0"),
"ρ / kg m−3",
] = manAddDict[(press, 98.0)]
newDF.loc[
(newDF["Program(Group)"] == "TOWHEE(BS)")
& (newDF["T / K"] == "173.0"),
"ρ / kg m−3",
] = manAddDict[(press, 173.0)]
print(
f"ADDED "
+ str(
newDF.loc[
(newDF["Program(Group)"] == "TOWHEE(BS)")
& (newDF["T / K"] == "98.0"),
"ρ / kg m−3",
]
)
)
print(
f"ADDED "
+ str(
newDF.loc[
(newDF["Program(Group)"] == "TOWHEE(BS)")
& (newDF["T / K"] == "173.0"),
"ρ / kg m−3",
]
)
)

# we will change the data type
# of id column to str by giving
Expand Down

0 comments on commit a100af2

Please sign in to comment.