Esempio n. 1
0
def test_mda(qtbot, proxy):
    mda = MDASequence(time_plan={"interval": 0.1, "loops": 2})

    def _check_frame(img, event):
        return (isinstance(img, np.ndarray) and isinstance(event, MDAEvent)
                and event.sequence == mda and event.sequence is not mda)

    def _check_seq(obj):
        return obj.uid == mda.uid

    signals = [
        proxy.events.sequenceStarted,
        proxy.events.frameReady,
        proxy.events.frameReady,
        proxy.events.sequenceFinished,
    ]
    signals = [
        (proxy.events.sequenceStarted, "started"),
        (proxy.events.frameReady, "frameReady1"),
        (proxy.events.frameReady, "frameReady2"),
        (proxy.events.sequenceFinished, "finishd"),
    ]
    checks = [_check_seq, _check_frame, _check_frame, _check_seq]

    with qtbot.waitSignals(signals, check_params_cbs=checks, order="strict"):
        proxy.run_mda(mda)
Esempio n. 2
0
def test_mda_cancel(qtbot, proxy: RemoteMMCore):
    mda = MDASequence(time_plan={"interval": 5000, "loops": 3})
    with qtbot.waitSignal(proxy.events.sequenceStarted):
        proxy.run_mda(mda)
    with qtbot.waitSignals(
        [proxy.events.sequenceFinished, proxy.events.sequenceCanceled],
            timeout=500):
        proxy.cancel()
Esempio n. 3
0
import sys

import Pyro5
from qtpy.QtWidgets import QApplication, QPushButton, QVBoxLayout, QWidget
from useq import MDASequence

from micromanager_gui._core._client import detatched_mmcore

sys.excepthook = Pyro5.errors.excepthook

mda = MDASequence(
    axis_order="tpzc",
    time_plan=dict(interval=1.3, loops=10),
    stage_positions=[(10, 20, 30)],
    channels=[dict(config="Cy5", exposure=100)],
    z_plan=dict(range=1.0, step=0.5),
)

app = QApplication([])

proc = detatched_mmcore(config="demo")

w = QWidget()

btn1 = QPushButton("quit")
btn2 = QPushButton("stop")
btn3 = QPushButton("pause/go")
btn1.clicked.connect(app.quit)
btn2.clicked.connect(lambda x: proc.core.cancel())
btn3.clicked.connect(lambda x: proc.core.toggle_pause())