From bef246bf7f1c0c1d1742ab431a273a1ab658e159 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Al=C3=A1n=20Mu=C3=B1oz?= <amuoz@ed.ac.uk>
Date: Mon, 22 Nov 2021 12:26:53 +0000
Subject: [PATCH] add basic structure of multiexp

---
 pcore/multiexperiment.py | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 pcore/multiexperiment.py

diff --git a/pcore/multiexperiment.py b/pcore/multiexperiment.py
new file mode 100644
index 00000000..a3ce094f
--- /dev/null
+++ b/pcore/multiexperiment.py
@@ -0,0 +1,25 @@
+from pathos.multiprocessing import Pool
+
+from pcore.pipeline import PipelineParameters, Pipeline
+
+
+class MultiExp:
+    """
+    Manages cases when you need to segment several different experiments with a single
+    position (e.g. pH calibration).
+    """
+
+    def __init__(self, expt_ids, npools=8, *args, **kwargs):
+
+        self.expt_ids = expt_ids
+
+    def run(self):
+        run_expt = lambda expt: Pipeline(
+            PipelineParameters.default(general={"expt_id": expt, "distributed": 0})
+        ).run()
+        with Pool(npools) as p:
+            results = p.map(lambda x: self.create_pipeline(x), self.exp_ids)
+
+    @classmethod
+    def default(self):
+        return cls(expt_ids=list(range(20448, 20467 + 1)))
-- 
GitLab