From a25c4f9b720577df21bc3ce379829c187f3ed075 Mon Sep 17 00:00:00 2001 From: Valentin Boettcher Date: Thu, 24 Mar 2022 16:34:42 +0100 Subject: [PATCH] add integrate_multi --- hiro_models/model_auxiliary.py | 18 ++++++++++++++++-- poetry.lock | 2 +- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/hiro_models/model_auxiliary.py b/hiro_models/model_auxiliary.py index 1ab1885..951a713 100644 --- a/hiro_models/model_auxiliary.py +++ b/hiro_models/model_auxiliary.py @@ -12,8 +12,7 @@ from filelock import FileLock from pathlib import Path from .one_qubit_model import QubitModel from .two_qubit_model import TwoQubitModel -import stocproc -import logging +from collections.abc import Sequence @contextmanager @@ -61,6 +60,17 @@ def model_hook(dct: dict[str, Any]): return object_hook(dct) +def integrate_multi(models: Sequence[Model], *args, **kwargs): + """Integrate the hops equations for the ``models``. + Like :any:`integrate` just for many models. + + A call to :any:`ray.init` may be required. + """ + + for model in models: + integrate(model, *args, *kwargs) + + def integrate(model: Model, n: int, data_path: str = "./.data"): """Integrate the hops equations for the model. @@ -70,6 +80,10 @@ def integrate(model: Model, n: int, data_path: str = "./.data"): """ hash = model.hexhash + + # with model_db(data_path) as db: + # if hash in db and "data" db[hash] + supervisor = HOPSSupervisor( model.hops_config, n, diff --git a/poetry.lock b/poetry.lock index 0302680..824145e 100644 --- a/poetry.lock +++ b/poetry.lock @@ -287,7 +287,7 @@ typer = "^0.4.0" type = "git" url = "git@gitlab.hrz.tu-chemnitz.de:s8896854--tu-dresden.de/hops.git" reference = "BathMemoryTruncation" -resolved_reference = "36905de2e4f1b2e9c416c62e7bea20d18907b2aa" +resolved_reference = "2f5600c2044a9506e7eceb03c8a50706586884a3" [[package]] name = "hopsflow"