turn kasli_tester into a frontend tool

This commit is contained in:
Sebastien Bourdeauducq 2020-01-21 16:13:04 +08:00
parent bfcbffcd8d
commit f4d8f77268
2 changed files with 23 additions and 7 deletions

View File

@ -1,9 +1,14 @@
#!/usr/bin/env python3
import sys import sys
import os import os
import select import select
from artiq.experiment import * from artiq.experiment import *
from artiq.coredevice.ad9910 import AD9910, SyncDataEeprom from artiq.coredevice.ad9910 import AD9910, SyncDataEeprom
from artiq.master.databases import DeviceDB
from artiq.master.worker_db import DeviceManager
if os.name == "nt": if os.name == "nt":
import msvcrt import msvcrt
@ -34,13 +39,8 @@ def is_enter_pressed() -> TBool:
return False return False
class KasliTester(EnvExperiment): class SinaraTester(EnvExperiment):
def build(self): 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.setattr_device("core")
self.leds = dict() self.leds = dict()
@ -365,7 +365,7 @@ class KasliTester(EnvExperiment):
self.grabber_capture(card_dev, rois) self.grabber_capture(card_dev, rois)
def run(self): def run(self):
print("****** Kasli system tester ******") print("****** Sinara system tester ******")
print("") print("")
self.core.reset() self.core.reset()
if self.leds: if self.leds:
@ -382,3 +382,18 @@ class KasliTester(EnvExperiment):
self.test_zotinos() self.test_zotinos()
if self.grabbers: if self.grabbers:
self.test_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()

View File

@ -28,6 +28,7 @@ console_scripts = [
"artiq_master = artiq.frontend.artiq_master:main", "artiq_master = artiq.frontend.artiq_master:main",
"artiq_mkfs = artiq.frontend.artiq_mkfs:main", "artiq_mkfs = artiq.frontend.artiq_mkfs:main",
"artiq_rtiomon = artiq.frontend.artiq_rtiomon: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_session = artiq.frontend.artiq_session:main",
"artiq_route = artiq.frontend.artiq_route:main", "artiq_route = artiq.frontend.artiq_route:main",
"artiq_run = artiq.frontend.artiq_run:main", "artiq_run = artiq.frontend.artiq_run:main",