Changed print statement and added commentary

This commit is contained in:
2021-03-26 10:50:57 +01:00
parent 23587b775e
commit b599062322

View File

@@ -10,7 +10,9 @@ import pandas as pd
def get_convergence(
output_file_paths, molecule, crit_mean=0.01, crit_std=0.10
):
"""Function checks if last two files contain converging datasets."""
"""Function checks if data results from last two
files contain are within convergence criteria.
Returns Boolean"""
if len(output_file_paths) < 2:
print("One iteration, therefore no convergence.")
@@ -30,6 +32,7 @@ def get_convergence(
older_std = older_fit_results[molecule].std()
measure_std = abs(abs(np.abs(newer_std) - abs(older_std))/norm)
# check if results within convergence criteria
if measure_mean <= crit_mean:
if measure_std <= crit_std:
convergence = True
@@ -39,7 +42,8 @@ def get_convergence(
print(
"Convergence result for ", output_file_paths[-1], " and ",
output_file_paths[-2], "\n\t\t\t",
measure_mean, measure_std, "convergence: ", str(convergence)
round(measure_mean, 4), round(measure_std, 4),
"convergence: ", str(convergence)
)
return convergence