master: basic automatic experiment list

This commit is contained in:
Sebastien Bourdeauducq 2015-02-21 20:34:31 -07:00
parent 4267e0deab
commit 651ed71b79
17 changed files with 43 additions and 17 deletions

2
.gitignore vendored
View File

@ -9,4 +9,4 @@ doc/manual/_build
/dist /dist
/*.egg-info /*.egg-info
/.coverage /.coverage
examples/results examples/master/results

View File

@ -40,7 +40,6 @@ def main():
pdb.hooks.append(simplephist) pdb.hooks.append(simplephist)
rtr = RTResults() rtr = RTResults()
repository = Repository() repository = Repository()
explist = FlatFileDB("explist.pyon")
if os.name == "nt": if os.name == "nt":
loop = asyncio.ProactorEventLoop() loop = asyncio.ProactorEventLoop()
@ -71,7 +70,6 @@ def main():
"master_pdb": pdb, "master_pdb": pdb,
"master_schedule": scheduler, "master_schedule": scheduler,
"master_repository": repository, "master_repository": repository,
"master_explist": explist
}) })
loop.run_until_complete(server_control.start( loop.run_until_complete(server_control.start(
args.bind, args.port_control)) args.bind, args.port_control))
@ -84,7 +82,7 @@ def main():
"parameters": pdb.data, "parameters": pdb.data,
"parameters_simplehist": simplephist.history, "parameters_simplehist": simplephist.history,
"rt_results": rtr.groups, "rt_results": rtr.groups,
"explist": explist.data "explist": repository.explist
}) })
loop.run_until_complete(server_notify.start( loop.run_until_complete(server_notify.start(
args.bind, args.port_notify)) args.bind, args.port_notify))

View File

@ -1,4 +1,33 @@
import os
from inspect import isclass
from artiq.protocols.sync_struct import Notifier
from artiq.tools import file_import
def scan_experiments():
r = dict()
for f in os.listdir("repository"):
if f.endswith(".py"):
try:
m = file_import(os.path.join("repository", f))
except:
continue
for k, v in m.__dict__.items():
if isclass(v) and hasattr(v, "__artiq_unit__"):
entry = {
"file": os.path.join("repository", f),
"unit": k,
"gui_file": getattr(v, "__artiq_gui_file__", None)
}
r[v.__artiq_unit__] = entry
return r
class Repository: class Repository:
def __init__(self):
self.explist = Notifier(scan_experiments())
def get_data(self, filename): def get_data(self, filename):
with open(filename) as f: with open(os.path.join("repository", filename)) as f:
return f.read() return f.read()

View File

@ -1,12 +0,0 @@
{
"Flopping F simulation": {
"file": "flopping_f_simulation.py",
"unit": null,
"gui_file": "flopping_f_simulation_gui.py"
},
"RTIO skew": {
"file": "rtio_skew.py",
"unit": null,
"gui_file": null
}
}

View File

@ -25,6 +25,7 @@ def model_numpy(xdata, F0):
class FloppingF(AutoDB): class FloppingF(AutoDB):
__artiq_unit__ = "Flopping F simulation" __artiq_unit__ = "Flopping F simulation"
__artiq_gui_file__ = "flopping_f_simulation_gui.py"
class DBKeys: class DBKeys:
implicit_core = False implicit_core = False

View File

@ -2,6 +2,8 @@ from artiq import *
class AluminumSpectroscopy(AutoDB): class AluminumSpectroscopy(AutoDB):
__artiq_unit__ = "Aluminum spectroscopy (simulation)"
class DBKeys: class DBKeys:
mains_sync = Device() mains_sync = Device()
laser_cooling = Device() laser_cooling = Device()

View File

@ -1,35 +1,42 @@
{ {
"core": { "core": {
"type": "local",
"module": "artiq.sim.devices", "module": "artiq.sim.devices",
"class": "Core", "class": "Core",
"arguments": {} "arguments": {}
}, },
"mains_sync": { "mains_sync": {
"type": "local",
"module": "artiq.sim.devices", "module": "artiq.sim.devices",
"class": "Input", "class": "Input",
"arguments": {"name": "mains_sync"} "arguments": {"name": "mains_sync"}
}, },
"pmt": { "pmt": {
"type": "local",
"module": "artiq.sim.devices", "module": "artiq.sim.devices",
"class": "Input", "class": "Input",
"arguments": {"name": "pmt"} "arguments": {"name": "pmt"}
}, },
"laser_cooling": { "laser_cooling": {
"type": "local",
"module": "artiq.sim.devices", "module": "artiq.sim.devices",
"class": "WaveOutput", "class": "WaveOutput",
"arguments": {"name": "laser_cooling"} "arguments": {"name": "laser_cooling"}
}, },
"spectroscopy": { "spectroscopy": {
"type": "local",
"module": "artiq.sim.devices", "module": "artiq.sim.devices",
"class": "WaveOutput", "class": "WaveOutput",
"arguments": {"name": "spectroscopy"} "arguments": {"name": "spectroscopy"}
}, },
"spectroscopy_b": { "spectroscopy_b": {
"type": "local",
"module": "artiq.sim.devices", "module": "artiq.sim.devices",
"class": "VoltageOutput", "class": "VoltageOutput",
"arguments": {"name": "spectroscopy_b"} "arguments": {"name": "spectroscopy_b"}
}, },
"state_detection": { "state_detection": {
"type": "local",
"module": "artiq.sim.devices", "module": "artiq.sim.devices",
"class": "WaveOutput", "class": "WaveOutput",
"arguments": {"name": "state_detection"} "arguments": {"name": "state_detection"}

1
examples/sim/pdb.pyon Normal file
View File

@ -0,0 +1 @@
{}