forked from M-Labs/artiq
environment: cleanup docs
This commit is contained in:
parent
9b4a04b307
commit
f962092b38
|
@ -146,8 +146,8 @@ class StringValue(_SimpleArgProcessor):
|
||||||
|
|
||||||
|
|
||||||
class HasEnvironment:
|
class HasEnvironment:
|
||||||
"""Provides methods to manage the environment of an experiment (devices,
|
"""Provides methods to manage the environment of an experiment (arguments,
|
||||||
parameters, results, arguments)."""
|
devices, datasets)."""
|
||||||
def __init__(self, device_mgr=None, dataset_mgr=None, *, parent=None,
|
def __init__(self, device_mgr=None, dataset_mgr=None, *, parent=None,
|
||||||
default_arg_none=False, enable_processors=False, **kwargs):
|
default_arg_none=False, enable_processors=False, **kwargs):
|
||||||
self.requested_args = OrderedDict()
|
self.requested_args = OrderedDict()
|
||||||
|
@ -170,11 +170,12 @@ class HasEnvironment:
|
||||||
def build(self):
|
def build(self):
|
||||||
"""Must be implemented by the user to request arguments.
|
"""Must be implemented by the user to request arguments.
|
||||||
|
|
||||||
Other initialization steps such as requesting devices and parameters
|
Other initialization steps such as requesting devices may also be
|
||||||
or initializing real-time results may also be performed here.
|
performed here.
|
||||||
|
|
||||||
When the repository is scanned, any requested devices and parameters
|
When the repository is scanned, any requested devices and arguments
|
||||||
are set to ``None``."""
|
are set to ``None``.
|
||||||
|
"""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def managers(self):
|
def managers(self):
|
||||||
|
@ -191,6 +192,8 @@ class HasEnvironment:
|
||||||
def get_argument(self, key, processor=None, group=None):
|
def get_argument(self, key, processor=None, group=None):
|
||||||
"""Retrieves and returns the value of an argument.
|
"""Retrieves and returns the value of an argument.
|
||||||
|
|
||||||
|
This function should only be called from ``build``.
|
||||||
|
|
||||||
:param key: Name of the argument.
|
:param key: Name of the argument.
|
||||||
:param processor: A description of how to process the argument, such
|
:param processor: A description of how to process the argument, such
|
||||||
as instances of ``BooleanValue`` and ``NumberValue``.
|
as instances of ``BooleanValue`` and ``NumberValue``.
|
||||||
|
@ -308,7 +311,7 @@ class HasEnvironment:
|
||||||
|
|
||||||
|
|
||||||
class Experiment:
|
class Experiment:
|
||||||
"""Base class for experiments.
|
"""Base class for top-level experiments.
|
||||||
|
|
||||||
Deriving from this class enables automatic experiment discovery in
|
Deriving from this class enables automatic experiment discovery in
|
||||||
Python modules.
|
Python modules.
|
||||||
|
@ -354,15 +357,15 @@ class Experiment:
|
||||||
|
|
||||||
|
|
||||||
class EnvExperiment(Experiment, HasEnvironment):
|
class EnvExperiment(Experiment, HasEnvironment):
|
||||||
"""Base class for experiments that use the ``HasEnvironment`` environment
|
"""Base class for top-level experiments that use the ``HasEnvironment``
|
||||||
manager.
|
environment manager.
|
||||||
|
|
||||||
Most experiment should derive from this class."""
|
Most experiment should derive from this class."""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
||||||
def is_experiment(o):
|
def is_experiment(o):
|
||||||
"""Checks if a Python object is an instantiable user experiment."""
|
"""Checks if a Python object is a top-level experiment class."""
|
||||||
return (isclass(o)
|
return (isclass(o)
|
||||||
and issubclass(o, Experiment)
|
and issubclass(o, Experiment)
|
||||||
and o is not Experiment
|
and o is not Experiment
|
||||||
|
|
Loading…
Reference in New Issue