-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
enhancementNew feature or requestNew feature or request
Description
As per our discussion, @mcgeorge102938 , here's the sample file we whipped up (storing here so I don't have to keep track of it on my computer)
# autogator's __init__'
__CONFIG_DIR__ = appdirs.path
# registry.py
from autogator import __CONFIG_DIR__
if __CONFIG_DIR__ / "register.yaml" exists:
load(item in config_dir)
class Registry:
def __init__(self):
self.register = {}
def register(self, name, device):
self.register[name] = device
def get(self, name):
return device
def save(self):
# writes configuration/registry to the yaml config file
pass
class LocalDevice:
pass
class PyrolabDevice:
pass
registry = Registry()
# In scripts, we could then do something like this:
from autogator.registry import registry
registry.register("laser", LocalDevice("lasers.tsl550"))
registry.register("motion_x", PyrolabDevice("motion.kcubes.bpc303"))
registry.register("motion_y", LocalDevice(34878427))
motionstage = registry.get('motion_y')
motionstage.jog(0.1)
# experiment.py
class Experiment:
def __init__(self):
self.instruments = registry.get_instruments()
def run(self):
raise NotImplementedError
class MyExperiment(Experiment):
def run():
laser = self.instruments['laser']
laser.sweep()
scope.acquire()
# Future testrunner for batched tests
from autogator import testrunner
testrunner.add_test(MyExperiment)
testrunner.run_all()
"""
Review
------
* Naming conventions
* Logical modules
* tests folder
* examples folder
* Clean up parser
* Installation directory, pyyaml config files, persisting devices
1. refactor
2. example
3. test framework
4. added features (persistence, registry, testrunner)
"""
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request