Show local restart progress alongside full convergence threshold
This commit is contained in:
@@ -109,6 +109,25 @@ class SchemaChecks(unittest.TestCase):
|
||||
with self.assertRaisesRegex(ValueError, "hash-bound"):
|
||||
plots.load_pairs([self.path])
|
||||
|
||||
def test_local_progress_starts_at_zero_and_retains_failed_endpoint(self):
|
||||
pairs, sources = plots.load_pairs([self.path])
|
||||
self.assertEqual(plots.residual_reduction(pairs["n2"][0]), [0., 50., 75., 75.])
|
||||
local = plots.sidecar("n2", pairs["n2"], sources)["local_progress_panel"]
|
||||
self.assertEqual(local["shared_initial_residual"], 1.)
|
||||
self.assertTrue(local["zero_included"])
|
||||
self.assertEqual(local["curves"][1]["residual_reduction_percent"], [0., 50., 75., 75.])
|
||||
|
||||
def test_shared_restart_must_also_have_matching_initial_norm(self):
|
||||
candidate = self.data["campaigns"][0]["cases"][-1]
|
||||
candidate["initial_residual"] *= 2
|
||||
candidate["final_residual"] *= 2
|
||||
candidate["actual_threshold"] *= 2
|
||||
for row in candidate["history"]:
|
||||
row["F"] = str(2 * float(row["F"]))
|
||||
self.write()
|
||||
with self.assertRaisesRegex(ValueError, "shared restart initial norm"):
|
||||
plots.load_pairs([self.path])
|
||||
|
||||
def test_nonpositive_log_values_are_not_silently_floored(self):
|
||||
self.data["campaigns"][0]["cases"][0]["history"][0]["F"] = "0"
|
||||
self.write()
|
||||
@@ -135,6 +154,11 @@ class SchemaChecks(unittest.TestCase):
|
||||
self.assertEqual(axis.get_yscale(), "log")
|
||||
self.assertEqual(axis.lines[0].get_xdata()[0], 0.)
|
||||
self.assertEqual(list(axis.lines[-1].get_ydata()), [1e-8, 1e-8])
|
||||
if name == "n2":
|
||||
local = figure.axes[1]
|
||||
self.assertEqual(local.get_yscale(), "linear")
|
||||
self.assertEqual(local.get_ylim()[0], 0.)
|
||||
self.assertEqual(list(local.lines[0].get_ydata()), [0., 50., 75., 75.])
|
||||
for extension in ("png", "pdf"):
|
||||
path = self.directory / f"{name}.{extension}"
|
||||
figure.savefig(path)
|
||||
|
||||
Reference in New Issue
Block a user