CharlesZhang-USTC's picture
Add files using upload-large-folder tool
ea1b5d0 verified
Raw History Blame Contribute Delete
913 Bytes
"""Run existing toy/analytic experiments into a mounted results directory."""
import argparse
import runpy
from pathlib import Path
from .design import ROOT
ORDER=['run_prior','run_autoregressive','run_commit_order','run_order_metrics','run_granularity','run_statistic','run_context','run_cliff','run_leadin','run_recalibrate','run_laws','run_space']
def execute(script,output):
output=Path(output).resolve();output.mkdir(parents=True,exist_ok=True)
namespace=runpy.run_path(str(ROOT/'experiments'/f'{script}.py'),run_name='__suite_analytic__')
if 'main' not in namespace:raise ValueError(f'{script} has no main entry')
namespace['main'].__globals__['OUT_DIR']=str(output)
namespace['main']()
if __name__=='__main__':
p=argparse.ArgumentParser();p.add_argument('--script',choices=ORDER,required=True);p.add_argument('--output',required=True);a=p.parse_args();execute(a.script,a.output)