Skip to content

Base

Routine

Bases: RoutineBase

Result of parsing a completed Builder string.

RoutineParse

Bases: Parse

parse

parse() -> Routine

Parse the program to return a Routine object.

Returns:

Name Type Description
Routine Routine

The parsed routine object.

Raises:

Type Description
ValueError

If the routine cannot be parsed.

Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/base.py
29
30
31
32
def parse(self: "RoutineBase") -> "Routine":
    if self.source is None:
        raise ValueError("Cannot parse a routine without a source Builder.")
    return self

parse_circuit

parse_circuit() -> AnalogCircuit

Parse the analog circuit from the program.

Returns:

Name Type Description
AnalogCircuit AnalogCircuit

The parsed analog circuit.

Raises:

Type Description
ValueError

If the circuit cannot be parsed.

Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/base.py
26
27
def parse_circuit(self: "RoutineBase") -> AnalogCircuit:
    return self.circuit

parse_register

parse_register() -> (
    Union[AtomArrangement, ParallelRegister]
)

Parse the arrangement of atoms in the program.

Returns:

Type Description
Union[AtomArrangement, ParallelRegister]

Union[AtomArrangement, ParallelRegister]: The parsed atom arrangement or parallel register.

Raises:

Type Description
ValueError

If the register cannot be parsed.

Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/base.py
20
21
def parse_register(self: "RoutineBase") -> Union[AtomArrangement, ParallelRegister]:
    return self.circuit.register

parse_sequence

parse_sequence() -> Sequence

Parse the pulse sequence part of the program.

Returns:

Name Type Description
Sequence Sequence

The parsed pulse sequence.

Raises:

Type Description
ValueError

If the sequence cannot be parsed.

Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/base.py
23
24
def parse_sequence(self: "RoutineBase") -> Sequence:
    return self.circuit.sequence

RoutineShow

Bases: Show

show

show(*args, batch_index: int = 0)

Show an interactive plot of the routine.

int

which parameter set out of the batch to use. Default is 0. If there are no batch parameters, use 0.

*args: Any Specify the parameters that are defined in the .args([...]) build step.

Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/base.py
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
def show(self: "RoutineBase", *args, batch_index: int = 0):
    """Show an interactive plot of the routine.

    batch_index: int
        which parameter set out of the batch to use. Default is 0.
        If there are no batch parameters, use 0.

    *args: Any
        Specify the parameters that are defined in the `.args([...])` build step.

    """
    if self.source is None:
        raise ValueError("Cannot show a routine without a source Builder.")

    return self.source.show(*args, batch_id=batch_index)