forked from M-Labs/artiq
master,run: pass run_params to experiment
This commit is contained in:
parent
4d21b78314
commit
0dd5692c32
@ -137,7 +137,16 @@ def main():
|
||||
print("Failed to parse run arguments")
|
||||
sys.exit(1)
|
||||
|
||||
unit_inst = unit(dbh, scheduler=DummyScheduler(), **arguments)
|
||||
run_params = {
|
||||
"file": args.file,
|
||||
"unit": args.unit,
|
||||
"timeout": None,
|
||||
"arguments": arguments
|
||||
}
|
||||
unit_inst = unit(dbh,
|
||||
scheduler=DummyScheduler(),
|
||||
run_params=run_params,
|
||||
**run_params["arguments"])
|
||||
unit_inst.run()
|
||||
if hasattr(unit_inst, "analyze"):
|
||||
unit_inst.analyze()
|
||||
|
@ -81,8 +81,8 @@ def get_unit(file, unit):
|
||||
return getattr(module, unit)
|
||||
|
||||
|
||||
def run(obj):
|
||||
unit = get_unit(obj["file"], obj["unit"])
|
||||
def run(run_params):
|
||||
unit = get_unit(run_params["file"], run_params["unit"])
|
||||
|
||||
realtime_results = unit.realtime_results()
|
||||
init_rt_results(realtime_results)
|
||||
@ -100,7 +100,10 @@ def run(obj):
|
||||
dbh = DBHub(ParentDDB, ParentPDB, rdb)
|
||||
try:
|
||||
try:
|
||||
unit_inst = unit(dbh, scheduler=Scheduler, **obj["arguments"])
|
||||
unit_inst = unit(dbh,
|
||||
scheduler=Scheduler,
|
||||
run_params=run_params,
|
||||
**run_params["arguments"])
|
||||
unit_inst.run()
|
||||
if hasattr(unit_inst, "analyze"):
|
||||
unit_inst.analyze()
|
||||
@ -114,7 +117,7 @@ def run(obj):
|
||||
finally:
|
||||
dbh.close()
|
||||
|
||||
filename = obj["file"] + ".h5"
|
||||
filename = run_params["file"] + ".h5"
|
||||
f = h5py.File(filename, "w")
|
||||
try:
|
||||
rdb.write_hdf5(f)
|
||||
|
@ -52,15 +52,7 @@ class FloppingF(AutoDB):
|
||||
self.frequency.append(frequency)
|
||||
self.brightness.append(brightness)
|
||||
time.sleep(0.1)
|
||||
|
||||
run_params = {
|
||||
"file": "flopping_f_simulation.py",
|
||||
"unit": None,
|
||||
"timeout": None,
|
||||
"arguments": dict(),
|
||||
"rtr_group": "flopping_f_simulation.py"
|
||||
}
|
||||
self.scheduler.run_timed(run_params, time.time() + 20)
|
||||
self.scheduler.run_timed(self.run_params, time.time() + 20)
|
||||
|
||||
def analyze(self):
|
||||
popt, pcov = curve_fit(model_numpy,
|
||||
|
Loading…
Reference in New Issue
Block a user