From f4d8f77268f7ab7c5f02f8c9116cadd37d990fcb Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Tue, 21 Jan 2020 16:13:04 +0800 Subject: [PATCH] turn kasli_tester into a frontend tool --- .../artiq_sinara_tester.py} | 29 ++++++++++++++----- setup.py | 1 + 2 files changed, 23 insertions(+), 7 deletions(-) rename artiq/{examples/kasli/repository/kasli_tester.py => frontend/artiq_sinara_tester.py} (96%) mode change 100644 => 100755 diff --git a/artiq/examples/kasli/repository/kasli_tester.py b/artiq/frontend/artiq_sinara_tester.py old mode 100644 new mode 100755 similarity index 96% rename from artiq/examples/kasli/repository/kasli_tester.py rename to artiq/frontend/artiq_sinara_tester.py index 084022e5e..da702faee --- a/artiq/examples/kasli/repository/kasli_tester.py +++ b/artiq/frontend/artiq_sinara_tester.py @@ -1,9 +1,14 @@ +#!/usr/bin/env python3 + import sys import os import select from artiq.experiment import * from artiq.coredevice.ad9910 import AD9910, SyncDataEeprom +from artiq.master.databases import DeviceDB +from artiq.master.worker_db import DeviceManager + if os.name == "nt": import msvcrt @@ -34,13 +39,8 @@ def is_enter_pressed() -> TBool: return False -class KasliTester(EnvExperiment): +class SinaraTester(EnvExperiment): def build(self): - # hack to detect artiq_run - if self.get_device("scheduler").__class__.__name__ != "DummyScheduler": - raise NotImplementedError( - "must be run with artiq_run to support keyboard interaction") - self.setattr_device("core") self.leds = dict() @@ -365,7 +365,7 @@ class KasliTester(EnvExperiment): self.grabber_capture(card_dev, rois) def run(self): - print("****** Kasli system tester ******") + print("****** Sinara system tester ******") print("") self.core.reset() if self.leds: @@ -382,3 +382,18 @@ class KasliTester(EnvExperiment): self.test_zotinos() if self.grabbers: self.test_grabbers() + + +def main(): + device_mgr = DeviceManager(DeviceDB("device_db.pyon")) + try: + experiment = SinaraTester((device_mgr, None, None, None)) + experiment.prepare() + experiment.run() + experiment.analyze() + finally: + device_mgr.close_devices() + + +if __name__ == "__main__": + main() diff --git a/setup.py b/setup.py index 3e0e722ad..44022073d 100755 --- a/setup.py +++ b/setup.py @@ -28,6 +28,7 @@ console_scripts = [ "artiq_master = artiq.frontend.artiq_master:main", "artiq_mkfs = artiq.frontend.artiq_mkfs:main", "artiq_rtiomon = artiq.frontend.artiq_rtiomon:main", + "artiq_sinara_tester = artiq.frontend.artiq_sinara_tester:main", "artiq_session = artiq.frontend.artiq_session:main", "artiq_route = artiq.frontend.artiq_route:main", "artiq_run = artiq.frontend.artiq_run:main",