forked from M-Labs/artiq
1
0
Fork 0

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
/*.egg-info
/.coverage
examples/results
examples/master/results

View File

@ -40,7 +40,6 @@ def main():
pdb.hooks.append(simplephist)
rtr = RTResults()
repository = Repository()
explist = FlatFileDB("explist.pyon")
if os.name == "nt":
loop = asyncio.ProactorEventLoop()
@ -71,7 +70,6 @@ def main():
"master_pdb": pdb,
"master_schedule": scheduler,
"master_repository": repository,
"master_explist": explist
})
loop.run_until_complete(server_control.start(
args.bind, args.port_control))
@ -84,7 +82,7 @@ def main():
"parameters": pdb.data,
"parameters_simplehist": simplephist.history,
"rt_results": rtr.groups,
"explist": explist.data
"explist": repository.explist
})
loop.run_until_complete(server_notify.start(
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:
def __init__(self):
self.explist = Notifier(scan_experiments())
def get_data(self, filename):
with open(filename) as f:
with open(os.path.join("repository", filename)) as f:
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):
__artiq_unit__ = "Flopping F simulation"
__artiq_gui_file__ = "flopping_f_simulation_gui.py"
class DBKeys:
implicit_core = False

View File

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

View File

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

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

@ -0,0 +1 @@
{}