atomiq.helper module¶
- atomiq.helper.get_class_by_name(name, relative_path=None)[source]¶
Resolve class by name
- Parameters:
name -- (str) "%s.%s" % (module.name, class.name)
- Returns:
(class)
- atomiq.helper.file_from_url(url)[source]¶
Load content from a file specified by a URL.
This can be every type of URL supported by pythons urllib (e.g. http://, file://, etc ). Giving the basic auth credentials in the URL in the form http://user:password@hostname:port/path is supported.
- Returns:
file handle on the file
- Parameters:
url (str)
- Return type:
IOBase
- atomiq.helper.component_dict(component)[source]¶
Extract the required information (id, type) from the entries of a component list defined in an AtomiqBlock/AtomiqExperiment
We allow entries in a components list of AtomiqExperiment/AtomiqBlock to be either just strings specifying the id of the component or tuples of the form (id, type) to require a specific type of the component with the given id. The type can also be a superclass of the specified component.
- Parameters:
component (str | tuple) -- entry of the component list
- Returns:
dictionary with keys "id" and and "type"
- Return type:
dict
- atomiq.helper.component_data(component_dict)[source]¶
- Parameters:
component_dict (dict)
- Return type:
str | tuple
- atomiq.helper.block_dict(blockdef)[source]¶
Extract the required information (class, map) from the entries of a block list defined in an AtomiqBlock/AtomiqExperiment
We allow entries in a blocks list of AtomiqExperiment/AtomiqBlock to be either just strings specifying the class of the AtomiqBlock to be imported or tuples of the form (class, ,map) to specify a mapping of the components in the experiment to the components in the block.
- Parameters:
blockdef (str | tuple) -- entry of the blocks list
- Returns:
dictionary with keys "class", "map", and "alias"
- Return type:
dict
- atomiq.helper.replace_member(obj, target, replacement)[source]¶
Replace a member (target) of an object (obj) with a different member (replacement). This is useful to change member functions of components at construction of the object depending on the configuration.
when running the legacy artiq compiler, every object has its own class and we can/have to modify the class. Otherwise, we just alter the object itself.
- Parameters:
target (str)
replacement (str)
- atomiq.helper.identity_float(x)[source]¶
- Parameters:
x (artiq.compiler.types.TMono('float', OrderedDict()))
- Return type:
artiq.compiler.types.TMono('float', OrderedDict())