def run_kwarg_scan(ModelClass, model_kwarg_sets, t_output_every, t_upto, force_resume=True, parallel=False): """Run many models with the same parameters but variable `field`. For each `val` in `vals`, a new model will be made, and run up to a time. The output directory is automatically generated from the model arguments. Parameters ---------- ModelClass: type A class or factory function that returns a model object by calling `ModelClass(model_kwargs)` model_kwarg_sets: list[dict] List of argument sets, each of which can instantiate a model. t_output_every: float see :class:`Runner`. t_upto: float Run each model until the time is equal to this parallel: bool Whether or not to run the models in parallel, using the Multiprocessing library. If `True`, the number of concurrent tasks will be equal to one less than the number of available cores detected. """ task_runner = _TaskRunner(ModelClass, t_output_every, t_upto, force_resume) run_func(task_runner, model_kwarg_sets, parallel)
def resume_runs(dirnames, t_output_every, t_upto, parallel=False): """Resume many models, and run. Parameters ---------- dirnames: list[str] List of output directory paths from which to resume. output_every: int see :class:`Runner`. t_upto: float Run each model until the time is equal to this parallel: bool Whether or not to run the models in parallel, using the Multiprocessing library. If `True`, the number of concurrent tasks will be equal to one less than the number of available cores detected. """ run_model_partial = partial(run_model, t_output_every, force_resume=True, t_upto=t_upto) run_func(run_model_partial, dirnames, parallel)