Manuscript En02-E@2 · En02-E-v2.tex · section · c2769986

Unexecuted reproducibility supplement

Unexecuted reproducibility supplement · lines 2342–2406

Back to manuscript

def main(): global ROOT parser = argparse.ArgumentParser() parser.add_argument("–mode",choices=("synthetic","pilot"),default="synthetic") parser.add_argument("–sdp",action="store_true") parser.add_argument("–tex") parser.add_argument("–compile",action="store_true") args = parser.parse_args() stamp = datetime.datetime.now(datetime.timezone.utc).strftime(" ROOT = Path("en02_e_v2_"+stamp) ROOT.mkdir() source = Path(__file__).resolve() shutil.copy2(source,ROOT/source.name) manifest = "status":"RUNNING","mode":args.mode,"python":sys.version, "numpy":np.__version__,"scipy":scipy.__version__, "source_sha256":hashlib.sha256(source.read_bytes()).hexdigest(), "audit_tolerance":TOL,"SDP_feasibility_tolerance":STOL, "SDP_gap_tolerance":GAP,"sdp_requested":args.sdp, "compilation_requested":args.compile,"numerical_certificate":False path = ROOT/"manifest.json" path.write_text(json.dumps(clean(manifest),indent=2)) try: a = synthetic_audit() N = operational_pilot(a,"synthetic_control") if args.sdp: import cvxpy import scs manifest.update(cvxpy=cvxpy.__version__,scs=scs.__version__, installed_solvers=cvxpy.installed_solvers()) solver_validation(N,a,"synthetic_control") if args.mode=="pilot": a = field_pilot() N = operational_pilot(a,"field_grid65") if args.sdp: recovery_sdp(N,"field_calibrated_even",.75*(1-a)) if args.compile: need(args.tex is not None,"–compile requires –tex") compile_source(args.tex) elif args.tex: shutil.copy2(Path(args.tex),ROOT/Path(args.tex).name) dump() manifest["status"] = "REQUESTED_FLOATING_POINT_CHECKS_PASSED" manifest["compilation"] = "RETURN_CODES_PASSED_WARNINGS_NEED_INSPECTION" \ if args.compile else "NOT_RUN" manifest["scope"] = ("requested finite regressions only; radial convergence " "diagnostics are not certified total errors; human inspection pending") except BaseException: dump() (ROOT/"failure.txt").write_text(traceback.format_exc()) manifest["status"] = "FAILED" raise finally: manifest["artifact_sha256"] = f.name:hashlib.sha256(f.read_bytes()).hexdigest() for f in ROOT.iterdir() if f.is_file() and f.name!="manifest.json" path.write_text(json.dumps(clean(manifest),indent=2,allow_nan=False)) print(ROOT) print(manifest["status"])

if __name__=="__main__": main()

Nearby in this section