2015-06-24 16:46:15 +08:00
|
|
|
"""
|
|
|
|
The :mod:`prelude` module contains the initial global environment
|
|
|
|
in which ARTIQ kernels are evaluated.
|
|
|
|
"""
|
|
|
|
|
|
|
|
from . import builtins
|
|
|
|
|
|
|
|
def globals():
|
|
|
|
return {
|
2015-08-31 23:59:33 +08:00
|
|
|
# Value constructors
|
2015-07-23 06:26:50 +08:00
|
|
|
"bool": builtins.fn_bool(),
|
|
|
|
"int": builtins.fn_int(),
|
|
|
|
"float": builtins.fn_float(),
|
|
|
|
"list": builtins.fn_list(),
|
|
|
|
"range": builtins.fn_range(),
|
2015-08-31 23:59:33 +08:00
|
|
|
|
|
|
|
# Exception constructors
|
2015-07-23 06:26:50 +08:00
|
|
|
"Exception": builtins.fn_Exception(),
|
|
|
|
"IndexError": builtins.fn_IndexError(),
|
|
|
|
"ValueError": builtins.fn_ValueError(),
|
|
|
|
"ZeroDivisionError": builtins.fn_ZeroDivisionError(),
|
2015-08-31 23:59:33 +08:00
|
|
|
|
|
|
|
# Built-in Python functions
|
2015-07-23 06:26:50 +08:00
|
|
|
"len": builtins.fn_len(),
|
|
|
|
"round": builtins.fn_round(),
|
|
|
|
"print": builtins.fn_print(),
|
2015-08-31 23:59:33 +08:00
|
|
|
|
|
|
|
# ARTIQ decorators
|
2015-08-07 12:54:35 +08:00
|
|
|
"kernel": builtins.fn_kernel(),
|
2015-08-31 23:59:33 +08:00
|
|
|
|
2015-09-03 07:46:09 +08:00
|
|
|
# ARTIQ context managers
|
2015-12-10 23:03:28 +08:00
|
|
|
"parallel": builtins.obj_parallel(),
|
|
|
|
"sequential": builtins.obj_sequential(),
|
2015-09-03 07:46:09 +08:00
|
|
|
|
2015-08-31 23:59:33 +08:00
|
|
|
# ARTIQ time management functions
|
|
|
|
"now": builtins.fn_now(),
|
|
|
|
"delay": builtins.fn_delay(),
|
|
|
|
"at": builtins.fn_at(),
|
|
|
|
"now_mu": builtins.fn_now_mu(),
|
|
|
|
"delay_mu": builtins.fn_delay_mu(),
|
|
|
|
"at_mu": builtins.fn_at_mu(),
|
|
|
|
"mu_to_seconds": builtins.fn_mu_to_seconds(),
|
|
|
|
"seconds_to_mu": builtins.fn_seconds_to_mu(),
|
2015-06-24 16:46:15 +08:00
|
|
|
}
|