atomiq.components

Submodules

Attributes

Classes

Component

An atomiq Component

Remote

ComponentFactory

Functions

get_class_by_name(name[, relative_path])

Resolve class by name

_create_device_replace(desc, device_mgr, *args, **kwargs)

build_object_from_device_db(parent, object_id)

build_object_hero(parent, object_id)

_collect_shape_changing_arguments(cls)

Collect the names of all shape changing arguments along the inheritance hierarchy

_argument_shape(value[, value_changes_shape])

Compute the shape of a component argument for the class signature.

build_object(classname, arg_dict)

Package Contents

atomiq.components.get_class_by_name(name, relative_path=None)[source]

Resolve class by name

Parameters:

name -- (str) "%s.%s" % (module.name, class.name)

Returns:

(class)

class atomiq.components.Component(parent, identifier, debug_output=False, *args, **kwargs)[source]

Bases: artiq.language.environment.HasEnvironment

An atomiq Component

Every component in atomiq inherits from this class. It provides basic functionality for automatic and recursive building and initialization of components (prepare, build, prerun). It also takes care for joining kernel invariants along the inheritance tree.

Note

The arguments parent and identifier are automatically passed to the component object by the atomiq object builder.

Parameters:
  • parent -- The parent context of the component. Usually this is the experiment that uses the component

  • identifier (str) -- A unique name to identify the component.

  • debug_output (bool) -- Set whether the component should show debug output. Using this switch rather than the debug kernel logger can allow the compiler to not include the debug commands in the kernel code if the output is not needed.

kernel_invariants
_shape_changing_arguments: tuple = ()

Names of the constructor arguments whose value (not only their type) changes the shape of the component, i.e. change the types and signatures of class members. The component factory gives objects of the same shape a shared class (and thus a shared compiler specialization). Arguments listed here are compared by value. Definitions along the inheritance hierarchy are merged.

experiment
identifier
debug_output = False
core
_kernel_invariants
_prepare_done = False
_build_done = False
_hooks_done = []
_recursive_prepare()[source]
_prepare()[source]

Specify here what should be done for this component in the prepare phase

_recursive_build()[source]
_build()[source]

Specify here what should be done for this component in the build phase

_do_prerun()[source]
required_components(ancestors=[])[source]
_prerun()[source]

Specify here what should be done for this component before the run starts. In contrast to the _build() method, the _prerun() routine is executed on the core device before the actual experiment starts.

children = []
__in_build = True
class atomiq.components.Remote(remote_reference, sync=False)[source]
Parameters:
  • remote_reference (str)

  • sync (bool)

remote_reference
sync = False
atomiq.components.heros
atomiq.components.RemoteHERO[source]
atomiq.components.logger
atomiq.components.components = None
atomiq.components.suservo_replacements = []
atomiq.components._create_device_replace(desc, device_mgr, *args, **kwargs)[source]
atomiq.components.build_object_from_device_db(parent, object_id)[source]
atomiq.components.build_object_hero(parent, object_id)[source]
atomiq.components._shape_class_cache
atomiq.components._collect_shape_changing_arguments(cls)[source]

Collect the names of all shape changing arguments along the inheritance hierarchy

Return type:

set

atomiq.components._argument_shape(value, value_changes_shape=False)[source]

Compute the shape of a component argument for the class signature.

The shape captures everything about an argument that can influence the types of the attributes of the constructed component. The legacy artiq compiler requires these attribute types to be identical for all objects sharing a class:

  • plain values contribute their artiq type class (bool/int width/float/str/none)

  • sequences contribute their element shapes, numpy arrays their dtype and shape

  • objects (devices, other components) contribute their class name

  • arguments listed in _shape_changing_arguments additionally contribute their value, as their value selects attribute types or class members at build time

Parameters:

value_changes_shape (bool)

atomiq.components.build_object(classname, arg_dict)[source]
class atomiq.components.ComponentFactory[source]
static produce(name, parent)[source]
static _produce_from_dict(identifier, parent, dictionary)[source]