compilation =========== .. py:module:: quantify_scheduler.compilation .. autoapi-nested-parse:: Compiler for the quantify_scheduler. Module Contents --------------- Classes ~~~~~~~ .. autoapisummary:: quantify_scheduler.compilation._ControlFlowReturn Functions ~~~~~~~~~ .. autoapisummary:: quantify_scheduler.compilation._determine_absolute_timing quantify_scheduler.compilation.determine_absolute_timing quantify_scheduler.compilation._get_start_time quantify_scheduler.compilation.resolve_control_flow quantify_scheduler.compilation.flatten_schedule quantify_scheduler.compilation._insert_op_at_time quantify_scheduler.compilation.validate_config quantify_scheduler.compilation._move_to_end Attributes ~~~~~~~~~~ .. autoapisummary:: quantify_scheduler.compilation.logger .. py:data:: logger .. py:class:: _ControlFlowReturn(t0: float = 0) Bases: :py:obj:`quantify_scheduler.operations.operation.Operation` An operation that signals the end of the current control flow statement. Cannot be added to Schedule manually. :param t0: time offset, by default 0 :type t0: float, optional .. py:function:: _determine_absolute_timing(schedule: quantify_scheduler.schedules.schedule.Schedule, time_unit: Literal[physical, ideal, None] = 'physical', config: quantify_scheduler.backends.graph_compilation.CompilationConfig | None = None) -> quantify_scheduler.schedules.schedule.Schedule Determine the absolute timing of a schedule based on the timing constraints. This function determines absolute timings for every operation in the :attr:`~.ScheduleBase.schedulables`. It does this by: 1. iterating over all and elements in the :attr:`~.ScheduleBase.schedulables`. 2. determining the absolute time of the reference operation - reference point :code:`"ref_pt"` of the reference operation defaults to :code:`"end"` in case it is not set (i.e., is :code:`None`). 3. determining the start of the operation based on the :code:`rel_time` and :code:`duration` of operations - reference point :code:`"ref_pt_new"` of the added operation defaults to :code:`"start"` in case it is not set. :param schedule: The schedule for which to determine timings. :param config: Compilation config for :class:`~quantify_scheduler.backends.graph_compilation.QuantifyCompiler`. :param time_unit: Whether to use physical units to determine the absolute time or ideal time. When :code:`time_unit == "physical"` the duration attribute is used. When :code:`time_unit == "ideal"` the duration attribute is ignored and treated as if it is :code:`1`. When :code:`time_unit == None` it will revert to :code:`"physical"`. :returns: The modified ``schedule`` where the absolute time for each operation has been determined. :raises NotImplementedError: If the scheduling strategy is not "asap" .. py:function:: determine_absolute_timing(schedule: quantify_scheduler.schedules.schedule.Schedule, time_unit: Literal[physical, ideal, None] = 'physical', config: quantify_scheduler.backends.graph_compilation.CompilationConfig | None = None) -> quantify_scheduler.schedules.schedule.Schedule Determine the absolute timing of a schedule based on the timing constraints. .. py:function:: _get_start_time(schedule: quantify_scheduler.schedules.schedule.Schedule, t_constr: dict[str, str | float], curr_op: quantify_scheduler.operations.operation.Operation | quantify_scheduler.schedules.schedule.Schedule, time_unit: str) -> float .. py:function:: resolve_control_flow(schedule: quantify_scheduler.schedules.schedule.Schedule, config: quantify_scheduler.backends.graph_compilation.CompilationConfig | None = None, port_clocks: set | None = None) -> quantify_scheduler.schedules.schedule.Schedule If control flow is used, insert virtual operations before and after the schedulable. :param schedule: The schedule for which to fill relative timings. :param config: Compilation config for :class:`~quantify_scheduler.backends.graph_compilation.QuantifyCompiler`, which is currently not used in this compilation step. :param port_clocks: Port-clock combinations to be used for control flow. Determined automatically for the outermost schedule. :returns: a new schedule object where the timing constraints for each operation have been determined. .. py:function:: flatten_schedule(schedule: quantify_scheduler.schedules.schedule.Schedule, config: quantify_scheduler.backends.graph_compilation.CompilationConfig | None = None) -> quantify_scheduler.schedules.schedule.Schedule Recursively flatten subschedules based on the absolute timing. :param schedule: schedule to be flattened :type schedule: Schedule :param config: Compilation config for :class:`~quantify_scheduler.backends.graph_compilation.QuantifyCompiler`, which is currently not only used to detect if the function is called directly. by default None :type config: CompilationConfig | None, optional :returns: Equivalent schedule without subschedules :rtype: Schedule .. py:function:: _insert_op_at_time(schedule: quantify_scheduler.schedules.schedule.Schedule, operation: quantify_scheduler.operations.operation.Operation, abs_time: float) -> None .. py:function:: validate_config(config: dict, scheme_fn: str) -> bool Validate a configuration using a schema. :param config: The configuration to validate :param scheme_fn: The name of a json schema in the quantify_scheduler.schemas folder. :returns: True if valid .. py:function:: _move_to_end(ordered_dict: dict, key: Any) -> None Moves the element with ``key`` to the end of the dict. Note: dictionaries from Python 3.7 are ordered.