From 006eeaa4f9fe16fd585c924f60818d120d5b1796 Mon Sep 17 00:00:00 2001 From: nulinspiratie Date: Fri, 9 Jun 2017 17:59:24 +1000 Subject: [PATCH] feat: add loop.plot Add loop.plot() method, which automatically attaches it to the background task of the loop. Currently only works with MatPlot, not sure how to make it know when to choose QTPlot --- qcodes/loops.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/qcodes/loops.py b/qcodes/loops.py index d7b9b631a9fd..751625ea9128 100644 --- a/qcodes/loops.py +++ b/qcodes/loops.py @@ -56,6 +56,7 @@ from qcodes.data.data_array import DataArray from qcodes.utils.helpers import wait_secs, full_class, tprint from qcodes.utils.metadata import Metadatable +from qcodes.plots.qcmatplotlib import MatPlot from .actions import (_actions_snapshot, Task, Wait, _Measure, _Nest, BreakIf, _QcodesBreak) @@ -210,6 +211,11 @@ def with_bg_task(self, task, bg_final_task=None, min_delay=0.01): """ return _attach_bg_task(self, task, bg_final_task, min_delay) + def plot(self, *args, min_delay=0.5, **kwargs): + plot = MatPlot(*args, **kwargs) + self.with_bg_task(plot.update, min_delay=min_delay) + return plot + @staticmethod def validate_actions(*actions): """