121def raw(name, rev, calls=400):
122 outlier, block = MAPS[name]
124 acc = O.AndersonOracle(s, window=5, **
oracle_kw(rev))
125 readings, hit, engaged = [], {},
None
126 for k
in range(1, calls + 1):
128 if engaged
is None and acc.engaged:
130 if math.isfinite(acc.ritzRadius):
131 readings.append((k, acc.residual, acc.ritzRadius))
132 for t
in (1e-8, 1e-10, 1e-12):
133 if t
not in hit
and acc.residual <= t:
135 if acc.status !=
"active" or acc.residual <= 1e-13:
137 err = float(np.max(np.abs(s.u[s.inner] - s.xstar[s.inner])) / np.max(np.abs(s.xstar[s.inner])))
138 return dict(section=
"raw", map=name, rev=rev, engaged=engaged, status=acc.status, last_call=k,
139 residual=acc.residual, restarts=acc.numRestarts,
140 calls_to=[hit.get(1e-8), hit.get(1e-10), hit.get(1e-12)], max_rel_err=err,
141 max_reading=max((r[2]
for r
in readings), default=
None),
142 readings_tail=readings[-3:], would_fire=list(acc.ritz_would_fire))
146 outlier, block = MAPS[name]
148 hold, phases = {}, []
150 def cb(steps, phase):
151 if phases
and phases[-1][0] == phase:
154 phases.append([phase, 1])
155 res = O.march_to_steady(s, s.monitor, rtol=1e-4, max_steps=5000, accelerate=
True, window=5,
156 callback=cb, oracle_kw=
oracle_kw(rev), holder=hold, rev=rev)
158 return dict(section=
"driver", map=name, rev=rev, sigma=sigma, converged=res[
"converged"],
159 reason=res[
"reason"], steps=res[
"steps"],
160 phases=
" ".join(f
"{p[0][0]}{p[1]}" for p
in phases),
161 monitor_rel_err=abs(m / s.monitor_exact() - 1.0)
if math.isfinite(m)
else None)