RB_C6
module-attribute
RB_C6 = 2 * pi * 862690
The C6 constant for the Rydberg Interaction of two Rubidium atoms in units of: rad μm^6/μs
start
module-attribute
start = ListOfLocations()
A Program starting point, alias of empty
[ListOfLocations
][bloqade.ir.location.list.ListOfLocations].
- Next possible steps to build your program are:
- Specify which level coupling to address with:
start.rydberg
: for [Rydberg
][bloqade.builder.coupling.Rydberg] Level couplingstart.hyperfine
: for [Hyperfine
][bloqade.builder.coupling.Hyperfine] Level coupling- LOCKOUT: You cannot add atoms to your geometry after specifying level coupling.
- continue/start building your geometry with:
start.add_position()
: to add atom(s) to current register. It will accept:- A single coordinate, represented as a tuple (e.g.
(5,6)
) with a value that can either be:- integers:
(5,6)
- floats:
(5.1, 2.5)
- strings (for later variable assignment):
("x", "y")
- [
Scalar
][bloqade.ir.scalar.Scalar] objects:(2*cast("x"), 5+cast("y"))
- integers:
- A list of coordinates, represented as a list of types mentioned previously.
- A numpy array with shape (n, 2) where n is the total number of atoms
- A single coordinate, represented as a tuple (e.g.
Literal
Bases: Real
value
instance-attribute
value: Decimal
Scalar Literal, which stores a decimaal value instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
Decimal
|
decimal value instance |
required |
Variable
Bases: Real
Variable, which stores a variable name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
variable instance. |
required |
cast
cast(py) -> Scalar
-
cast Real number (or list/tuple of Real numbers) to [
Scalar Literal
][bloqade.ir.scalar.Literal]. -
cast str (or list/tuple of Real numbers) to [
Scalar Variable
][bloqade.ir.scalar.Variable].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
py
|
Union[str, Real, Tuple[Real], List[Real]]
|
python object to cast |
required |
Returns:
Type | Description |
---|---|
Scalar
|
Scalar |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/scalar.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
|
constant
constant(
duration: ScalarType, value: ScalarType
) -> Constant
Create a Constant waveform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
duration
|
ScalarType
|
Duration of the Constant waveform. |
required |
value
|
ScalarType
|
Value of the Constant waveform.s |
required |
Returns:
Name | Type | Description |
---|---|---|
Constant |
Constant
|
A Constant waveform. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/factory.py
57 58 59 60 61 62 63 64 65 66 67 68 |
|
dumps
dumps(
o: Any, use_decimal: bool = True, **json_kwargs
) -> str
Serialize object to string
Parameters:
Name | Type | Description | Default |
---|---|---|---|
o
|
Any
|
the object to serialize |
required |
use_decimal
|
bool
|
use decimal.Decimal for numbers. Defaults to True. |
True
|
**json_kwargs
|
other arguments passed to json.dumps |
{}
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
the serialized object as a string |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/serialize.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
get_capabilities
get_capabilities(
use_experimental: bool = False,
) -> QuEraCapabilities
Get the device capabilities for Aquila
Parameters:
Name | Type | Description | Default |
---|---|---|---|
use_experimental
|
bool
|
Get experimental capabilities instead of standard ones. By default value is False. |
False
|
Returns:
Name | Type | Description |
---|---|---|
QuEraCapabilities |
QuEraCapabilities
|
capabilities object for Aquila device. |
Note
Units of time, distance, and energy are microseconds (us), micrometers (um), and rad / us, respectively.
For a comprehensive list of capabilities, see the Hardware Reference page
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/factory.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
linear
linear(
duration: ScalarType,
start: ScalarType,
stop: ScalarType,
) -> Linear
Create a Linear waveform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
duration
|
ScalarType
|
Duration of linear waveform |
required |
start
|
ScalarType
|
Starting value of linear waveform |
required |
stop
|
ScalarType
|
Ending value of linear waveform |
required |
Returns:
Name | Type | Description |
---|---|---|
Linear |
Linear
|
Linear waveform |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/factory.py
42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
load
load(
fp: Union[TextIO, str],
use_decimal: bool = True,
**json_kwargs
)
Load object from file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp
|
Union[TextIO, str]
|
the file path or file object |
required |
use_decimal
|
bool
|
use decimal.Decimal for numbers. Defaults to True. |
True
|
**json_kwargs
|
other arguments passed to json.load |
{}
|
Returns:
Name | Type | Description |
---|---|---|
Any |
the deserialized object |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/serialize.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
loads
loads(s: str, use_decimal: bool = True, **json_kwargs)
Load object from string
Parameters:
Name | Type | Description | Default |
---|---|---|---|
s
|
str
|
the string to load |
required |
use_decimal
|
bool
|
use decimal.Decimal for numbers. Defaults to True. |
True
|
**json_kwargs
|
other arguments passed to json.loads |
{}
|
Returns:
Name | Type | Description |
---|---|---|
Any |
the deserialized object |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/serialize.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
piecewise_constant
piecewise_constant(
durations: List[ScalarType], values: List[ScalarType]
) -> Waveform
Create a piecewise linear waveform.
Create a piecewise constant waveform from a list of durations and values. The
value duration[i]
corresponds to the length of time for the i'th segment
with a value of values[i]
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
durations
|
List[ScalarType]
|
The duration of each segment |
required |
values
|
List[ScalarType]
|
The values for each segment |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the length of |
Returns:
Name | Type | Description |
---|---|---|
Waveform |
Waveform
|
The piecewise linear waveform. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/factory.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
piecewise_linear
piecewise_linear(
durations: List[ScalarType], values: List[ScalarType]
) -> Waveform
Create a piecewise linear waveform.
Create a piecewise linear waveform from a list of durations and values. The
value duration[i]
is of the linear segment between values[i]
and values[i+1]
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
durations
|
List[ScalarType]
|
The duration of each segment |
required |
values
|
List[ScalarType]
|
The values for each segment |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the length of |
Returns:
Name | Type | Description |
---|---|---|
Waveform |
Waveform
|
The piecewise linear waveform. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/factory.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
rydberg_h
rydberg_h(
atoms_positions: Any,
detuning: Optional[Waveform] = None,
amplitude: Optional[Waveform] = None,
phase: Optional[Waveform] = None,
static_params: Dict[str, Any] = {},
batch_params: Union[
List[Dict[str, Any]], Dict[str, Any]
] = [],
args: List[str] = [],
) -> Routine
Create a rydberg program with uniform detuning, amplitude, and phase.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
atoms_positions
|
Any
|
Description of geometry of atoms in system. |
required |
detuning
|
Optional[Waveform]
|
Waveform for detuning. Defaults to None. |
None
|
amplitude
|
Optional[Waveform]
|
Waveform describing the amplitude of the rabi term. Defaults to None. |
None
|
phase
|
Optional[Waveform]
|
Waveform describing the phase of rabi term. Defaults to None. |
None
|
static_params
|
Dict[str, Any]
|
Define static parameters of your program. Defaults to {}. |
{}
|
batch_params
|
Union[List[Dict[str, Any]], Dict[str, Any]]
|
Parmaters for a batch of tasks. Defaults to []. |
[]
|
args
|
List[str]
|
List of arguments to leave till runtime. Defaults to []. |
[]
|
Returns:
Name | Type | Description |
---|---|---|
Routine |
Routine
|
An object that can be used to dispatch a rydberg program to multiple backends. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/factory.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
save
save(
o: Any,
fp: Union[TextIO, str],
use_decimal=True,
**json_kwargs
) -> None
Serialize object to file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
o
|
Any
|
the object to serialize |
required |
fp
|
Union[TextIO, str]
|
the file path or file object |
required |
use_decimal
|
bool
|
use decimal.Decimal for numbers. Defaults to True. |
True
|
**json_kwargs
|
other arguments passed to json.dump |
{}
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/serialize.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
|
tree_depth
tree_depth(depth: int = None)
Setting globally maximum depth for tree printing
If depth=None
, return current depth.
If depth
is provided, setting current depth to depth
Parameters:
Name | Type | Description | Default |
---|---|---|---|
depth
|
int
|
the user specified depth. Defaults to None. |
None
|
Returns:
Name | Type | Description |
---|---|---|
int |
current updated depth |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/__init__.py
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
var
var(py: str) -> Variable
cast string (or list/tuple of strings)
to [Variable
][bloqade.ir.scalar.Variable].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
py
|
Union[str, List[str]]
|
a string or list/tuple of strings |
required |
Returns:
Type | Description |
---|---|
Variable
|
Union[Variable] |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/scalar.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|
atom_arrangement
AtomArrangement
AtomArrangement(parent: Optional[Builder] = None)
Bases: ProgramStart
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
n_atoms
property
n_atoms: int
number of atoms (filled sites) in the register.
n_dims
property
n_dims: int
number of dimensions in the register.
n_sites
property
n_sites: int
number of sites in the register.
n_vacant
property
n_vacant: int
number of vacant sites in the register.
add_position
add_position(
position: Union[
PositionArray,
List[Tuple[ScalarType, ScalarType]],
Tuple[ScalarType, ScalarType],
],
filling: Optional[
Union[BoolArray, List[bool], bool]
] = None,
) -> ListOfLocations
Add a position or multiple positions to a pre-existing geometry.
add_position
is capable of accepting:
- A single tuple for one atom coordinate: (1.0, 2.5)
- A list of tuples: `[(0.0, 1.0), (2.0,1.5), etc.]
- A numpy array of shape (N, 2) where N is the number of atoms
You may also intersperse variables anywhere a value may be present.
You can also pass in an optional argument which determines the atom "filling" (whether or not at a specified coordinate an atom should be present).
Usage Example:
# single coordinate
>>> reg = start.add_position((0,0))
# you may chain add_position calls
>>> reg_plus_two = reg.add_position([(2,2),(5.0, 2.1)])
# you can add variables anywhere a value may be present
>>> reg_with_var = reg_plus_two.add_position(("x", "y"))
# and specify your atom fillings
>>> reg_with_filling = reg_with_var.add_position([(3.1, 0.0), (4.1, 2.2)],
[True, False])
# alternatively you could use one boolean to specify
# all coordinates should be empty/filled
>>> reg_with_more_filling = reg_with_filling.add_positions([(3.1, 2.9),
(5.2, 2.2)], False)
- Next possible steps are:
- Continuing to build your geometry via:
...add_position(positions).add_position(positions)
: to add more positions...add_position(positions).apply_defect_count(n_defects)
: to randomly drop out n_atoms...add_position(positions).apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...add_position(positions).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...add_position(positions).rydberg
: to specify Rydberg coupling...add_position(positions).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...add_position(positions).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
|
apply_defect_count
apply_defect_count(
n_defects: int, rng: Generator = np.random.default_rng()
)
Drop n_defects
atoms from the geometry randomly. Internally this occurs
by setting certain sites to have a SiteFilling set to false indicating
no atom is present at the coordinate.
A default numpy-based Random Number Generator is used but you can explicitly override this by passing in your own.
Usage Example:
>>> from bloqade.analog.atom_arrangement import Chain
>>> import numpy as np
# set a custom seed for a numpy-based RNG
>>> custom_rng = np.random.default_rng(888)
# randomly remove two atoms from the geometry
>>> reg = Chain(11).apply_defect_count(2, custom_rng)
# you may also chain apply_defect_count calls
>>> reg.apply_defect_count(2, custom_rng)
# you can also use apply_defect_count on custom geometries
>>> from bloqade import start
>>> start.add_position([(0,0), (1,1)]).apply_defect_count(1, custom_rng)
- Next possible steps are:
- Continuing to build your geometry via:
...apply_defect_count(defect_counts).add_position(positions)
: to add more positions...apply_defect_count(defect_counts) .apply_defect_count(n_defects)
: to randomly drop out n_atoms...apply_defect_count(defect_counts) .apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...apply_defect_count(defect_counts).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...apply_defect_count(defect_counts).rydberg
: to specify Rydberg coupling...apply_defect_count(defect_counts).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...apply_defect_count(defect_counts).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
|
apply_defect_density
apply_defect_density(
defect_probability: float,
rng: Generator = np.random.default_rng(),
)
Drop atoms randomly with defect_probability
probability (range of 0 to 1).
Internally this occurs by setting certain sites to have a SiteFilling
set to false indicating no atom is present at the coordinate.
A default numpy-based Random Number Generator is used but you can explicitly override this by passing in your own.
Usage Example:
>>> from bloqade.analog.atom_arrangement import Chain
>>> import numpy as np
# set a custom seed for a numpy-based RNG
>>> custom_rng = np.random.default_rng(888)
# randomly remove two atoms from the geometry
>>> reg = Chain(11).apply_defect_density(0.2, custom_rng)
# you may also chain apply_defect_density calls
>>> reg.apply_defect_count(0.1, custom_rng)
# you can also use apply_defect_density on custom geometries
>>> from bloqade import start
>>> start.add_position([(0,0), (1,1)])
.apply_defect_density(0.5, custom_rng)
- Next possible steps are:
- Continuing to build your geometry via:
...apply_defect_count(defect_counts).add_position(positions)
: to add more positions...apply_defect_count(defect_counts).apply_defect_count(n_defects)
: to randomly drop out n_atoms...apply_defect_count(defect_counts) .apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...apply_defect_count(defect_counts).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...apply_defect_count(defect_counts).rydberg
: to specify Rydberg coupling...apply_defect_count(defect_counts).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...apply_defect_count(defect_counts).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
|
enumerate
enumerate() -> Generator[LocationInfo, None, None]
enumerate all locations in the register.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
128 129 130 |
|
figure
figure(fig_kwargs=None, **assignments)
obtain a figure object from the atom arrangement.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
132 133 134 |
|
rydberg_interaction
rydberg_interaction(**assignments) -> NDArray
calculate the Rydberg interaction matrix.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**assignments
|
the values to assign to the variables in the register. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
NDArray |
NDArray
|
the Rydberg interaction matrix in the lower triangular form. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
scale
scale(scale: ScalarType)
Scale the geometry of your atoms.
Usage Example:
>>> reg = start.add_position([(0,0), (1,1)])
# atom positions are now (0,0), (2,2)
>>> new_reg = reg.scale(2)
# you may also use scale on pre-defined geometries
>>> from bloqade.analog.atom_arrangement import Chain
# atoms in the chain will now be 2 um apart versus
# the default 1 um
>>> Chain(11).scale(2)
- Next possible steps are:
- Continuing to build your geometry via:
...add_position(positions).add_position(positions)
: to add more positions...add_position(positions).apply_defect_count(n_defects)
: to randomly drop out n_atoms...add_position(positions).apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...add_position(positions).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...add_position(positions).rydberg
: to specify Rydberg coupling...add_position(positions).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...add_position(positions).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
|
show
show(**assignments) -> None
Display the current program being defined with the given arguments and batch ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Additional arguments for display. |
()
|
|
batch_id
|
int
|
The batch ID to be displayed. Defaults to 0. |
0
|
Note
This method uses the display_builder
function to render the builder's state.
Example:
>>> class MyBuilder(Show):
... pass
>>> builder = MyBuilder()
>>> builder.show()
>>> builder.show(batch_id=1)
>>> builder.show('arg1', 'arg2', batch_id=2)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
136 137 |
|
Chain
Chain(
L: int,
*,
lattice_spacing: ScalarType = 1.0,
vertical_chain: bool = False
)
Bases: BoundedBravais
Chain lattice.
- 1D lattice
- primitive (cell) vector(s)
- a1 = (1,0).
- unit cell (1 atom(s))
- loc (0,0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L
|
int
|
number of sites in the chain |
required |
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
183 184 185 186 187 188 189 190 |
|
Honeycomb
Honeycomb(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Honeycomb lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (1/2, sqrt(3)/2)
- unit cell (2 atom(s))
- loc1 (0, 0)
- loc2 (1/2, 1/(2*sqrt(3))
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of unit cells in linear direction. n_atoms = L1 * L1 * 2. |
required |
L2
|
Optional[int]
|
number of unit cells in direction a2. n_atoms = L1 * L2 * 2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
420 421 422 423 424 425 426 427 428 429 430 431 |
|
Kagome
Kagome(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Kagome lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (1/2, sqrt(3)/2)
- unit cell (3 atom(s))
- loc1 (0, 0)
- loc2 (0.5, 0)
- loc3 (0.25 ,0.25sqrt(3))
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of sites in linear direction. n_atoms = 3 * L1 * L1. |
required |
L2
|
Optional[int]
|
number of unit cells along a2 direction, n_atoms = 3 * L1 * L2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
589 590 591 592 593 594 595 596 597 598 599 |
|
Lieb
Lieb(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Lieb lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (0, 1)
- unit cell (3 atom(s))
- loc1 (0, 0)
- loc2 (0.5, 0)
- loc3 (0 ,0.5)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of unit cells in linear direction. n_atoms = 3* L1 * L1. |
required |
L2
|
Optional[int]
|
number of unit cells along a2 direction, n_atoms = 3 * L1 * L2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
534 535 536 537 538 539 540 541 542 |
|
ListOfLocations
ListOfLocations(
location_list: List[
Union[LocationInfo, Tuple[ScalarType, ScalarType]]
] = [],
)
Bases: AtomArrangement
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 |
|
n_atoms
property
n_atoms
number of atoms (filled sites) in the register.
n_dims
property
n_dims
number of dimensions in the register.
n_sites
property
n_sites
number of sites in the register.
n_vacant
property
n_vacant
number of vacant sites in the register.
enumerate
enumerate()
enumerate all locations in the register.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
661 662 |
|
Rectangular
Rectangular(
width: int,
height: int,
*,
lattice_spacing_x: ScalarType = 1.0,
lattice_spacing_y: ScalarType = 1.0
)
Bases: BoundedBravais
Rectangular lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1,0)
- a2 = (0,1)
- unit cell (1 atom(s))
- loc (0,0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
number of sites in x direction. |
required |
height
|
int
|
number of sites in y direction. |
required |
lattice_spacing_x
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
lattice_spacing_y
|
(Scalar, Real)
|
lattice spacing in y direction. optional. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
|
Square
Square(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Square lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1,0)
- a2 = (0,1)
- unit cell (1 atom(s))
- loc (0,0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of sites in linear direction. n_atoms = L1 * L1. |
required |
L2
|
Optional[int]
|
number of sites in direction a2. n_atoms = L1 * L2, default is L1 |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
240 241 242 243 244 245 246 247 248 249 |
|
Triangular
Triangular(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Triangular lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (1/2, sqrt(3)/2)
- unit cell (1 atom(s))
- loc (0, 0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L
|
int
|
number of sites in linear direction. n_atoms = L * L. |
required |
L2
|
Optional[int]
|
number of sites along a2 direction, n_atoms = L1 * L2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
477 478 479 480 481 482 483 484 485 486 487 |
|
builder
backend
BackendRoute
BackendRoute(parent: Optional[Builder] = None)
Bases: QuEraService
, BraketService
, BloqadeService
Specify the backend to run your program on via a string
(versus more formal builder syntax) of specifying the vendor/product first
(Bloqade/Braket) and narrowing it down
(e.g: ...device("quera.aquila") versus ...quera.aquila())
- You can pass the following arguments:
- "braket.aquila"
- "braket.local_emulator"
- "bloqade.python"
- "bloqade.julia"
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
bloqade
BloqadeDeviceRoute
BloqadeDeviceRoute(parent: Optional[Builder] = None)
Bases: Builder
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
python
python()
Specify the Bloqade Python backend.
- Possible Next Steps:
...python().run(shots)
: to submit to the python emulator and await results
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/backend/bloqade.py
19 20 21 22 23 24 25 26 27 |
|
BloqadeService
BloqadeService(parent: Optional[Builder] = None)
Bases: Builder
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
bloqade
property
bloqade
Specify the Bloqade backend.
- Possible Next Steps:
...bloqade.python()
: target submission to the Bloqade python backend...bloqade.julia()
: (CURRENTLY NOT IMPLEMENTED!)target submission to the Bloqade.jl backend
braket
BraketDeviceRoute
BraketDeviceRoute(parent: Optional[Builder] = None)
Bases: Builder
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
aquila
aquila() -> BraketHardwareRoutine
Specify QuEra's Aquila QPU on Braket to submit your program to.
The number of shots you specify in the subsequent .run
method will either:
- dictate the number of times your program is run
- dictate the number of times per parameter your program is run if
you have a variable with batch assignments/intend to conduct
a parameter sweep
- Possible next steps are:
...aquila().run(shots)
: To submit to hardware and WAIT for results (blocking)...aquila().run_async(shots)
: To submit to hardware and immediately allow for other operations to occur
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/backend/braket.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
|
device
device(device_arn) -> BraketHardwareRoutine
Specify QPU based on the device ARN on Braket to submit your program to.
The number of shots you specify in the subsequent .run
method will either:
- dictate the number of times your program is run
- dictate the number of times per parameter your program is run if
you have a variable with batch assignments/intend to conduct
a parameter sweep
- Possible next steps are:
...device(arn).run(shots)
: To submit to hardware and WAIT for results (blocking)...device(arn).run_async(shots)
: To submit to hardware and immediately allow for other operations to occur
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/backend/braket.py
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
|
local_emulator
local_emulator() -> BraketLocalEmulatorRoutine
Specify the Braket local emulator to submit your program to.
- The number of shots you specify in the subsequent
.run
method will either:- dictate the number of times your program is run
- dictate the number of times per parameter your program is run if you have a variable with batch assignments/intend to conduct a parameter sweep
- Possible next steps are:
...local_emulator().run(shots)
: to submit to the emulator and await results
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/backend/braket.py
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 |
|
BraketService
BraketService(parent: Optional[Builder] = None)
Bases: Builder
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
braket
property
braket
Specify the Braket backend. This allows you to access the AWS Braket local emulator OR go submit things to QuEra hardware on AWS Braket service.
- Possible Next Steps are:
...braket.aquila()
: target submission to the QuEra Aquila QPU...braket.local_emulator()
: target submission to the Braket local emulator
quera
QuEraDeviceRoute
QuEraDeviceRoute(parent: Optional[Builder] = None)
Bases: Builder
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
aquila
aquila()
Specify QuEra's Aquila QPU
Return
QuEraHardwareRoutine
-
Possible Next:
->
...aquila().submit
:: submit aync remote job->
...aquila().run
:: submit job and wait until job finished and results returned->
...aquila().__callable__
:: submit job and wait until job finished and results returned
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/backend/quera.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
|
cloud_mock
cloud_mock()
Specify QuEra's Remote Mock QPU
Return
QuEraHardwareRoutine
-
Possible Next:
->
...aquila().submit
:: submit aync remote job->
...aquila().run
:: submit job and wait until job finished and results returned->
...aquila().__callable__
:: submit job and wait until job finished and results returned
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/backend/quera.py
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
custom
custom()
Specify custom backend
Return
CustomSubmissionRoutine
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/backend/quera.py
131 132 133 134 135 136 137 138 139 140 |
|
device
device(config_file: Optional[str] = None, **api_config)
Specify QuEra's QPU device,
Parameters:
Name | Type | Description | Default |
---|---|---|---|
config_file
|
str
|
file that speficy the target hardware |
None
|
Return
QuEraHardwareRoutine
-
Possible Next:
->
...device().submit
:: submit aync remote job->
...device().run
:: submit job and wait until job finished and results returned->
...device().__callable__
:: submit job and wait until job finished and results returned
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/backend/quera.py
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
mock
mock(
state_file: str = ".mock_state.txt",
submission_error: bool = False,
)
Specify mock, testing locally.
Return
QuEraHardwareRoutine
-
Possible Next:
->
...aquila().submit
:: submit aync remote job->
...aquila().run
:: submit job and wait until job finished and results returned->
...aquila().__callable__
:: submit job and wait until job finished and results returned
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/backend/quera.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
QuEraService
QuEraService(parent: Optional[Builder] = None)
Bases: Builder
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
quera
property
quera
- Specify Quera backend
-
Possible Next:
->
...quera.aquila
:: Aquila QPU->
...quera.mock
:: mock backend, meant for testings->
...quera.device
:: QuEra QPU, specifiy by config_file
coupling
Hyperfine
Hyperfine(parent: Optional[Builder] = None)
Bases: LevelCoupling
This node represents level coupling between hyperfine states.
Examples:
- To reach the node from the start node:
>>> node = bloqade.start.hyperfine
>>> type(node)
<class 'bloqade.builder.coupling.Hyperfine'>
- Hyperfine level coupling has two reachable field nodes:
- detuning term (See also [`Detuning`][bloqade.builder.field.Detuning])
- rabi term (See also [`Rabi`][bloqade.builder.field.Rabi])
>>> hyp_detune = bloqade.start.hyperfine.detuning
>>> hyp_rabi = bloqade.start.hyperfine.rabi
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
__bloqade_ir__
__bloqade_ir__()
Generate the intermediate representation (IR) for the Hyperfine level coupling.
Returns:
Name | Type | Description |
---|---|---|
IR |
An intermediate representation of the Hyperfine level coupling sequence. |
Note
This method is used internally by the Bloqade framework.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/coupling.py
127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|
LevelCoupling
LevelCoupling(parent: Optional[Builder] = None)
Bases: Builder
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
detuning
property
detuning: Detuning
Specify the [Detuning
][bloqade.builder.field.Detuning] [Field
][bloqade.builder.field.Field] of your program.
You will be able to specify the spatial modulation afterwards.
Returns:
Type | Description |
---|---|
Detuning
|
[ |
Note
The detuning specifies how off-resonant the laser being applied to the atoms is from the atomic energy transition, driven by the Rabi frequency.
Example:
from bloqade import start
geometry = start.add_position((0,0))
coupling = geometry.rydberg
coupling.detuning
- Next Possible Steps You may continue building your program via:
- [
uniform
][bloqade.builder.field.Detuning.uniform]: To address all atoms in the field - [
location(locations, scales)
][bloqade.builder.field.Detuning.location]: To address atoms at specific locations via indices - [
scale(coeffs)
][bloqade.builder.field.Detuning.scale]: To address all atoms with an individual scale factor
rabi
property
rabi: Rabi
Specify the complex-valued [Rabi
][bloqade.builder.field.Rabi]
field of your program.
The Rabi field is composed of a real-valued Amplitude and Phase field.
Returns:
Name | Type | Description |
---|---|---|
Rabi |
Rabi
|
A program node representing the Rabi field. |
Note
Next possible steps to build your program are
creating the RabiAmplitude field and RabiPhase field of the field:
- ...rabi.amplitude
: To create the Rabi amplitude field
- ...rabi.phase
: To create the Rabi phase field
Rydberg
Rydberg(parent: Optional[Builder] = None)
Bases: LevelCoupling
This node represents level coupling of the Rydberg state.
Examples:
- To reach the node from the start node:
>>> node = bloqade.start.rydberg
>>> type(node)
<class 'bloqade.builder.coupling.Rydberg'>
- Rydberg level coupling has two reachable field nodes:
- detuning term (See also [`Detuning`][bloqade.builder.field.Detuning])
- rabi term (See also [`Rabi`][bloqade.builder.field.Rabi])
>>> ryd_detune = bloqade.start.rydberg.detuning
>>> ryd_rabi = bloqade.start.rydberg.rabi
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
__bloqade_ir__
__bloqade_ir__()
Generate the intermediate representation (IR) for the Rydberg level coupling.
Returns:
Name | Type | Description |
---|---|---|
IR |
An intermediate representation of the Rydberg level coupling sequence. |
Note
This method is used internally by the Bloqade framework.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/coupling.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
drive
Drive
hyperfine
property
hyperfine: Hyperfine
Address the Hyperfine level coupling in your program.
- Next possible steps to build your program are specifying the
[
Rabi
][bloqade.builder.field.Rabi] field or [Detuning
][bloqade.builder.field.Detuning] field....hyperfine.rabi
: for Rabi field...hyperfine.detuning
: for Detuning field
- In the absence of a field you the value is set to zero by default.
rydberg
property
rydberg: Rydberg
Address the Rydberg level coupling in your program.
- Next possible steps to build your program are specifying the
[
Rabi
][bloqade.builder.field.Rabi] field or [Detuning
][bloqade.builder.field.Detuning] field....rydberg.rabi
: for Rabi field...rydberg.detuning
: for Detuning field
- In the absence of a field you the value is set to zero by default.
field
Detuning
Detuning(parent: Optional[Builder] = None)
Bases: Field
This node represent detuning field of a specified level coupling (rydberg or hyperfine) type.
Examples:
- To specify detuning of rydberg coupling:
>>> node = bloqade.start.rydberg.detuning
>>> type(node)
<class 'bloqade.builder.field.Detuning'>
- To specify detuning of hyperfine coupling:
>>> node = bloqade.start.hyperfine.detuning
>>> type(node)
<class 'bloqade.builder.field.Detuning'>
Note
This node is a SpatialModulation node.
See [SpatialModulation
][bloqade.builder.field.SpatialModulation]
for additional options.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
Field
Field(parent: Optional[Builder] = None)
Bases: Builder
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
uniform
property
uniform: Uniform
Address all atoms as part of defining the spatial modulation component of a drive.
Next steps to build your program include choosing the waveform that will be summed with the spatial modulation to create a drive.
The drive by itself, or the sum of subsequent drives (created by just chaining the construction of drives) will become the field (e.g. Detuning Field, Real-Valued Rabi Amplitude/Rabi Phase Field, etc.).
- You can now do:
...uniform.linear(start, stop, duration)
: to apply a linear waveform...uniform.constant(value, duration)
: to apply a constant waveform...uniform.poly([coefficients], duration)
: to apply a polynomial waveform...uniform.apply(wf:bloqade.ir.Waveform)
: to apply a pre-defined waveform...uniform.piecewise_linear([durations], [values])
: to apply a piecewise linear waveform...uniform.piecewise_constant([durations], [values])
: to apply a piecewise constant waveform...uniform.fn(f(t,...))
: to apply a function as a waveform
location
location(
labels: Union[List[int], int],
scales: Union[
List[ScalarType], ScalarType, None
] = None,
) -> Location
Address a single atom (or multiple) atoms.
Address a single atom (or multiple) as part of defining the spatial modulation component of a drive. You can specify the atoms to target as a list of labels and a list of scales. The scales are used to multiply the waveform that is applied to the atom. You can also specify a single label and scale to target a single atom.
Next steps to build your program include choosing the waveform that will be summed with the spatial modulation to create a drive.
The drive by itself, or the sum of subsequent drives (created by just chaining the construction of drives) will become the field. (e.g. Detuning Field, Real-Valued Rabi Amplitude/Rabi Phase Field, etc.)
Usage Example:
>>> prog = start.add_position([(0,0),(1,4),(2,8)]).rydberg.rabi
# to target a single atom with a waveform
>>> one_location_prog = prog.location(0)
# to target a single atom with a scale
>>> one_location_prog = prog.location(0, 0.5)
# to target multiple atoms with same waveform
>>> multi_location_prog = prog.location([0, 2])
# to target multiple atoms with different scales
>>> multi_location_prog = prog.location([0, 2], [0.5, "scale"])
- You can now do:
...location(labels, scales).linear(start, stop, duration)
: to apply a linear waveform...location(labels, scales).constant(value, duration)
: to apply a constant waveform...location(labels, scales).poly([coefficients], duration)
: to apply a polynomial waveform...location(labels, scales).apply(wf:bloqade.ir.Waveform)
: to apply a pre-defined waveform...location(labels, scales).piecewise_linear([durations], [values])
: to apply a piecewise linear waveform...location(labels, scales).piecewise_constant([durations], [values])
: to apply a piecewise constant waveform...location(labels, scales).fn(f(t,..))
: to apply a function as a waveform
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/field.py
63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
scale
scale(coeffs: Union[str, List[ScalarType]]) -> Scale
Address all the atoms scaling each atom with an element of the list
or define a variable name for the scale list to be assigned later by
defining a name
and using assign
or batch_assign
later.
Next steps to build your program include choosing the waveform that will be summed with the spatial modulation to create a drive.
The drive by itself, or the sum of subsequent drives (created by just chaining the construction of drives) will become the field (e.g. Detuning Field, Real-Valued Rabi Amplitude/Rabi Phase Field, etc.)
Usage Example:
>>> prog = start.add_position([(0,0),(1,4),(2,8)]).rydberg.rabi
# assign a literal list of values to scale each atom
>>> one_location_prog = prog.scale([0.1, 0.2, 0.3])
# assign a variable name to be assigned later
>>> one_location_prog = prog.scale("a")
# "a" can be assigned in the END of the program during variable assignment
# using a list of values, indicating the scaling for each atom
>>> single_assignment = ...assign(a = [0.1, 0.2, 0.3])
# a list of lists, indicating a set of atoms should be targeted
# for each task in a batch.
>>> batch_assignment = ...batch_assign(a = [list_1, list_2, list_3,...])
- You can now do:
...scale(coeffs).linear(start, stop, duration)
: to apply a linear waveform...scale(coeffs).constant(value, duration)
: to apply a constant waveform...scale(coeffs).poly([coefficients], duration)
: to apply a polynomial waveform...scale(coeffs).apply(wf:bloqade.ir.Waveform)
: to apply a pre-defined waveform...scale(coeffs).piecewise_linear(durations, values)
: to apply a piecewise linear waveform...scale(coeffs).piecewise_constant(durations, values)
: to apply a piecewise constant waveform...scale(coeffs).fn(f(t,..))
: to apply a function as a waveform
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/field.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 |
|
Rabi
Rabi(parent: Optional[Builder] = None)
Bases: Builder
This node represent rabi field of a specified level coupling (rydberg or hyperfine) type.
Examples:
- To specify rabi of rydberg coupling:
>>> node = bloqade.start.rydberg.rabi
<class 'bloqade.builder.field.Rabi'>
- To specify rabi of hyperfine coupling:
>>> node = bloqade.start.hyperfine.rabi
>>> type(node)
<class 'bloqade.builder.field.Rabi'>
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
amplitude
property
amplitude: RabiAmplitude
Specify the real-valued Rabi Amplitude field.
Next steps to build your program focus on specifying a spatial modulation.
The spatial modulation, when coupled with a waveform, completes the specification of a "Drive". One or more drives can be summed together automatically to create a field such as the Rabi Amplitude here.
- You can now
...amplitude.uniform
: Address all atoms in the field...amplitude.location(...)
: Scale atoms by their indices...amplitude.scale(...)
: Scale each atom with a value from a list or assign a variable name to be assigned later
phase
property
phase: RabiPhase
Specify the real-valued Rabi Phase field.
Next steps to build your program focus on specifying a spatial modulation.
The spatial modulation, when coupled with a waveform, completes the specification of a "Drive". One or more drives can be summed together automatically to create a field such as the Rabi Phase here.
- You can now
...amplitude.uniform
: Address all atoms in the field...amplitude.location(...)
: Scale atoms by their indices...amplitude.scale(...)
: Scale each atom with a value from a list or assign a variable name to be assigned later
RabiAmplitude
RabiAmplitude(parent: Optional[Builder] = None)
Bases: Field
This node represent amplitude of a rabi field.
Examples:
- To specify rabi amplitude of rydberg coupling:
>>> node = bloqade.start.rydberg.rabi.amplitude
>>> type(node)
<class 'bloqade.builder.field.Amplitude'>
- To specify rabi amplitude of hyperfine coupling:
>>> node = bloqade.start.hyperfine.rabi.amplitude
>>> type(node)
<class 'bloqade.builder.field.Amplitude'>
Note
This node is a SpatialModulation node.
See [SpatialModulation
][bloqade.builder.field.SpatialModulation]
for additional options.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
RabiPhase
RabiPhase(parent: Optional[Builder] = None)
Bases: Field
This node represent phase of a rabi field.
Examples:
- To specify rabi phase of rydberg coupling:
>>> node = bloqade.start.rydberg.rabi.phase
>>> type(node)
<class 'bloqade.builder.field.Phase'>
- To specify rabi phase of hyperfine coupling:
>>> node = bloqade.start.hyperfine.rabi.phase
>>> type(node)
<class 'bloqade.builder.field.Phase'>
Note
This node is a SpatialModulation node.
See [SpatialModulation
][bloqade.builder.field.SpatialModulation]
for additional options.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
parse
builder
Module for parsing builder definitions into intermediate representation (IR) using the bloqade library.
This module provides a Parser class for parsing various components of a quantum computing program, including atom arrangements, pulse sequences, analog circuits, and routines. It also defines utility functions for reading addresses, waveforms, drives, sequences, registers, and pragmas from a builder stream.
Parser
A class for parsing quantum computing program components into intermediate representation (IR).
parse
parse(builder: Builder) -> Routine
Parse a routine from the builder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
builder
|
Builder
|
The builder instance. |
required |
Returns:
Name | Type | Description |
---|---|---|
Routine |
Routine
|
The parsed routine. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/builder.py
302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 |
|
parse_circuit
parse_circuit(builder: Builder) -> AnalogCircuit
Parse an analog circuit from the builder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
builder
|
Builder
|
The builder instance. |
required |
Returns:
Name | Type | Description |
---|---|---|
AnalogCircuit |
AnalogCircuit
|
The parsed analog circuit. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/builder.py
282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 |
|
parse_register
parse_register(
builder: Builder,
) -> Union[ir.AtomArrangement, ir.ParallelRegister]
Parse an atom arrangement register from the builder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
builder
|
Builder
|
The builder instance. |
required |
Returns:
Type | Description |
---|---|
Union[AtomArrangement, ParallelRegister]
|
Union[ir.AtomArrangement, ir.ParallelRegister]: The parsed atom arrangement or parallel register. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/builder.py
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 |
|
parse_sequence
parse_sequence(builder: Builder) -> ir.Sequence
Parse a sequence from the builder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
builder
|
Builder
|
The builder instance. |
required |
Returns:
Type | Description |
---|---|
Sequence
|
ir.Sequence: The parsed sequence. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/builder.py
268 269 270 271 272 273 274 275 276 277 278 279 280 |
|
read_address
read_address(
stream,
) -> Tuple[LevelCoupling, Field, BuilderNode]
Read an address from the builder stream.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
stream
|
The builder stream. |
required |
Returns:
Type | Description |
---|---|
Tuple[LevelCoupling, Field, BuilderNode]
|
Tuple[LevelCoupling, Field, BuilderNode]: A tuple containing the level coupling, field, and spatial modulation. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/builder.py
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
|
read_drive
read_drive(head) -> ir.Field
Read a drive from the builder stream.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
head
|
The head of the builder stream. |
required |
Returns:
Type | Description |
---|---|
Field
|
ir.Field: The drive field. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/builder.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 |
|
read_pragmas
read_pragmas() -> None
Read pragmas from the builder stream.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/builder.py
206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 |
|
read_register
read_register() -> ir.AtomArrangement
Read an atom arrangement register from the builder stream.
Returns:
Type | Description |
---|---|
AtomArrangement
|
ir.AtomArrangement: The parsed atom arrangement. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/builder.py
193 194 195 196 197 198 199 200 201 202 203 204 |
|
read_sequence
read_sequence() -> ir.Sequence
Read a sequence from the builder stream.
Returns:
Type | Description |
---|---|
Sequence
|
ir.Sequence: The parsed sequence. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/builder.py
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 |
|
read_waveform
read_waveform(
head: BuilderNode,
) -> Tuple[ir.Waveform, BuilderNode]
Read a waveform from the builder stream.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
head
|
BuilderNode
|
The head of the builder stream. |
required |
Returns:
Type | Description |
---|---|
Tuple[Waveform, BuilderNode]
|
Tuple[ir.Waveform, BuilderNode]: A tuple containing the waveform and the next builder node. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/builder.py
85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
reset
reset(builder: Builder)
Reset the parser's state.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/builder.py
40 41 42 43 44 45 46 47 48 |
|
stream
Module for managing a stream of builder nodes.
This module provides classes to represent builder nodes and builder streams. A builder node is a single element in the stream, representing a step in a construction process. A builder stream is a sequence of builder nodes, allowing traversal and manipulation of the construction steps.
BuilderNode
dataclass
BuilderNode(
node: Builder, next: Optional[BuilderNode] = None
)
A node in the builder stream.
__repr__
__repr__() -> str
Representation of the BuilderNode.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/stream.py
22 23 24 |
|
BuilderStream
dataclass
BuilderStream(
head: BuilderNode, curr: Optional[BuilderNode] = None
)
Represents a stream of builder nodes.
__iter__
__iter__()
Iterator method to iterate over the builder stream.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/stream.py
87 88 89 |
|
__next__
__next__()
Next method to get the next item in the builder stream.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/stream.py
91 92 93 94 95 96 |
|
build_nodes
staticmethod
build_nodes(node: Builder) -> BuilderNode
Build BuilderNode instances from the provided Builder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
node
|
Builder
|
The root Builder instance. |
required |
Returns:
Name | Type | Description |
---|---|---|
BuilderNode |
BuilderNode
|
The head of the linked list of BuilderNodes. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/stream.py
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
|
copy
copy() -> BuilderStream
Create a copy of the builder stream.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/stream.py
34 35 36 |
|
create
staticmethod
create(builder: Builder) -> BuilderStream
Create a BuilderStream instance from a Builder.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
builder
|
Builder
|
The root Builder instance. |
required |
Returns:
Name | Type | Description |
---|---|---|
BuilderStream |
BuilderStream
|
The created BuilderStream instance. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/stream.py
118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
eat
eat(
types: List[Type[Builder]],
skips: Optional[List[Type[Builder]]] = None,
) -> BuilderNode
Move the stream pointer until a node of specified types is found.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
types
|
List[Type[Builder]]
|
List of types to move the stream pointer to. |
required |
skips
|
List[Type[Builder]] | None
|
List of types to end the stream scan. |
None
|
Returns:
Name | Type | Description |
---|---|---|
BuilderNode |
BuilderNode
|
The beginning of the stream which matches a type in |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/stream.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
|
read
read() -> Optional[BuilderNode]
Read the next builder node from the stream.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/stream.py
38 39 40 41 42 43 44 45 |
|
read_next
read_next(
builder_types: List[type[Builder]],
) -> Optional[BuilderNode]
Read the next builder node of specified types from the stream.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
builder_types
|
List[type[Builder]]
|
List of builder types to read from the stream. |
required |
Returns:
Type | Description |
---|---|
Optional[BuilderNode]
|
Optional[BuilderNode]: The next builder node matching one of the specified types, or None if not found. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/stream.py
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
trait
Module for parsing and displaying quantum computing program components using the bloqade library.
Parse
Bases: ParseRegister
, ParseSequence
, ParseCircuit
, ParseRoutine
A composite class inheriting from ParseRegister, ParseSequence, ParseCircuit, and ParseRoutine. Provides a unified interface for parsing different components of the program.
n_atoms
property
n_atoms: int
Return the number of atoms in the program.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
The number of atoms in the parsed register. |
Raises:
Type | Description |
---|---|
ValueError
|
If the register type is unsupported. |
Note
If the register is of type ParallelRegister, the number of atoms is extracted from its internal register.
Example:
>>> class MyBuilder(Parse):
... pass
>>> builder = MyBuilder()
>>> n_atoms = builder.n_atoms
ParseCircuit
A class providing functionality to parse the analog circuit from the program.
Example:
>>> class MyBuilder(ParseCircuit):
... pass
>>> builder = MyBuilder()
>>> analog_circuit = builder.parse_circuit()
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/builder/parse/trait.py
89 90 91 92 93 94 95 96 97 98 99 100 101 |
|
ParseRegister
A class providing functionality to parse the arrangement of atoms in the program.
Example:
>>> class MyBuilder(ParseRegister):
... pass
>>> builder = MyBuilder()
>>> atom_arrangement = builder.parse_register()
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/builder/parse/trait.py
31 32 33 34 35 36 37 38 39 40 41 42 43 |
|
ParseRoutine
A class providing functionality to parse the program and return a Routine object.
Example:
>>> class MyBuilder(ParseRoutine):
... pass
>>> builder = MyBuilder()
>>> routine = builder.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/builder/parse/trait.py
118 119 120 121 122 123 124 125 126 127 128 129 130 |
|
ParseSequence
A class providing functionality to parse the pulse sequence part of the program.
Example:
>>> class MyBuilder(ParseSequence):
... pass
>>> builder = MyBuilder()
>>> sequence = builder.parse_sequence()
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/builder/parse/trait.py
60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
Show
A mixin class providing functionality to display the builder with given arguments and batch ID.
show
show(*args, batch_id: int = 0)
Display the current program being defined with the given arguments and batch ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Additional arguments for display. |
()
|
|
batch_id
|
int
|
The batch ID to be displayed. Defaults to 0. |
0
|
Note
This method uses the display_builder
function to render the builder's state.
Example:
>>> class MyBuilder(Show):
... pass
>>> builder = MyBuilder()
>>> builder.show()
>>> builder.show(batch_id=1)
>>> builder.show('arg1', 'arg2', batch_id=2)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/parse/trait.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 |
|
pragmas
This module provides classes for building and managing quantum programs using the Bloqade library.
AddArgs
args
args(args_list: List[Union[str, Variable]]) -> Args
Add arguments to the current program.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
args_list
|
List[Union[str, Variable]]
|
List of argument names or Variable objects to be added. |
required |
Returns:
Name | Type | Description |
---|---|---|
Args |
Args
|
A new instance of the Args class with the specified arguments. |
Raises:
Type | Description |
---|---|
TypeError
|
If args_list contains invalid types. |
Note
This method is useful for deferring the value assignment of certain variables to runtime.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/pragmas.py
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
|
Assignable
assign
assign(**assignments) -> Assign
Assign values to variables declared previously in the program.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**assignments
|
Key-value pairs where the key is the variable name and the value is the value to assign. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
Assign |
Assign
|
A new instance of the Assign class with the specified assignments. |
Raises:
Type | Description |
---|---|
ValueError
|
If an invalid assignment is provided. |
Note
This is reserved for variables that should take single values or for
spatial modulations created with .scale(str)
. After assigning values,
you can choose a backend for emulation or execution.
Usage Examples:
# define geometry
>>> reg = bloqade.start
... .add_position([(0,0),(1,1),(2,2),(3,3)])
# define variables in program
>>> seq = reg.rydberg.detuning.uniform
... .linear(start="ival", stop=1, duration="span_time")
# assign values to variables
>>> seq = seq.assign(span_time=0.5, ival=0.0)
- Next steps:
...assign(assignments).bloqade
: select the bloqade local emulator backend...assign(assignments).braket
: select braket local emulator or QuEra hardware...assign(assignments).device(specifier_string)
: select backend by specifying a string...assign(assignments).batch_assign(assignments)
: assign multiple values for a parameter sweep...assign(assignments).parallelize(cluster_spacing)
: parallelize the program register...assign(assignments).args([previously_defined_vars])
: defer value assignment to runtime
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/pragmas.py
41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
BatchAssignable
batch_assign
batch_assign(
__batch_params: List[Dict[str, ParamType]] = [],
**assignments: List[ParamType]
) -> Union[BatchAssign, ListAssign]
Assign multiple values to variables for creating a parameter sweep.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
__batch_params
|
List[Dict[str, ParamType]]
|
List of dictionaries where each dictionary contains variable assignments for one set of parameters. |
[]
|
**assignments
|
List[ParamType]
|
Key-value pairs where the key is the variable name and the value is a list of values to assign. |
{}
|
Returns:
Type | Description |
---|---|
Union[BatchAssign, ListAssign]
|
Union[BatchAssign, ListAssign]: A new instance of BatchAssign or ListAssign class with the specified assignments. |
Raises:
Type | Description |
---|---|
ValueError
|
If both __batch_params and assignments are provided. |
Note
Bloqade handles the multiple programs generated by this method and treats them as a unified object for easy post-processing. Ensure all lists of values are of the same length as Bloqade will not perform a Cartesian product.
Usage Example:
>>> reg = start.add_position([(0,0), (0, "atom_distance")])
>>> prog = reg.rydberg.rabi.amplitude.uniform.constant("value", 5.0)
>>> var_assigned_prog = prog.batch_assign(value=[1.0, 2.0, 3.0],
atom_distance=[1.0, 2.0, 3.0])
- Next steps:
...batch_assign(assignments).bloqade
: select the bloqade local emulator backend...batch_assign(assignments).braket
: select braket local emulator or QuEra hardware...batch_assign(assignments).device(specifier_string)
: select backend by specifying a string...batch_assign(assignments).parallelize(cluster_spacing)
: parallelize the program register...batch_assign(assignments).args([previously_defined_vars])
: defer value assignment to runtime
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/pragmas.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
Parallelizable
parallelize
parallelize(cluster_spacing: LiteralType) -> Parallelize
Parallelize the current problem by duplicating the geometry to utilize all available space/qubits on hardware.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cluster_spacing
|
LiteralType
|
Specifies the spacing between clusters in micrometers. |
required |
Returns:
Name | Type | Description |
---|---|---|
Parallelize |
Parallelize
|
A new instance of the Parallelize class with the specified cluster spacing. |
Raises:
Type | Description |
---|---|
ValueError
|
If the cluster_spacing is not a valid value. |
Note
After calling this method, you can choose a backend for emulation or
execution. Options include bloqade
for a local emulator, braket
for
a local emulator or QuEra hardware on the cloud, or specifying a device
with a string.
Usage Example:
>>> reg = start.add_position((0,0)).rydberg.rabi.uniform.amplitude.constant(1.0, 1.0)
# copy-paste the geometry and waveforms
>>> parallelized_prog = reg.parallelize(24)
- Next steps:
...parallelize(cluster_spacing).bloqade
: select the bloqade local emulator backend...parallelize(cluster_spacing).braket
: select braket local emulator or QuEra hardware on the cloud...parallelize(cluster_spacing).device(specifier_string)
: select backend by specifying a string
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/pragmas.py
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
spatial
Uniform
Uniform(parent: Optional[Builder] = None)
Bases: SpatialModulation
The node specify a uniform spacial modulation. Which is ready to apply waveform
(See [Waveform
][bloqade.builder.waveform] for available waveform options)
Examples:
- To hit this node from the start node:
>>> reg = bloqade.start.add_position([(0,0),(1,1),(2,2),(3,3)])
>>> loc = reg.rydberg.detuning.uniform
- Apply Linear waveform:
>>> wv = bloqade.ir.Linear(start=0,stop=1,duration=0.5)
>>> reg = bloqade.start.add_position([(0,0),(1,1),(2,2),(3,3)])
>>> loc = reg.rydberg.detuning.uniform.apply(wv)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
start
ProgramStart
ProgramStart(parent: Optional[Builder] = None)
Bases: Drive
, Builder
ProgramStart is the base class for a starting/entry node for building a program.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
apply
apply(sequence: SequenceExpr) -> SequenceBuilder
Apply a pre-built sequence to a program.
This allows you to build a program independent of any geometry
and then apply
the program to said geometry. Or, if you have a
program you would like to try on multiple geometries you can
trivially do so with this.
Example Usage:
>>> from numpy import pi
>>> seq = start.rydberg.rabi.amplitude.constant(2.0 * pi, 4.5)
# choose a geometry of interest to apply the program on
>>> from bloqade.analog.atom_arrangement import Chain, Kagome
>>> complete_program = Chain(10).apply(seq)
# you can .apply to as many geometries as you like
>>> another_complete_program = Kagome(3).apply(seq)
- From here you can now do:
...assign(assignments).bloqade
: select the bloqade local emulator backend...assign(assignments).braket
: select braket local emulator or QuEra hardware...assign(assignments).device(specifier_string)
: select backend by specifying a string
- Assign multiple values to a single variable for a parameter sweep:
...assign(assignments).batch_assign(assignments)
:
- Parallelize the program register, duplicating the geometry and waveform
sequence to take advantage of all available
space/qubits on the QPU:
...assign(assignments).parallelize(cluster_spacing)
- Defer value assignment of certain variables to runtime:
...assign(assignments).args([previously_defined_vars])
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/start.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
|
waveform
Recordable
record
record(name: str) -> Record
Copy or "record" the value at the end of the waveform into a variable so that it can be used in another place.
A common design pattern is to couple this with .slice()
considering
you may not know exactly what the end value of a .slice()
is,
especially in parameter sweeps where it becomes cumbersome to handle.
If you specified a spatial modulation (e.g. uniform
, location
,scale
)
previously without a waveform you will now have completed the construction
of a "drive", one or a sum of drives creating a "field"
(e.g. Real-valued Rabi Amplitude/Phase).
If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.
Usage Example:
# define program of interest
>>> from bloqade import start
>>> prog = start.rydberg.rabi.amplitude.uniform
>>> prog_with_wf = prog.piecewise_linear(durations=[0.3, 2.0, 0.3],
values=[0.0, 2.0, 2.0, 0.0])
# We now slice the piecewise_linear from above and record the
# value at the end of that slice. We then use that value
# to construct a new waveform that can be appended to the previous
# one without introducing discontinuity (refer to the
# "Quantum Scar Dynamics" tutorial for how this could be handy)
>>> prog_with_record = prog_with_wf.slice(0.0, 1.0).record("end_of_wf")
>>> record_applied_prog = prog_with_record.linear(start="end_of_wf"
, stop=0.0, duration=0.3)
- Your next steps include:
- Continue building your waveform via:
...slice(start, stop).linear(start, stop, duration)
: to append another linear waveform...slice(start, stop).constant(value, duration)
: to append a constant waveform...slice(start, stop).piecewise_linear()
: to append a piecewise linear waveform...slice(start, stop).piecewise_constant()
: to append a piecewise constant waveform...slice(start, stop).poly([coefficients], duration)
: to append a polynomial waveform...slice(start, stop).apply(wf:bloqade.ir.Waveform)
: to append a pre-defined waveform...slilce(start, stop).fn(f(t,...))
: to append a waveform defined by a python function
- Begin constructing another drive by starting a new spatial modulation
(this drive will be summed to the one you just created):
...slice(start, stop).uniform
: To address all atoms in the field...slice(start, stop).location(int)
: To address an atom at a specific location via index...slice(start, stop).scale(str)
- To address an atom at a specific location via variable
- To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
- Assign values to pre-existing variables via:
...slice(start, stop).assign(variable_name = value)
: to assign a single value to a variable...slice(start, stop) .batch_assign(variable_name = [value1, ...])
: to assign multiple values to a variable...slice(start, stop).args(["previously_defined_var"])
: to defer assignment of a variable to execution time
- Select the backend you want your program to run on via:
...slice(start, stop).braket
: to run on Braket local emulator or QuEra hardware remotely...slice(start, stop).bloqade
: to run on the Bloqade local emulator...slice(start, stop).device
: to specify the backend via string
- Choose to parallelize your atom geometry,
duplicating it to fill the whole space:
...slice(start, stop).parallelize(spacing)
- Start targeting another level coupling
...slice(start, stop).rydberg
: to target the Rydberg level coupling...slice(start, stop).hyperfine
: to target the Hyperfine level coupling
- Start targeting other fields within your current level coupling
(previously selected as
rydberg
orhyperfine
):...slice(start, stop).amplitude
: to target the real-valued Rabi Amplitude field...slice(start, stop).phase
: to target the real-valued Rabi Phase field...slice(start, stop).detuning
: to target the Detuning field...slice(start, stop).rabi
: to target the complex-valued Rabi field ```
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 |
|
Sliceable
slice
slice(
start: Optional[ScalarType] = None,
stop: Optional[ScalarType] = None,
) -> Slice
Indicate that you only want a portion of your waveform to be used in the program.
If you specified a spatial modulation (e.g. uniform
, location
,scale
)
previously without a waveform you will now have completed the construction
of a "drive", one or a sum of drives creating a "field"
(e.g. Real-valued Rabi Amplitude/Phase).
If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.
Usage Example:
# define a program with a waveform of interest
>>> from bloqade import start
>>> prog = start.add_position((0,0)).rydberg.rabi.amplitude.uniform
>>> prog_with_wf = prog.piecewise_linear(durations=[0.3, 2.0, 0.3],
values=[0.0, 2.0, 2.0, 0.0])
# instead of using the full waveform we opt to only take the first 1 us
>>> prog_with_slice = prog_with_wf.slice(0.0, 1.0)
# you may use variables as well
>>> prog_with_slice = prog_with_wf.slice("start", "end")
- Your next steps include:
- Continue building your waveform via:
...slice(start, stop).linear(start, stop, duration)
: to append another linear waveform...slice(start, stop).constant(value, duration)
: to append a constant waveform...slice(start, stop).piecewise_linear()
: to append a piecewise linear waveform...slice(start, stop).piecewise_constant()
: to append a piecewise constant waveform...slice(start, stop).poly([coefficients], duration)
: to append a polynomial waveform...slice(start, stop).apply(wf:bloqade.ir.Waveform)
: to append a pre-defined waveform...slilce(start, stop).fn(f(t,...))
: to append a waveform defined by a python function
- Begin constructing another drive by starting a new spatial modulation
(this drive will be summed to the one you just created):
...slice(start, stop).uniform
: To address all atoms in the field...slice(start, stop).location(int)
: To address an atom at a specific location via index...slice(start, stop).scale(...)
- To address an atom at a specific location via variable
- To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
- Assign values to pre-existing variables via:
...slice(start, stop).assign(variable_name = value)
: to assign a single value to a variable...slice(start, stop) .batch_assign(variable_name = [value1, ...])
: to assign multiple values to a variable...slice(start, stop).args(["previously_defined_var"])
: to defer assignment of a variable to execution time
- Select the backend you want your program to run on via:
...slice(start, stop).braket
: to run on Braket local emulator or QuEra hardware remotely...slice(start, stop).bloqade
: to run on the Bloqade local emulator...slice(start, stop).device
: to specify the backend via string
- Choose to parallelize your atom geometry,
duplicating it to fill the whole space:
...slice(start, stop).parallelize(spacing)
- Start targeting another level coupling
...slice(start, stop).rydberg
: to target the Rydberg level coupling...slice(start, stop).hyperfine
: to target the Hyperfine level coupling
- Start targeting other fields within your current level coupling
(previously selected as
rydberg
orhyperfine
):...slice(start, stop).amplitude
: to target the real-valued Rabi Amplitude field...slice(start, stop).phase
: to target the real-valued Rabi Phase field...slice(start, stop).detuning
: to target the Detuning field...slice(start, stop).rabi
: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 |
|
WaveformAttachable
WaveformAttachable(parent: Optional[Builder] = None)
Bases: Builder
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
apply
apply(wf: Waveform) -> Apply
Apply a [Waveform
][bloqade.ir.control.Waveform] built previously to
current location(s).
If you specified a spatial modulation (e.g. uniform
, location
,scale
)
previously without a waveform you will now have completed the construction
of a "drive", one or a sum of drives creating a "field"
(e.g. Real-valued Rabi Amplitude/Phase).
If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.
Usage Example:
>>> prog = start.add_position((0,0)).rydberg.detuning.uniform
# build our waveform independently of the main program
>>> from bloqade import piecewise_linear
>>> wf = piecewise_linear(durations=[0.3, 2.5, 0.3],
values=[0.0, 2.0, 2.0, 0.0])
>>> prog.apply(wf)
- Your next steps include:
- Continue building your waveform via:
...apply(waveform).linear(start, stop, duration)
: to append another linear waveform...apply(waveform).constant(value, duration)
: to append a constant waveform...apply(waveform).piecewise_linear([durations], [values])
: to append a piecewise linear waveform...apply(waveform).piecewise_constant([durations], [values])
: to append a piecewise constant waveform...apply(waveform).poly([coefficients], duration)
: to append a polynomial waveform...apply(waveform).apply(waveform)
: to append a pre-defined waveform...apply(waveform).fn(f(t,...))
: to append a waveform defined by a python function
- Slice a portion of the waveform to be used:
...apply(waveform).slice(start, stop, duration)
- Save the ending value of your waveform to be reused elsewhere
...apply(waveform).record("you_variable_here")
- Begin constructing another drive by starting a new spatial modulation
(this drive will be summed to the one you just created):
...apply(waveform).uniform
: To address all atoms in the field...apply(waveform).location(int)
: To address an atom at a specific location via index...apply(waveform).scale(...)
- To address an atom at a specific location via variable
- To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
- Assign values to pre-existing variables via:
...apply(waveform).assign(variable_name = value)
: to assign a single value to a variable...apply(waveform).batch_assign(variable_name = [value1, ...])
: to assign multiple values to a variable...apply(waveform).args(["previously_defined_var"])
: to defer assignment of a variable to execution time
- Select the backend you want your program to run on via:
...apply(waveform).braket
: to run on Braket local emulator or QuEra hardware remotely...apply(waveform).bloqade
: to run on the Bloqade local emulator...apply(waveform).device
: to specify the backend via string
- Choose to parallelize your atom geometry,
duplicating it to fill the whole space:
...apply(waveform).parallelize(spacing)
- Start targeting another level coupling
...apply(waveform).rydberg
: to target the Rydberg level coupling...apply(waveform).hyperfine
: to target the Hyperfine level coupling
- Start targeting other fields within your current level coupling
(previously selected as
rydberg
orhyperfine
):...apply(waveform).amplitude
: to target the real-valued Rabi Amplitude field...apply(waveform).phase
: to target the real-valued Rabi Phase field...apply(waveform).detuning
: to target the Detuning field...apply(waveform).rabi
: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 |
|
constant
constant(
value: ScalarType, duration: ScalarType
) -> Constant
Append or assign a constant waveform to the current location(s).
If you specified a spatial modulation (e.g. uniform
, location
,scale
)
previously without a waveform you will now have completed the construction
of a "drive", one or a sum of drives creating a "field"
(e.g. Real-valued Rabi Amplitude/Phase).
If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.
Usage Example:
>>> prog = start.add_position((0,0)).rydberg.detuning.uniform
# apply a constant waveform of 1.9 radians/us for 0.5 us
>>> prog.constant(value=1.9,duration=0.5)
- Your next steps include:
- Continue building your waveform via:
...constant(value, duration).linear(start, stop, duration)
: to append another linear waveform...constant(value, duration).constant(value, duration)
: to append a constant waveform...constant(value, duration) .piecewise_linear([durations], [values])
: to append a piecewise linear waveform...constant(value, duration) .piecewise_constant([durations], [values])
: to append a piecewise constant waveform...constant(value, duration).poly([coefficients], duration)
: to append a polynomial waveform...constant(value, duration).apply(wf:bloqade.ir.Waveform)
: to append a pre-defined waveform...constant(value, duration).fn(f(t,...))
: to append a waveform defined by a python function
- Slice a portion of the waveform to be used:
...constant(value, duration).slice(start, stop, duration)
- Save the ending value of your waveform to be reused elsewhere
...constant(value, duration).record("you_variable_here")
- Begin constructing another drive by starting a new spatial modulation
(this drive will be summed to the one you just created):
...constant(value, duration).uniform
: To address all atoms in the field...constant(value, duration).scale(...)
: To address an atom at a specific location via index...constant(value, duration).location(int)
- To address an atom at a specific location via variable
- To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
- Assign values to pre-existing variables via:
...constant(value, duration).assign(variable_name = value)
: to assign a single value to a variable...constant(value, duration) .batch_assign(variable_name = [value1, ...])
: to assign multiple values to a variable...constant(value, duration).args(["previously_defined_var"])
: to defer assignment of a variable to execution time
- Select the backend you want your program to run on via:
...constant(value, duration).braket
: to run on Braket local emulator or QuEra hardware remotely...constant(value, duration).bloqade
: to run on the Bloqade local emulator...constant(value, duration).device
: to specify the backend via string
- Choose to parallelize your atom geometry,
duplicating it to fill the whole space:
...constant(start, stop, duration).parallelize(spacing)
- Start targeting another level coupling
...constant(value, duration).rydberg
: to target the Rydberg level coupling...constant(value, duration).hyperfine
: to target the Hyperfine level coupling
- Start targeting other fields within your current
level coupling (previously selected as
rydberg
orhyperfine
):...constant(value, duration).amplitude
: to target the real-valued Rabi Amplitude field...constant(value, duration).phase
: to target the real-valued Rabi Phase field...constant(value, duration).detuning
: to target the Detuning field...constant(value, duration).rabi
: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 |
|
fn
fn(fn: Callable, duration: ScalarType) -> Fn
Append or assign a custom function as a waveform.
The function must have its first argument be that of time but
can also have other arguments which are treated as variables.
You can assign values to later in the program via .assign
or .batch_assign
.
The function must also return a singular float value.
If you specified a spatial modulation (e.g. uniform
, location
,scale
)
previously without a waveform you will now have completed the construction
of a "drive", one or a sum of drives creating a "field"
(e.g. Real-valued Rabi Amplitude/Phase).
If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.
### Usage Examples:
>>> prog = start.add_position((0,0)).rydberg.detuning.uniform
# define our custom waveform. It must have one argument
# be time followed by any other number of arguments that can
# be assigned a value later in the program via `.assign` or `.batch_assign`
>>> def custom_waveform_function(t, arg1, arg2):
return arg1*t + arg2
>>> prog = prog.fn(custom_waveform_function, duration = 0.5)
# assign values
>>> assigned_vars_prog = prog.assign(arg1 = 1.0, arg2 = 2.0)
# or go for batching!
>>> assigned_vars_batch_prog = prog.assign(arg1 = 1.0, arg2 = [1.0, 2.0, 3.0])
- Your next steps include:
- Continue building your waveform via:
...fn(f(t,...)) .linear(start, stop, duration)
: to append another linear waveform...fn(f(t,...)) .constant(value, duration)
: to append a constant waveform...fn(f(t,...)) .piecewise_linear(durations, values)
: to append a piecewise linear waveform...fn(f(t,...)) .piecewise_constant(durations, values)
: to append a piecewise constant waveform...fn(f(t,...)) .poly([coefficients], duration)
: to append a polynomial waveform...fn(f(t,...)) .apply(waveform)
: to append a pre-defined waveform...fn(f(t,...)) .fn(f(t,...))
: to append a waveform defined by a python function
- Slice a portion of the waveform to be used:
...fn(f(t,...)).slice(start, stop, duration)
- Save the ending value of your waveform to be reused elsewhere
...fn(f(t,...)).record("you_variable_here")
- Begin constructing another drive by starting a new spatial modulation
(this drive will be summed to the one you just created):
...fn(f(t,...)).uniform
: To address all atoms in the field...fn(f(t,...)).scale(...)
: To address an atom at a specific location via index- ...fn(f(t,...)).location(int)`
- To address an atom at a specific location via variable
- To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
- Assign values to pre-existing variables via:
...fn(f(t,...)) .assign(variable_name = value)
: to assign a single value to a variable...fn(f(t,...)) .batch_assign(variable_name = [value1, ...])
: to assign multiple values to a variable...fn(f(t,...)) .args(["previously_defined_var"])
: to defer assignment of a variable to execution time
- Select the backend you want your program to run on via:
...fn(f(t,...)).braket
: to run on Braket local emulator or QuEra hardware remotely...fn(f(t,...)).bloqade
: to run on the Bloqade local emulator...fn(f(t,...)).device
: to specify the backend via string
- Choose to parallelize your atom geometry,
duplicating it to fill the whole space:
...fn(f(t,...)).parallelize(spacing)
- Start targeting another level coupling
...fn(f(t,...)).rydberg
: to target the Rydberg level coupling...fn(f(t,...)).hyperfine
: to target the Hyperfine level coupling
- Start targeting other fields within your current level coupling
(previously selected as
rydberg
orhyperfine
):...fn(f(t,...)).amplitude
: to target the real-valued Rabi Amplitude field...fn(f(t,...)).phase
: to target the real-valued Rabi Phase field...fn(f(t,...)).detuning
: to target the Detuning field...fn(f(t,...)).rabi
: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 |
|
linear
linear(
start: ScalarType,
stop: ScalarType,
duration: ScalarType,
) -> Linear
Append or assign a linear waveform to the current location(s).
If you specified a spatial modulation (e.g. uniform
, location
,scale
)
previously without a waveform you will now have completed the construction
of a "drive", one or a sum of drives creating a "field"
(e.g. Real-valued Rabi Amplitude/Phase).
If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.
Usage Example:
>>> prog = start.add_position((0,0)).rydberg.detuning.uniform
# apply a linear waveform that goes from 0 to 1 radians/us in 0.5 us
>>> prog.linear(start=0,stop=1,duration=0.5)
- Your next steps include:
- Continue building your waveform via:
...linear(start, stop, duration).linear(start, stop, duration)
: to append another linear waveform...linear(start, stop, duration).constant(value, duration)
: to append a constant waveform...linear(start, stop, duration) .piecewise_linear([durations], [values])
: to append a piecewise linear waveform...linear(start, stop, duration) .piecewise_constant([durations], [values])
: to append a piecewise constant waveform...linear(start, stop, duration).poly([coefficients], duration)
: to append a polynomial waveform...linear(start, stop, duration).apply(wf:bloqade.ir.Waveform)
: to append a pre-defined waveform...linear(start, stop, duration).fn(f(t,...))
: to append a waveform defined by a python function
- Slice a portion of the waveform to be used:
...linear(start, stop, duration).slice(start, stop, duration)
- Save the ending value of your waveform to be reused elsewhere
...linear(start, stop, duration).record("you_variable_here")
- Begin constructing another drive by starting a new spatial modulation
(this drive will be summed to the one you just created):
...linear(start, stop, duration).uniform
: To address all atoms in the field...linear(start, stop, duration).location(int)
: To address atoms at specific location with scaling...linear(start, stop, duration).scale(...)
- To address atoms at specific location with scaling
- To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
- Assign values to pre-existing variables via:
...linear(start, stop, duration).assign(variable_name = value)
: to assign a single value to a variable...linear(start, stop, duration) .batch_assign(variable_name = [value1, ...])
: to assign multiple values to a variable...linear(start, stop, duration).args(["previously_defined_var"])
: to defer assignment of a variable to execution time
- Select the backend you want your program to run on via:
...linear(start, stop, duration).braket
: to run on Braket local emulator or QuEra hardware remotely...linear(start, stop, duration).bloqade
: to run on the Bloqade local emulator...linear(start, stop, duration).device
: to specify the backend via string
- Choose to parallelize your atom geometry,
duplicating it to fill the whole space:
...linear(start, stop, duration).parallelize(spacing)
- Start targeting another level coupling
...linear(start, stop, duration).rydberg
: to target the Rydberg level coupling...linear(start, stop, duration).hyperfine
: to target the Hyperfine level coupling
- Start targeting other fields within your current level coupling
(previously selected as
rydberg
orhyperfine
):...linear(start, stop, duration).amplitude
: to target the real-valued Rabi Amplitude field...linear(start, stop, duration).phase
: to target the real-valued Rabi Phase field...linear(start, stop, duration).detuning
: to target the Detuning field...linear(start, stop, duration).rabi
: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 |
|
piecewise_constant
piecewise_constant(
durations: List[ScalarType], values: List[ScalarType]
) -> PiecewiseConstant
Append or assign a piecewise constant waveform to current location(s).
The durations
argument should have number of elements = len(values).
durations
should be the duration PER section of the waveform,
NON-CUMULATIVE.
If you specified a spatial modulation (e.g. uniform
, location
,scale
)
previously without a waveform you will now have completed the construction
of a "drive", one or a sum of drives creating a "field"
(e.g. Real-valued Rabi Amplitude/Phase).
If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.
Usage Example:
>>> prog = start.add_position((0,0)).rydberg.rabi.phase.uniform
# create a staircase, we hold 0.0 rad/us for 1.0 us, then
# to 1.0 rad/us for 0.5 us before stopping at 0.8 rad/us for 0.9 us.
>>> prog.piecewise_linear(durations=[0.3, 2.0, 0.3], values=[1.0, 0.5, 0.9])
- Your next steps including:
- Continue building your waveform via:
...piecewise_constant([durations], [values]) .linear(start, stop, duration)
: to append another linear waveform...piecewise_constant([durations], [values]) .constant(value, duration)
: to append a constant waveform...piecewise_constant([durations], [values]) .piecewise_linear([durations], [values])
: to append a piecewise linear waveform...piecewise_constant([durations], [values]) .piecewise_constant([durations], [values])
: to append a piecewise constant waveform...piecewise_constant([durations], [values]) .poly([coefficients], duration)
: to append a polynomial waveform...piecewise_constant([durations], [values]) .apply(waveform)
: to append a pre-defined waveform...piecewise_constant([durations], [values]).fn(f(t,...))
: to append a waveform defined by a python function
- Slice a portion of the waveform to be used:
...piecewise_constant([durations], [values]) .slice(start, stop, duration)
- Save the ending value of your waveform to be reused elsewhere
...piecewise_constant([durations], [values]) .record("you_variable_here")
- Begin constructing another drive by starting a new spatial modulation
(this drive will be summed to the one you just created):
...piecewise_constant([durations], [values]).uniform
: To address all atoms in the field...piecewise_constant([durations], [values]).location(int)
: To address an atom at a specific location via index...piecewise_constant([durations], [values]).scale(...)
- To address an atom at a specific location via variable
- To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
- Assign values to pre-existing variables via:
...piecewise_constant([durations], [values]) .assign(variable_name = value)
: to assign a single value to a variable...piecewise_constant([durations], [values]) .batch_assign(variable_name = [value1, ...])
: to assign multiple values to a variable...piecewise_constant([durations], [values]) .args(["previously_defined_var"])
: to defer assignment of a variable to execution time
- Select the backend you want your program to run on via:
...piecewise_constant([durations], [values]).braket
: to run on Braket local emulator or QuEra hardware remotely...piecewise_constant([durations], [values]).bloqade
: to run on the Bloqade local emulator...piecewise_constant([durations], [values]).device
: to specify the backend via string
- Choose to parallelize your atom geometry,
duplicating it to fill the whole space:
...piecewise_constat([durations], [values]).parallelize(spacing)
- Start targeting another level coupling
...piecewise_constant([durations], [values]).rydberg
: to target the Rydberg level coupling...piecewise_constant([durations], [values]).hyperfine
: to target the Hyperfine level coupling
- Start targeting other fields within your current level coupling
(previously selected as
rydberg
orhyperfine
):...piecewise_constant(durations, values).amplitude
: to target the real-valued Rabi Amplitude field...piecewise_constant([durations], [values]).phase
: to target the real-valued Rabi Phase field...piecewise_constant([durations], [values]).detuning
: to target the Detuning field...piecewise_constant([durations], [values]).rabi
: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 |
|
piecewise_linear
piecewise_linear(
durations: List[ScalarType], values: List[ScalarType]
) -> PiecewiseLinear
Append or assign a piecewise linear waveform to current location(s),
where the waveform is formed by connecting values[i], values[i+1]
with linear segments.
The durations
argument should have # of elements = len(values) - 1.
durations
should be the duration PER section of the waveform, NON-CUMULATIVE.
If you specified a spatial modulation (e.g. uniform
, location
,scale
)
previously without a waveform you will now have completed the construction
of a "drive", one or a sum of drives creating a "field"
(e.g. Real-valued Rabi Amplitude/Phase).
If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.
Usage Example:
>>> prog = start.add_position((0,0)).rydberg.detuning.uniform
# ramp our waveform up to a certain value, hold it
# then ramp down. In this case, we ramp up to 2.0 rad/us in 0.3 us,
# then hold it for 1.5 us before ramping down in 0.3 us back to 0.0 rad/us.
>>> prog.piecewise_linear(durations=[0.3, 2.0, 0.3],
values=[0.0, 2.0, 2.0, 0.0])
- Your next steps include:
- Continue building your waveform via:
...piecewise_linear([durations], [values]) .linear(start, stop, duration)
: to append another linear waveform...piecewise_linear([durations], [values]).constant(value, duration)
: to append a constant waveform...piecewise_linear([durations], [values]) .piecewise_linear(durations, values)
: to append a piecewise linear waveform...piecewise_linear([durations], [values]) .piecewise_constant([durations], [values])
: to append a piecewise constant waveform...piecewise_linear([durations], [values]) .poly([coefficients], duration)
: to append a polynomial waveform...piecewise_linear([durations], [values]).apply(waveform)
: to append a pre-defined waveform...piecewise_linear([durations], [values]).fn(f(t,...))
: to append a waveform defined by a python function
- Slice a portion of the waveform to be used:
...piecewise_linear([durations], [values]) .slice(start, stop, duration)
- Save the ending value of your waveform to be reused elsewhere
...piecewise_linear([durations], [values]) .record("you_variable_here")
- Begin constructing another drive by starting a new spatial modulation
(this drive will be summed to the one you just created):
...piecewise_linear([durations], [values]).uniform
: To address all atoms in the field...piecewise_linear([durations], [values]).scale(...)
: To address an atom at a specific location via index...piecewise_linear([durations], [values]).location(int)
- To address an atom at a specific location via variable
- To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
- Assign values to pre-existing variables via:
...piecewise_linear([durations], [values]) .assign(variable_name = value)
: to assign a single value to a variable...piecewise_linear([durations], [values]) .batch_assign(variable_name = [value1, ...])
: to assign multiple values to a variable...piecewise_linear([durations], [values]) .args(["previously_defined_var"])
: to defer assignment of a variable to execution time
- Select the backend you want your program to run on via:
...piecewise_linear([durations], [values]).braket
: to run on Braket local emulator or QuEra hardware remotely...piecewise_linear([durations], [values]).bloqade
: to run on the Bloqade local emulator...piecewise_linear([durations], [values]).device
: to specify the backend via string
- Choose to parallelize your atom geometry,
duplicating it to fill the whole space:
...piecewise_linear([durations], [values]).parallelize(spacing)
- Start targeting another level coupling
...piecewise_linear([durations], [values]).rydberg
: to target the Rydberg level coupling...piecewise_linear([durations], [values]).hyperfine
: to target the Hyperfine level coupling
- Start targeting other fields within your current level coupling
(previously selected as
rydberg
orhyperfine
):...piecewise_linear([durations], [values]).amplitude
: to target the real-valued Rabi Amplitude field...piecewise_linear([durations], [values]).phase
: to target the real-valued Rabi Phase field...piecewise_linear([durations], [values]).detuning
: to target the Detuning field....rabi
: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
|
poly
poly(
coeffs: List[ScalarType], duration: ScalarType
) -> Poly
Append or assign a waveform with a polynomial profile to current location(s).
You pass in a list of coefficients and a duration to this method which obeys the following expression:
wv(t) = coeffs[0] + coeffs[1]*t + coeffs[2]*t^2 + ... + coeffs[n]*t^n
If you specified a spatial modulation (e.g. uniform
, location
,scale
)
previously without a waveform you will now have completed the construction
of a "drive", one or a sum of drives creating a "field"
(e.g. Real-valued Rabi Amplitude/Phase).
If you have already specified a waveform previously you will now be appending this waveform to that previous waveform.
Usage Example:
>>> prog = start.add_position((0,0)).rydberg.detuning.uniform
>>> coeffs = [-1, 0.5, 1.2]
# resulting polynomial is:
# f(t) = -1 + 0.5*t + 1.2*t^2 with duration of
# 0.5 us
>>> prog.poly(coeffs, duration=0.5)
- Your next steps include:
- Continue building your waveform via:
...poly([coeffs], duration).linear(start, stop, duration)
: to append another linear waveform...poly([coeffs], duration).constant(value, duration)
: to append a constant waveform...poly([coeffs], duration) .piecewise_linear([durations], [values])
: to append a piecewise linear waveform...poly([coeffs], duration) .piecewise_constant([durations],[values])
: to append a piecewise constant waveform...poly([coeffs], duration).poly([coefficients], duration)
: to append a polynomial waveform...poly([coeffs], duration).apply(waveform)
: to append a pre-defined waveform...poly([coeffs], duration).fn(f(t,...))
: to append a waveform defined by a python function
- Slice a portion of the waveform to be used:
...poly([coeffs], duration).slice(start, stop, duration)
- Save the ending value of your waveform to be reused elsewhere
...poly([coeffs], duration).record("you_variable_here")
- Begin constructing another drive by starting a new spatial modulation
(this drive will be summed to the one you just created):
...poly([coeffs], duration).uniform
: To address all atoms in the field...poly([coeffs], duration).location(int)
: To address an atom at a specific location via index...poly([coeffs], duration).scale(...)
- To address an atom at a specific location via variable
- To address multiple atoms at specific locations by specifying a single variable and then assigning it a list of coordinates
- Assign values to pre-existing variables via:
...poly([coeffs], duration).assign(variable_name = value)
: to assign a single value to a variable...poly([coeffs], duration) .batch_assign(variable_name = [value1, ...])
: to assign multiple values to a variable...poly([coeffs], duration).args(["previously_defined_var"])
: to defer assignment of a variable to execution time
- Select the backend you want your program to run on via:
...poly([coeffs], duration).braket
: to run on Braket local emulator or QuEra hardware remotely...poly([coeffs], duration).bloqade
: to run on the Bloqade local emulator...poly([coeffs], duration).device
: to specify the backend via string
- Choose to parallelize your atom geometry,
duplicating it to fill the whole space:
...poly([coeffs], duration).parallelize(spacing)
- Start targeting another level coupling
...poly([coeffs], duration).rydberg
: to target the Rydberg level coupling...poly([coeffs], duration).hyperfine
: to target the Hyperfine level coupling
- Start targeting other fields within your current level
coupling (previously selected as
rydberg
orhyperfine
):...poly([coeffs], duration).amplitude
: to target the real-valued Rabi Amplitude field...poly([coeffs], duration).phase
: to target the real-valued Rabi Phase field...poly([coeffs], duration).detuning
: to target the Detuning field...poly([coeffs], duration).rabi
: to target the complex-valued Rabi field
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/waveform.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 |
|
compiler
analysis
hardware
BasicLatticeValidation
BasicLatticeValidation(capabilities: QuEraCapabilities)
Bases: BloqadeIRVisitor
This visitor checks that the AtomArrangement is within the bounds of the lattice and that the number of sites is within the maximum number of sites.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/analysis/hardware/lattice.py
14 15 |
|
ValidateChannels
ValidateChannels()
Bases: BloqadeIRVisitor
Checks to make sure the given sequence can be compiled to hardware.
This check looks at the spatial modulations and the level coupling to determine if the sequence can be compiled to hardware.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/analysis/hardware/channels.py
18 19 |
|
channels
ValidateChannels
ValidateChannels()
Bases: BloqadeIRVisitor
Checks to make sure the given sequence can be compiled to hardware.
This check looks at the spatial modulations and the level coupling to determine if the sequence can be compiled to hardware.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/analysis/hardware/channels.py
18 19 |
|
lattice
BasicLatticeValidation
BasicLatticeValidation(capabilities: QuEraCapabilities)
Bases: BloqadeIRVisitor
This visitor checks that the AtomArrangement is within the bounds of the lattice and that the number of sites is within the maximum number of sites.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/analysis/hardware/lattice.py
14 15 |
|
codegen
hardware
PiecewiseLinear
PiecewiseLinear represents a piecewise linear function.
Contains methods for evaluating the function at a given time and slicing since these are common operations in the code generation process.
piecewise_linear
PiecewiseLinear
PiecewiseLinear represents a piecewise linear function.
Contains methods for evaluating the function at a given time and slicing since these are common operations in the code generation process.
passes
hardware
analyze_channels
analyze_channels(circuit: AnalogCircuit) -> Dict
- Scan channels
This pass checks to make sure that: * There is no hyperfine coupling in the sequence * There are no non-uniform spatial modulation for rabi phase and amplitude * there is no more than one non-uniform spatial modulation for detuning
Parameters:
Name | Type | Description | Default |
---|---|---|---|
circuit
|
AnalogCircuit
|
AnalogCircuit to analyze |
required |
Returns:
Name | Type | Description |
---|---|---|
level_couplings |
Dict
|
Dictionary containing the required channels for the sequence. Note that this will insert a uniform field for any missing channels. |
Raises:
Type | Description |
---|---|
ValueError
|
If there is hyperfine coupling in the sequence. |
ValueError
|
If there is more than one non-uniform spatial modulation for detuning. |
ValueError
|
If there are non-uniform spatial modulations for rabi phase and amplitude. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/passes/hardware/define.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
assign_circuit
assign_circuit(
circuit: AnalogCircuit,
assignments: Dict[str, ParamType],
) -> Tuple[analog_circuit.AnalogCircuit, Dict]
- Assign variables and validate assignment
This pass assigns variables to the circuit and validates that all variables have been assigned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
circuit
|
AnalogCircuit
|
AnalogCircuit to assign variables to |
required |
assignments
|
Dict[str, ParamType]
|
Dictionary containing the assignments for the variables in the circuit. |
required |
Returns:
Name | Type | Description |
---|---|---|
assigned_circuit |
Tuple[AnalogCircuit, Dict]
|
AnalogCircuit with variables assigned. |
Raises:
Type | Description |
---|---|
ValueError
|
If there are any variables that have not been assigned. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/passes/hardware/define.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
canonicalize_circuit
canonicalize_circuit(
circuit: AnalogCircuit, level_couplings: Dict
) -> analog_circuit.AnalogCircuit
- Insert zero waveform in the explicit time intervals missing a waveform
This pass inserts a zero waveform in the explicit time intervals missing a waveform. This is required for later analysis passes to check that the waveforms are compatible with the hardware.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
circuit
|
AnalogCircuit
|
AnalogCircuit to add padding to |
required |
level_couplings
|
Dict
|
Dictionary containing the given channels for the sequence. |
required |
Return circuit: AnalogCircuit with zero waveforms inserted in the explicit time intervals missing a waveform.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/passes/hardware/define.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
generate_ahs_code
generate_ahs_code(
capabilities: Optional[QuEraCapabilities],
level_couplings: Dict,
circuit: AnalogCircuit,
) -> AHSComponents
- generate ahs code
Generates the AHS code for the given circuit. This includes generating the lattice data, global detuning, global amplitude, global phase, local detuning and lattice site coefficients (if applicable).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
capabilities
|
QuEraCapabilities | None
|
Capabilities of the hardware. |
required |
level_couplings
|
Dict
|
Dictionary containing the given channels for the sequence. |
required |
circuit
|
AnalogCircuit
|
AnalogCircuit to generate AHS code for. |
required |
Returns:
Name | Type | Description |
---|---|---|
ahs_components |
AHSComponents
|
A collection of the AHS components generated for the given circuit. Can be used to generate the QuEra and Braket IR. |
Raises:
Type | Description |
---|---|
ValueError
|
If the capabilities are not provided but the circuit has a ParallelRegister. This is because the ParallelRegister requires the capabilities to generate the lattice data. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/passes/hardware/define.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|
generate_braket_ir
generate_braket_ir(
ahs_components: AHSComponents, shots: int
) -> BraketTaskSpecification
- generate braket ir
This pass takes the AHS components and generates the Braket IR.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ahs_components
|
AHSComponents
|
A collection of the AHS components generated for the given circuit. |
required |
shots
|
int
|
Number of shots to run the circuit for. |
required |
Returns:
Name | Type | Description |
---|---|---|
task_specification |
BraketTaskSpecification
|
Braket IR for the given circuit. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/passes/hardware/define.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
|
generate_quera_ir
generate_quera_ir(
ahs_components: AHSComponents, shots: int
) -> QuEraTaskSpecification
- generate quera ir
This pass takes the AHS components and generates the QuEra IR.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ahs_components
|
AHSComponents
|
A collection of the AHS components generated for the given circuit. |
required |
shots
|
int
|
Number of shots to run the circuit for. |
required |
Returns:
Name | Type | Description |
---|---|---|
task_specification |
QuEraTaskSpecification
|
QuEra IR for the given circuit. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/passes/hardware/define.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
|
validate_waveforms
validate_waveforms(
level_couplings: Dict, circuit: AnalogCircuit
) -> None
- validate piecewise linear and piecewise constant pieces of pulses
This pass check to make sure that the waveforms are compatible with the hardware. This includes checking that the waveforms are piecewise linear or piecewise constant. It also checks that the waveforms are compatible with the given channels.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
circuit
|
AnalogCircuit
|
AnalogCircuit to validate waveforms for |
required |
level_couplings
|
Dict
|
Dictionary containing the given channels for the sequence. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the waveforms are not piecewise linear or piecewise constant, e.g. the waveform is not continuous. |
ValueError
|
If a waveform segment is not compatible with the given channels. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/passes/hardware/define.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
define
analyze_channels
analyze_channels(circuit: AnalogCircuit) -> Dict
- Scan channels
This pass checks to make sure that: * There is no hyperfine coupling in the sequence * There are no non-uniform spatial modulation for rabi phase and amplitude * there is no more than one non-uniform spatial modulation for detuning
Parameters:
Name | Type | Description | Default |
---|---|---|---|
circuit
|
AnalogCircuit
|
AnalogCircuit to analyze |
required |
Returns:
Name | Type | Description |
---|---|---|
level_couplings |
Dict
|
Dictionary containing the required channels for the sequence. Note that this will insert a uniform field for any missing channels. |
Raises:
Type | Description |
---|---|
ValueError
|
If there is hyperfine coupling in the sequence. |
ValueError
|
If there is more than one non-uniform spatial modulation for detuning. |
ValueError
|
If there are non-uniform spatial modulations for rabi phase and amplitude. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/passes/hardware/define.py
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
|
assign_circuit
assign_circuit(
circuit: AnalogCircuit,
assignments: Dict[str, ParamType],
) -> Tuple[analog_circuit.AnalogCircuit, Dict]
- Assign variables and validate assignment
This pass assigns variables to the circuit and validates that all variables have been assigned.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
circuit
|
AnalogCircuit
|
AnalogCircuit to assign variables to |
required |
assignments
|
Dict[str, ParamType]
|
Dictionary containing the assignments for the variables in the circuit. |
required |
Returns:
Name | Type | Description |
---|---|---|
assigned_circuit |
Tuple[AnalogCircuit, Dict]
|
AnalogCircuit with variables assigned. |
Raises:
Type | Description |
---|---|
ValueError
|
If there are any variables that have not been assigned. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/passes/hardware/define.py
87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
canonicalize_circuit
canonicalize_circuit(
circuit: AnalogCircuit, level_couplings: Dict
) -> analog_circuit.AnalogCircuit
- Insert zero waveform in the explicit time intervals missing a waveform
This pass inserts a zero waveform in the explicit time intervals missing a waveform. This is required for later analysis passes to check that the waveforms are compatible with the hardware.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
circuit
|
AnalogCircuit
|
AnalogCircuit to add padding to |
required |
level_couplings
|
Dict
|
Dictionary containing the given channels for the sequence. |
required |
Return circuit: AnalogCircuit with zero waveforms inserted in the explicit time intervals missing a waveform.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/passes/hardware/define.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
|
generate_ahs_code
generate_ahs_code(
capabilities: Optional[QuEraCapabilities],
level_couplings: Dict,
circuit: AnalogCircuit,
) -> AHSComponents
- generate ahs code
Generates the AHS code for the given circuit. This includes generating the lattice data, global detuning, global amplitude, global phase, local detuning and lattice site coefficients (if applicable).
Parameters:
Name | Type | Description | Default |
---|---|---|---|
capabilities
|
QuEraCapabilities | None
|
Capabilities of the hardware. |
required |
level_couplings
|
Dict
|
Dictionary containing the given channels for the sequence. |
required |
circuit
|
AnalogCircuit
|
AnalogCircuit to generate AHS code for. |
required |
Returns:
Name | Type | Description |
---|---|---|
ahs_components |
AHSComponents
|
A collection of the AHS components generated for the given circuit. Can be used to generate the QuEra and Braket IR. |
Raises:
Type | Description |
---|---|
ValueError
|
If the capabilities are not provided but the circuit has a ParallelRegister. This is because the ParallelRegister requires the capabilities to generate the lattice data. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/passes/hardware/define.py
175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 |
|
generate_braket_ir
generate_braket_ir(
ahs_components: AHSComponents, shots: int
) -> BraketTaskSpecification
- generate braket ir
This pass takes the AHS components and generates the Braket IR.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ahs_components
|
AHSComponents
|
A collection of the AHS components generated for the given circuit. |
required |
shots
|
int
|
Number of shots to run the circuit for. |
required |
Returns:
Name | Type | Description |
---|---|---|
task_specification |
BraketTaskSpecification
|
Braket IR for the given circuit. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/passes/hardware/define.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 |
|
generate_quera_ir
generate_quera_ir(
ahs_components: AHSComponents, shots: int
) -> QuEraTaskSpecification
- generate quera ir
This pass takes the AHS components and generates the QuEra IR.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
ahs_components
|
AHSComponents
|
A collection of the AHS components generated for the given circuit. |
required |
shots
|
int
|
Number of shots to run the circuit for. |
required |
Returns:
Name | Type | Description |
---|---|---|
task_specification |
QuEraTaskSpecification
|
QuEra IR for the given circuit. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/passes/hardware/define.py
261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 |
|
validate_waveforms
validate_waveforms(
level_couplings: Dict, circuit: AnalogCircuit
) -> None
- validate piecewise linear and piecewise constant pieces of pulses
This pass check to make sure that the waveforms are compatible with the hardware. This includes checking that the waveforms are piecewise linear or piecewise constant. It also checks that the waveforms are compatible with the given channels.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
circuit
|
AnalogCircuit
|
AnalogCircuit to validate waveforms for |
required |
level_couplings
|
Dict
|
Dictionary containing the given channels for the sequence. |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the waveforms are not piecewise linear or piecewise constant, e.g. the waveform is not continuous. |
ValueError
|
If a waveform segment is not compatible with the given channels. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/compiler/passes/hardware/define.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
rewrite
common
AssignToLiteral
Bases: BloqadeIRTransformer
Transform all assigned variables to literals.
assign_to_literal
AssignToLiteral
Bases: BloqadeIRTransformer
Transform all assigned variables to literals.
constants
RB_C6
module-attribute
RB_C6 = 2 * pi * 862690
The C6 constant for the Rydberg Interaction of two Rubidium atoms in units of: rad μm^6/μs
emulate
codegen
hamiltonian
CompileCache
dataclass
CompileCache(
operator_cache: Dict[
Tuple[Register, LevelCoupling, OperatorData],
MatrixTypes,
] = dict(),
space_cache: Dict[
Register, Tuple[Space, NDArray]
] = dict(),
)
This class is used to cache the results of the code generation.
ir
emulator
Register
dataclass
Register(
atom_type: AtomType,
sites: List[Tuple[Decimal, Decimal]],
blockade_radius: Decimal,
geometry: Optional[Geometry] = None,
)
This class represents the of the atoms in the system.
state_vector
AnalogGate
dataclass
AnalogGate(hamiltonian: RydbergHamiltonian)
run
run(
shots: int = 1,
solver_name: str = "dop853",
atol: float = 1e-14,
rtol: float = 1e-07,
nsteps: int = 2147483647,
interaction_picture: bool = False,
project_hyperfine: bool = True,
) -> NDArray[np.uint8]
Run the emulation with all atoms in the ground state, sampling the final state vector.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 |
|
RydbergHamiltonian
dataclass
RydbergHamiltonian(
emulator_ir: EmulatorProgram,
space: Space,
rydberg: NDArray,
detuning_ops: List[DetuningOperator] = list(),
rabi_ops: List[RabiOperator] = list(),
)
Hamiltonian for a given task.
With the RydbergHamiltonian
you can convert the Hamiltonian to CSR matrix form
as well as obtaining the average energy/variance of a register.
Attributes:
Name | Type | Description |
---|---|---|
emulator_ir |
EmulatorProgram
|
A copy of the original program used to generate the RydbergHamiltonian |
space |
Space
|
The Hilbert space of the Hamiltonian, should align with the register the Hamiltonian is being applied on for average energy/variance |
rydberg |
NDArray
|
Rydberg interaction operator |
detuning_ops |
List[DetuningOperator]
|
Detuning Operators of the Hamiltonian |
rabi_ops |
List[RabiOperator]
|
Rabi Operators of the Hamiltonian |
average
average(
register: StateVector, time: Optional[float] = None
) -> float
Get energy average from RydbergHamiltonian object at time time
with
register register
Parameters:
Name | Type | Description | Default |
---|---|---|---|
register
|
StateVector
|
The state vector to take average with |
required |
time
|
Optional[float]
|
Time value to evaluate average at. |
None
|
Returns:
Name | Type | Description |
---|---|---|
float |
float
|
average energy at time |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 |
|
average_and_variance
average_and_variance(
register: StateVector, time: Optional[float] = None
) -> Tuple[float, float]
Get energy average and variance from RydbergHamiltonian object at time time
with register register
Parameters:
Name | Type | Description | Default |
---|---|---|---|
register
|
StateVector
|
The state vector to take average and variance with |
required |
time
|
Optional[float]
|
Time value to evaluate average at. |
None
|
Returns:
Type | Description |
---|---|
float
|
Tuple[float, float]: average and variance of energy at time |
float
|
respectively. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 |
|
tocsr
tocsr(time: float) -> csr_matrix
Return the Hamiltonian as a csr matrix at time time
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
time
|
float
|
time to evaluate the Hamiltonian at. |
required |
Returns:
Name | Type | Description |
---|---|---|
csr_matrix |
csr_matrix
|
The Hamiltonian as a csr matrix. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
|
variance
variance(
register: StateVector, time: Optional[float] = None
) -> float
Get the energy variance from RydbergHamiltonian object at
time time
with register register
Parameters:
Name | Type | Description | Default |
---|---|---|---|
register
|
StateVector
|
The state vector to take variance with |
required |
time
|
Optional[float]
|
Time value to evaluate average at. |
None
|
Returns:
Name | Type | Description |
---|---|---|
complex |
float
|
variance of energy at time |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 |
|
StateVector
dataclass
StateVector(data: NDArray, space: Space)
local_trace
local_trace(
matrix: ndarray, site_index: Union[int, Tuple[int, int]]
) -> complex
return trace of an operator over the StateVector.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
matrix
|
ndarray
|
Square matrix representing operator in the local hilbert space. |
required |
site_index
|
int | Tuple[int, int]
|
sites to apply one body operator to. |
required |
Returns:
Name | Type | Description |
---|---|---|
complex |
complex
|
the trace of the operator over the state-vector. |
Raises:
Type | Description |
---|---|
ValueError
|
Error is raised when the dimension of |
ValueError
|
Error is raised when the |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
|
norm
norm() -> float
Return the norm of the state vector.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
215 216 217 |
|
normalize
normalize() -> None
Normalize the state vector.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
210 211 212 213 |
|
sample
sample(
shots: int, project_hyperfine: bool = True
) -> NDArray
Sample the state vector and return bitstrings.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/emulate/ir/state_vector.py
204 205 206 207 208 |
|
factory
constant
constant(
duration: ScalarType, value: ScalarType
) -> Constant
Create a Constant waveform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
duration
|
ScalarType
|
Duration of the Constant waveform. |
required |
value
|
ScalarType
|
Value of the Constant waveform.s |
required |
Returns:
Name | Type | Description |
---|---|---|
Constant |
Constant
|
A Constant waveform. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/factory.py
57 58 59 60 61 62 63 64 65 66 67 68 |
|
get_capabilities
get_capabilities(
use_experimental: bool = False,
) -> QuEraCapabilities
Get the device capabilities for Aquila
Parameters:
Name | Type | Description | Default |
---|---|---|---|
use_experimental
|
bool
|
Get experimental capabilities instead of standard ones. By default value is False. |
False
|
Returns:
Name | Type | Description |
---|---|---|
QuEraCapabilities |
QuEraCapabilities
|
capabilities object for Aquila device. |
Note
Units of time, distance, and energy are microseconds (us), micrometers (um), and rad / us, respectively.
For a comprehensive list of capabilities, see the Hardware Reference page
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/factory.py
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
|
linear
linear(
duration: ScalarType,
start: ScalarType,
stop: ScalarType,
) -> Linear
Create a Linear waveform.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
duration
|
ScalarType
|
Duration of linear waveform |
required |
start
|
ScalarType
|
Starting value of linear waveform |
required |
stop
|
ScalarType
|
Ending value of linear waveform |
required |
Returns:
Name | Type | Description |
---|---|---|
Linear |
Linear
|
Linear waveform |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/factory.py
42 43 44 45 46 47 48 49 50 51 52 53 54 |
|
piecewise_constant
piecewise_constant(
durations: List[ScalarType], values: List[ScalarType]
) -> Waveform
Create a piecewise linear waveform.
Create a piecewise constant waveform from a list of durations and values. The
value duration[i]
corresponds to the length of time for the i'th segment
with a value of values[i]
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
durations
|
List[ScalarType]
|
The duration of each segment |
required |
values
|
List[ScalarType]
|
The values for each segment |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the length of |
Returns:
Name | Type | Description |
---|---|---|
Waveform |
Waveform
|
The piecewise linear waveform. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/factory.py
105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 |
|
piecewise_linear
piecewise_linear(
durations: List[ScalarType], values: List[ScalarType]
) -> Waveform
Create a piecewise linear waveform.
Create a piecewise linear waveform from a list of durations and values. The
value duration[i]
is of the linear segment between values[i]
and values[i+1]
.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
durations
|
List[ScalarType]
|
The duration of each segment |
required |
values
|
List[ScalarType]
|
The values for each segment |
required |
Raises:
Type | Description |
---|---|
ValueError
|
If the length of |
Returns:
Name | Type | Description |
---|---|---|
Waveform |
Waveform
|
The piecewise linear waveform. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/factory.py
71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 |
|
rydberg_h
rydberg_h(
atoms_positions: Any,
detuning: Optional[Waveform] = None,
amplitude: Optional[Waveform] = None,
phase: Optional[Waveform] = None,
static_params: Dict[str, Any] = {},
batch_params: Union[
List[Dict[str, Any]], Dict[str, Any]
] = [],
args: List[str] = [],
) -> Routine
Create a rydberg program with uniform detuning, amplitude, and phase.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
atoms_positions
|
Any
|
Description of geometry of atoms in system. |
required |
detuning
|
Optional[Waveform]
|
Waveform for detuning. Defaults to None. |
None
|
amplitude
|
Optional[Waveform]
|
Waveform describing the amplitude of the rabi term. Defaults to None. |
None
|
phase
|
Optional[Waveform]
|
Waveform describing the phase of rabi term. Defaults to None. |
None
|
static_params
|
Dict[str, Any]
|
Define static parameters of your program. Defaults to {}. |
{}
|
batch_params
|
Union[List[Dict[str, Any]], Dict[str, Any]]
|
Parmaters for a batch of tasks. Defaults to []. |
[]
|
args
|
List[str]
|
List of arguments to leave till runtime. Defaults to []. |
[]
|
Returns:
Name | Type | Description |
---|---|---|
Routine |
Routine
|
An object that can be used to dispatch a rydberg program to multiple backends. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/factory.py
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
ir
start
module-attribute
start = ListOfLocations()
A Program starting point, alias of empty
[ListOfLocations
][bloqade.ir.location.list.ListOfLocations].
- Next possible steps to build your program are:
- Specify which level coupling to address with:
start.rydberg
: for [Rydberg
][bloqade.builder.coupling.Rydberg] Level couplingstart.hyperfine
: for [Hyperfine
][bloqade.builder.coupling.Hyperfine] Level coupling- LOCKOUT: You cannot add atoms to your geometry after specifying level coupling.
- continue/start building your geometry with:
start.add_position()
: to add atom(s) to current register. It will accept:- A single coordinate, represented as a tuple (e.g.
(5,6)
) with a value that can either be:- integers:
(5,6)
- floats:
(5.1, 2.5)
- strings (for later variable assignment):
("x", "y")
- [
Scalar
][bloqade.ir.scalar.Scalar] objects:(2*cast("x"), 5+cast("y"))
- integers:
- A list of coordinates, represented as a list of types mentioned previously.
- A numpy array with shape (n, 2) where n is the total number of atoms
- A single coordinate, represented as a tuple (e.g.
AlignedWaveform
Bases: Waveform
<padded waveform> ::= <waveform> | <waveform> <alignment> <value>
<alignment> ::= 'left aligned' | 'right aligned'
<value> ::= 'left value' | 'right value' | <scalar expr>
AnalogCircuit
AnalogCircuit is a dummy type that bundle register and sequence together.
register
property
register
Get the register of the program.
Returns:
Type | Description |
---|---|
register (Union["AtomArrangement", "ParallelRegister"]) |
Note
If the program is built with
[parallelize()
][bloqade.builder.emit.Emit.parallelize],
The the register will be a
[ParallelRegister
][bloqade.ir.location.base.ParallelRegister].
Otherwise it will be a
[AtomArrangement
][bloqade.ir.location.base.AtomArrangement].
show
show(**assignments)
Interactive visualization of the program
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**assignments
|
assigning the instance value (literal) to the existing variables in the program |
{}
|
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/analog_circuit.py
122 123 124 125 126 127 128 129 130 |
|
AtomArrangement
AtomArrangement(parent: Optional[Builder] = None)
Bases: ProgramStart
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
n_atoms
property
n_atoms: int
number of atoms (filled sites) in the register.
n_dims
property
n_dims: int
number of dimensions in the register.
n_sites
property
n_sites: int
number of sites in the register.
n_vacant
property
n_vacant: int
number of vacant sites in the register.
add_position
add_position(
position: Union[
PositionArray,
List[Tuple[ScalarType, ScalarType]],
Tuple[ScalarType, ScalarType],
],
filling: Optional[
Union[BoolArray, List[bool], bool]
] = None,
) -> ListOfLocations
Add a position or multiple positions to a pre-existing geometry.
add_position
is capable of accepting:
- A single tuple for one atom coordinate: (1.0, 2.5)
- A list of tuples: `[(0.0, 1.0), (2.0,1.5), etc.]
- A numpy array of shape (N, 2) where N is the number of atoms
You may also intersperse variables anywhere a value may be present.
You can also pass in an optional argument which determines the atom "filling" (whether or not at a specified coordinate an atom should be present).
Usage Example:
# single coordinate
>>> reg = start.add_position((0,0))
# you may chain add_position calls
>>> reg_plus_two = reg.add_position([(2,2),(5.0, 2.1)])
# you can add variables anywhere a value may be present
>>> reg_with_var = reg_plus_two.add_position(("x", "y"))
# and specify your atom fillings
>>> reg_with_filling = reg_with_var.add_position([(3.1, 0.0), (4.1, 2.2)],
[True, False])
# alternatively you could use one boolean to specify
# all coordinates should be empty/filled
>>> reg_with_more_filling = reg_with_filling.add_positions([(3.1, 2.9),
(5.2, 2.2)], False)
- Next possible steps are:
- Continuing to build your geometry via:
...add_position(positions).add_position(positions)
: to add more positions...add_position(positions).apply_defect_count(n_defects)
: to randomly drop out n_atoms...add_position(positions).apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...add_position(positions).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...add_position(positions).rydberg
: to specify Rydberg coupling...add_position(positions).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...add_position(positions).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
|
apply_defect_count
apply_defect_count(
n_defects: int, rng: Generator = np.random.default_rng()
)
Drop n_defects
atoms from the geometry randomly. Internally this occurs
by setting certain sites to have a SiteFilling set to false indicating
no atom is present at the coordinate.
A default numpy-based Random Number Generator is used but you can explicitly override this by passing in your own.
Usage Example:
>>> from bloqade.analog.atom_arrangement import Chain
>>> import numpy as np
# set a custom seed for a numpy-based RNG
>>> custom_rng = np.random.default_rng(888)
# randomly remove two atoms from the geometry
>>> reg = Chain(11).apply_defect_count(2, custom_rng)
# you may also chain apply_defect_count calls
>>> reg.apply_defect_count(2, custom_rng)
# you can also use apply_defect_count on custom geometries
>>> from bloqade import start
>>> start.add_position([(0,0), (1,1)]).apply_defect_count(1, custom_rng)
- Next possible steps are:
- Continuing to build your geometry via:
...apply_defect_count(defect_counts).add_position(positions)
: to add more positions...apply_defect_count(defect_counts) .apply_defect_count(n_defects)
: to randomly drop out n_atoms...apply_defect_count(defect_counts) .apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...apply_defect_count(defect_counts).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...apply_defect_count(defect_counts).rydberg
: to specify Rydberg coupling...apply_defect_count(defect_counts).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...apply_defect_count(defect_counts).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
|
apply_defect_density
apply_defect_density(
defect_probability: float,
rng: Generator = np.random.default_rng(),
)
Drop atoms randomly with defect_probability
probability (range of 0 to 1).
Internally this occurs by setting certain sites to have a SiteFilling
set to false indicating no atom is present at the coordinate.
A default numpy-based Random Number Generator is used but you can explicitly override this by passing in your own.
Usage Example:
>>> from bloqade.analog.atom_arrangement import Chain
>>> import numpy as np
# set a custom seed for a numpy-based RNG
>>> custom_rng = np.random.default_rng(888)
# randomly remove two atoms from the geometry
>>> reg = Chain(11).apply_defect_density(0.2, custom_rng)
# you may also chain apply_defect_density calls
>>> reg.apply_defect_count(0.1, custom_rng)
# you can also use apply_defect_density on custom geometries
>>> from bloqade import start
>>> start.add_position([(0,0), (1,1)])
.apply_defect_density(0.5, custom_rng)
- Next possible steps are:
- Continuing to build your geometry via:
...apply_defect_count(defect_counts).add_position(positions)
: to add more positions...apply_defect_count(defect_counts).apply_defect_count(n_defects)
: to randomly drop out n_atoms...apply_defect_count(defect_counts) .apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...apply_defect_count(defect_counts).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...apply_defect_count(defect_counts).rydberg
: to specify Rydberg coupling...apply_defect_count(defect_counts).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...apply_defect_count(defect_counts).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
|
enumerate
enumerate() -> Generator[LocationInfo, None, None]
enumerate all locations in the register.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
128 129 130 |
|
figure
figure(fig_kwargs=None, **assignments)
obtain a figure object from the atom arrangement.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
132 133 134 |
|
rydberg_interaction
rydberg_interaction(**assignments) -> NDArray
calculate the Rydberg interaction matrix.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**assignments
|
the values to assign to the variables in the register. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
NDArray |
NDArray
|
the Rydberg interaction matrix in the lower triangular form. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
scale
scale(scale: ScalarType)
Scale the geometry of your atoms.
Usage Example:
>>> reg = start.add_position([(0,0), (1,1)])
# atom positions are now (0,0), (2,2)
>>> new_reg = reg.scale(2)
# you may also use scale on pre-defined geometries
>>> from bloqade.analog.atom_arrangement import Chain
# atoms in the chain will now be 2 um apart versus
# the default 1 um
>>> Chain(11).scale(2)
- Next possible steps are:
- Continuing to build your geometry via:
...add_position(positions).add_position(positions)
: to add more positions...add_position(positions).apply_defect_count(n_defects)
: to randomly drop out n_atoms...add_position(positions).apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...add_position(positions).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...add_position(positions).rydberg
: to specify Rydberg coupling...add_position(positions).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...add_position(positions).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
|
show
show(**assignments) -> None
Display the current program being defined with the given arguments and batch ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Additional arguments for display. |
()
|
|
batch_id
|
int
|
The batch ID to be displayed. Defaults to 0. |
0
|
Note
This method uses the display_builder
function to render the builder's state.
Example:
>>> class MyBuilder(Show):
... pass
>>> builder = MyBuilder()
>>> builder.show()
>>> builder.show(batch_id=1)
>>> builder.show('arg1', 'arg2', batch_id=2)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
136 137 |
|
BoundedBravais
BoundedBravais(parent: Optional[Builder] = None)
Bases: AtomArrangement
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
__match_args__
class-attribute
instance-attribute
__match_args__ = ('shape', 'lattice_spacing')
Base classe for Bravais lattices
[AtomArrangement
][bloqade.ir.location.base.AtomArrangement].
- [
Square
][bloqade.ir.location.bravais.Square] - [
Chain
][bloqade.ir.location.bravais.Chain] - [
Honeycomb
][bloqade.ir.location.bravais.Honeycomb] - [
Triangular
][bloqade.ir.location.bravais.Triangular] - [
Lieb
][bloqade.ir.location.bravais.Lieb] - [
Kagome
][bloqade.ir.location.bravais.Kagome] - [
Rectangular
][bloqade.ir.location.bravais.Rectangular]
n_atoms
cached
property
n_atoms: int
number of atoms (filled sites) in the register.
n_dims
property
n_dims
dimension of the lattice
Returns:
Name | Type | Description |
---|---|---|
int |
dimension of the lattice |
n_sites
property
n_sites: int
number of sites in the register.
n_vacant
property
n_vacant: int
number of vacant sites in the register.
coordinates
coordinates(index: List[int]) -> NDArray
calculate the coordinates of a cell in the lattice given the cell index.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
113 114 115 116 117 118 119 120 121 122 |
|
enumerate
enumerate() -> Generator[LocationInfo, None, None]
enumerate all locations in the register.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
124 125 126 127 128 |
|
scale
scale(factor: ScalarType) -> BoundedBravais
Scale the current location with a factor.
(x,y) -> factor*(x,y)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
factor
|
str | Real | Decimal | Scalar
|
scale factor |
required |
Returns:
Name | Type | Description |
---|---|---|
BoundedBravais |
BoundedBravais
|
The lattice with the scaled locations |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
Chain
Chain(
L: int,
*,
lattice_spacing: ScalarType = 1.0,
vertical_chain: bool = False
)
Bases: BoundedBravais
Chain lattice.
- 1D lattice
- primitive (cell) vector(s)
- a1 = (1,0).
- unit cell (1 atom(s))
- loc (0,0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L
|
int
|
number of sites in the chain |
required |
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
183 184 185 186 187 188 189 190 |
|
Constant
Constant(value: ScalarType, duration: ScalarType)
Bases: Instruction
<constant> ::= 'constant' <scalar expr>
f(t=0:duration) = value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
Scalar
|
the constant value |
required |
duration
|
Scalar
|
the time span of the constant waveform. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/waveform.py
323 324 325 326 |
|
Field
Bases: FieldExpr
Field node in the IR. Which contains collection(s) of
[Waveform
][bloqade.ir.control.waveform.Waveform]
<field> ::= ('field' <spatial modulation> <padded waveform>)*
show
show(**assignments)
Interactive visualization of the Field
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**assignments
|
assigning the instance value (literal) to the existing variables in the Field |
{}
|
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/field.py
262 263 264 265 266 267 268 269 270 271 |
|
Honeycomb
Honeycomb(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Honeycomb lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (1/2, sqrt(3)/2)
- unit cell (2 atom(s))
- loc1 (0, 0)
- loc2 (1/2, 1/(2*sqrt(3))
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of unit cells in linear direction. n_atoms = L1 * L1 * 2. |
required |
L2
|
Optional[int]
|
number of unit cells in direction a2. n_atoms = L1 * L2 * 2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
420 421 422 423 424 425 426 427 428 429 430 431 |
|
Kagome
Kagome(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Kagome lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (1/2, sqrt(3)/2)
- unit cell (3 atom(s))
- loc1 (0, 0)
- loc2 (0.5, 0)
- loc3 (0.25 ,0.25sqrt(3))
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of sites in linear direction. n_atoms = 3 * L1 * L1. |
required |
L2
|
Optional[int]
|
number of unit cells along a2 direction, n_atoms = 3 * L1 * L2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
589 590 591 592 593 594 595 596 597 598 599 |
|
Lieb
Lieb(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Lieb lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (0, 1)
- unit cell (3 atom(s))
- loc1 (0, 0)
- loc2 (0.5, 0)
- loc3 (0 ,0.5)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of unit cells in linear direction. n_atoms = 3* L1 * L1. |
required |
L2
|
Optional[int]
|
number of unit cells along a2 direction, n_atoms = 3 * L1 * L2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
534 535 536 537 538 539 540 541 542 |
|
Linear
Linear(
start: ScalarType,
stop: ScalarType,
duration: ScalarType,
)
Bases: Instruction
<linear> ::= 'linear' <scalar expr> <scalar expr>
f(t=0:duration) = start + (stop-start)/duration * t
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start
|
Scalar
|
start value |
required |
stop
|
Scalar
|
stop value |
required |
duration
|
Scalar
|
the time span of the linear waveform. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/waveform.py
274 275 276 277 278 |
|
ListOfLocations
ListOfLocations(
location_list: List[
Union[LocationInfo, Tuple[ScalarType, ScalarType]]
] = [],
)
Bases: AtomArrangement
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 |
|
n_atoms
property
n_atoms
number of atoms (filled sites) in the register.
n_dims
property
n_dims
number of dimensions in the register.
n_sites
property
n_sites
number of sites in the register.
n_vacant
property
n_vacant
number of vacant sites in the register.
enumerate
enumerate()
enumerate all locations in the register.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
661 662 |
|
Literal
Bases: Real
value
instance-attribute
value: Decimal
Scalar Literal, which stores a decimaal value instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
Decimal
|
decimal value instance |
required |
ParallelRegister
ParallelRegister(parent: Optional[Builder] = None)
Bases: ProgramStart
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
n_atoms
property
n_atoms
Return the number of atoms in the program.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
The number of atoms in the parsed register. |
Raises:
Type | Description |
---|---|
ValueError
|
If the register type is unsupported. |
Note
If the register is of type ParallelRegister, the number of atoms is extracted from its internal register.
Example:
>>> class MyBuilder(Parse):
... pass
>>> builder = MyBuilder()
>>> n_atoms = builder.n_atoms
show
show(**assignments) -> None
Display the current program being defined with the given arguments and batch ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Additional arguments for display. |
()
|
|
batch_id
|
int
|
The batch ID to be displayed. Defaults to 0. |
0
|
Note
This method uses the display_builder
function to render the builder's state.
Example:
>>> class MyBuilder(Show):
... pass
>>> builder = MyBuilder()
>>> builder.show()
>>> builder.show(batch_id=1)
>>> builder.show('arg1', 'arg2', batch_id=2)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
559 560 |
|
Poly
Poly(coeffs: Container[ScalarType], duration: ScalarType)
Bases: Instruction
<poly> ::= <scalar>+
f(t=0:duration) = c[0] + c[1]t + c[2]t^2 + ... + c[n-1]t^n-1 + c[n]t^n
Parameters:
Name | Type | Description | Default |
---|---|---|---|
coeffs
|
Tuple[Scalar]
|
the coefficients c[] of the polynomial. |
required |
duration
|
Scalar
|
the time span of the waveform. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/waveform.py
362 363 364 365 |
|
Pulse
Bases: PulseExpr
<pulse> ::= (<field name> <field>)+
show
show(**assignments)
Interactive visualization of the Pulse
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**assignments
|
assigning the instance value (literal) to the existing variables in the Pulse |
{}
|
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/pulse.py
194 195 196 197 198 199 200 201 202 203 |
|
PythonFn
Record
Rectangular
Rectangular(
width: int,
height: int,
*,
lattice_spacing_x: ScalarType = 1.0,
lattice_spacing_y: ScalarType = 1.0
)
Bases: BoundedBravais
Rectangular lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1,0)
- a2 = (0,1)
- unit cell (1 atom(s))
- loc (0,0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
number of sites in x direction. |
required |
height
|
int
|
number of sites in y direction. |
required |
lattice_spacing_x
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
lattice_spacing_y
|
(Scalar, Real)
|
lattice spacing in y direction. optional. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
|
Sample
Scalar
Base class for all scalar expressions.
<scalar> ::= <literal>
| <variable>
| <default>
| <negative>
| <add>
| <mul>
| <min>
| <max>
| <slice>
| <inverval>
<mul> ::= <scalar> '*' <scalar>
<add> ::= <scalar> '+' <scalar>
<min> ::= 'min' <scalar>+
<max> ::= 'max' <scalar>+
<slice> ::= <scalar expr> '[' <interval> ']'
<interval> ::= <scalar expr> '..' <scalar expr>
<real> ::= <literal> | <var>
Sequence
Bases: SequenceExpr
Sequence of a program, which includes pulses informations.
show
show(**assignments)
Interactive visualization of the Sequence
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**assignments
|
assigning the instance value (literal) to the existing variables in the Sequence |
{}
|
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/sequence.py
166 167 168 169 170 171 172 173 174 175 |
|
Square
Square(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Square lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1,0)
- a2 = (0,1)
- unit cell (1 atom(s))
- loc (0,0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of sites in linear direction. n_atoms = L1 * L1. |
required |
L2
|
Optional[int]
|
number of sites in direction a2. n_atoms = L1 * L2, default is L1 |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
240 241 242 243 244 245 246 247 248 249 |
|
Triangular
Triangular(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Triangular lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (1/2, sqrt(3)/2)
- unit cell (1 atom(s))
- loc (0, 0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L
|
int
|
number of sites in linear direction. n_atoms = L * L. |
required |
L2
|
Optional[int]
|
number of sites along a2 direction, n_atoms = L1 * L2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
477 478 479 480 481 482 483 484 485 486 487 |
|
Variable
Bases: Real
Variable, which stores a variable name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
variable instance. |
required |
Waveform
Bases: HashTrait
, CanonicalizeTrait
Waveform node in the IR.
- [
<instruction>
][bloqade.ir.control.waveform.Instruction] - [
<smooth>
][bloqade.ir.control.waveform.Smooth] - [
<slice>
][bloqade.ir.control.waveform.Slice] - [
<apppend>
][bloqade.ir.control.waveform.Append] - [
<negative>
][bloqade.ir.control.waveform.Negative] - [
<scale>
][bloqade.ir.control.waveform.Scale] - [
<add>
][bloqade.ir.control.waveform.Add] - [
<record>
][bloqade.ir.control.waveform.Record] - [
<sample>
][bloqade.ir.control.waveform.Sample]
<waveform> ::= <instruction>
| <smooth>
| <slice>
| <append>
| <negative>
| <scale>
| <add>
| <record>
| <sample>
figure
figure(**assignments)
get figure of the plotting the waveform.
Returns:
Name | Type | Description |
---|---|---|
figure |
a bokeh figure |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/waveform.py
96 97 98 99 100 101 102 |
|
cast
cast(py) -> Scalar
-
cast Real number (or list/tuple of Real numbers) to [
Scalar Literal
][bloqade.ir.scalar.Literal]. -
cast str (or list/tuple of Real numbers) to [
Scalar Variable
][bloqade.ir.scalar.Variable].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
py
|
Union[str, Real, Tuple[Real], List[Real]]
|
python object to cast |
required |
Returns:
Type | Description |
---|---|
Scalar
|
Scalar |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/scalar.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
|
var
var(py: str) -> Variable
cast string (or list/tuple of strings)
to [Variable
][bloqade.ir.scalar.Variable].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
py
|
Union[str, List[str]]
|
a string or list/tuple of strings |
required |
Returns:
Type | Description |
---|---|
Variable
|
Union[Variable] |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/scalar.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|
analog_circuit
AnalogCircuit
AnalogCircuit is a dummy type that bundle register and sequence together.
register
property
register
Get the register of the program.
Returns:
Type | Description |
---|---|
register (Union["AtomArrangement", "ParallelRegister"]) |
Note
If the program is built with
[parallelize()
][bloqade.builder.emit.Emit.parallelize],
The the register will be a
[ParallelRegister
][bloqade.ir.location.base.ParallelRegister].
Otherwise it will be a
[AtomArrangement
][bloqade.ir.location.base.AtomArrangement].
show
show(**assignments)
Interactive visualization of the program
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**assignments
|
assigning the instance value (literal) to the existing variables in the program |
{}
|
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/analog_circuit.py
122 123 124 125 126 127 128 129 130 |
|
control
field
Field
Bases: FieldExpr
Field node in the IR. Which contains collection(s) of
[Waveform
][bloqade.ir.control.waveform.Waveform]
<field> ::= ('field' <spatial modulation> <padded waveform>)*
show
show(**assignments)
Interactive visualization of the Field
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**assignments
|
assigning the instance value (literal) to the existing variables in the Field |
{}
|
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/field.py
262 263 264 265 266 267 268 269 270 271 |
|
pulse
Append
Pulse
Bases: PulseExpr
<pulse> ::= (<field name> <field>)+
show
show(**assignments)
Interactive visualization of the Pulse
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**assignments
|
assigning the instance value (literal) to the existing variables in the Pulse |
{}
|
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/pulse.py
194 195 196 197 198 199 200 201 202 203 |
|
PulseExpr
Bases: HashTrait
, CanonicalizeTrait
<expr> ::= <pulse>
| <append>
| <slice>
| <named>
sequence
Sequence
Bases: SequenceExpr
Sequence of a program, which includes pulses informations.
show
show(**assignments)
Interactive visualization of the Sequence
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**assignments
|
assigning the instance value (literal) to the existing variables in the Sequence |
{}
|
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/sequence.py
166 167 168 169 170 171 172 173 174 175 |
|
traits
SliceTrait
start
cached
property
start: Scalar
slice
SliceTrait
start
cached
property
start: Scalar
waveform
Add
AlignedWaveform
Bases: Waveform
<padded waveform> ::= <waveform> | <waveform> <alignment> <value>
<alignment> ::= 'left aligned' | 'right aligned'
<value> ::= 'left value' | 'right value' | <scalar expr>
Append
Constant
Constant(value: ScalarType, duration: ScalarType)
Bases: Instruction
<constant> ::= 'constant' <scalar expr>
f(t=0:duration) = value
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
Scalar
|
the constant value |
required |
duration
|
Scalar
|
the time span of the constant waveform. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/waveform.py
323 324 325 326 |
|
Instruction
Bases: Waveform
Instruction node in the IR.
- [
<linear>
][bloqade.ir.control.waveform.Linear] - [
<constant>
][bloqade.ir.control.waveform.Constant] - [
<poly>
][bloqade.ir.control.waveform.Poly] - [
<python-fn>
][bloqade.ir.control.waveform.PythonFn]
<instruction> ::= <linear>
| <constant>
| <poly>
| <python-fn>
Linear
Linear(
start: ScalarType,
stop: ScalarType,
duration: ScalarType,
)
Bases: Instruction
<linear> ::= 'linear' <scalar expr> <scalar expr>
f(t=0:duration) = start + (stop-start)/duration * t
Parameters:
Name | Type | Description | Default |
---|---|---|---|
start
|
Scalar
|
start value |
required |
stop
|
Scalar
|
stop value |
required |
duration
|
Scalar
|
the time span of the linear waveform. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/waveform.py
274 275 276 277 278 |
|
Negative
Poly
Poly(coeffs: Container[ScalarType], duration: ScalarType)
Bases: Instruction
<poly> ::= <scalar>+
f(t=0:duration) = c[0] + c[1]t + c[2]t^2 + ... + c[n-1]t^n-1 + c[n]t^n
Parameters:
Name | Type | Description | Default |
---|---|---|---|
coeffs
|
Tuple[Scalar]
|
the coefficients c[] of the polynomial. |
required |
duration
|
Scalar
|
the time span of the waveform. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/waveform.py
362 363 364 365 |
|
PythonFn
Record
Sample
Scale
Scale(scalar, waveform: Waveform)
Bases: Waveform
<scale> ::= <scalar expr> '*' <waveform>
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/waveform.py
754 755 756 |
|
Slice
Smooth
Smooth(radius, kernel, waveform)
Bases: Waveform
<smooth> ::= 'smooth' <kernel> <waveform>
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/waveform.py
584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 |
|
Waveform
Bases: HashTrait
, CanonicalizeTrait
Waveform node in the IR.
- [
<instruction>
][bloqade.ir.control.waveform.Instruction] - [
<smooth>
][bloqade.ir.control.waveform.Smooth] - [
<slice>
][bloqade.ir.control.waveform.Slice] - [
<apppend>
][bloqade.ir.control.waveform.Append] - [
<negative>
][bloqade.ir.control.waveform.Negative] - [
<scale>
][bloqade.ir.control.waveform.Scale] - [
<add>
][bloqade.ir.control.waveform.Add] - [
<record>
][bloqade.ir.control.waveform.Record] - [
<sample>
][bloqade.ir.control.waveform.Sample]
<waveform> ::= <instruction>
| <smooth>
| <slice>
| <append>
| <negative>
| <scale>
| <add>
| <record>
| <sample>
figure
figure(**assignments)
get figure of the plotting the waveform.
Returns:
Name | Type | Description |
---|---|---|
figure |
a bokeh figure |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/control/waveform.py
96 97 98 99 100 101 102 |
|
location
start
module-attribute
start = ListOfLocations()
A Program starting point, alias of empty
[ListOfLocations
][bloqade.ir.location.list.ListOfLocations].
- Next possible steps to build your program are:
- Specify which level coupling to address with:
start.rydberg
: for [Rydberg
][bloqade.builder.coupling.Rydberg] Level couplingstart.hyperfine
: for [Hyperfine
][bloqade.builder.coupling.Hyperfine] Level coupling- LOCKOUT: You cannot add atoms to your geometry after specifying level coupling.
- continue/start building your geometry with:
start.add_position()
: to add atom(s) to current register. It will accept:- A single coordinate, represented as a tuple (e.g.
(5,6)
) with a value that can either be:- integers:
(5,6)
- floats:
(5.1, 2.5)
- strings (for later variable assignment):
("x", "y")
- [
Scalar
][bloqade.ir.scalar.Scalar] objects:(2*cast("x"), 5+cast("y"))
- integers:
- A list of coordinates, represented as a list of types mentioned previously.
- A numpy array with shape (n, 2) where n is the total number of atoms
- A single coordinate, represented as a tuple (e.g.
AtomArrangement
AtomArrangement(parent: Optional[Builder] = None)
Bases: ProgramStart
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
n_atoms
property
n_atoms: int
number of atoms (filled sites) in the register.
n_dims
property
n_dims: int
number of dimensions in the register.
n_sites
property
n_sites: int
number of sites in the register.
n_vacant
property
n_vacant: int
number of vacant sites in the register.
add_position
add_position(
position: Union[
PositionArray,
List[Tuple[ScalarType, ScalarType]],
Tuple[ScalarType, ScalarType],
],
filling: Optional[
Union[BoolArray, List[bool], bool]
] = None,
) -> ListOfLocations
Add a position or multiple positions to a pre-existing geometry.
add_position
is capable of accepting:
- A single tuple for one atom coordinate: (1.0, 2.5)
- A list of tuples: `[(0.0, 1.0), (2.0,1.5), etc.]
- A numpy array of shape (N, 2) where N is the number of atoms
You may also intersperse variables anywhere a value may be present.
You can also pass in an optional argument which determines the atom "filling" (whether or not at a specified coordinate an atom should be present).
Usage Example:
# single coordinate
>>> reg = start.add_position((0,0))
# you may chain add_position calls
>>> reg_plus_two = reg.add_position([(2,2),(5.0, 2.1)])
# you can add variables anywhere a value may be present
>>> reg_with_var = reg_plus_two.add_position(("x", "y"))
# and specify your atom fillings
>>> reg_with_filling = reg_with_var.add_position([(3.1, 0.0), (4.1, 2.2)],
[True, False])
# alternatively you could use one boolean to specify
# all coordinates should be empty/filled
>>> reg_with_more_filling = reg_with_filling.add_positions([(3.1, 2.9),
(5.2, 2.2)], False)
- Next possible steps are:
- Continuing to build your geometry via:
...add_position(positions).add_position(positions)
: to add more positions...add_position(positions).apply_defect_count(n_defects)
: to randomly drop out n_atoms...add_position(positions).apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...add_position(positions).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...add_position(positions).rydberg
: to specify Rydberg coupling...add_position(positions).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...add_position(positions).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
|
apply_defect_count
apply_defect_count(
n_defects: int, rng: Generator = np.random.default_rng()
)
Drop n_defects
atoms from the geometry randomly. Internally this occurs
by setting certain sites to have a SiteFilling set to false indicating
no atom is present at the coordinate.
A default numpy-based Random Number Generator is used but you can explicitly override this by passing in your own.
Usage Example:
>>> from bloqade.analog.atom_arrangement import Chain
>>> import numpy as np
# set a custom seed for a numpy-based RNG
>>> custom_rng = np.random.default_rng(888)
# randomly remove two atoms from the geometry
>>> reg = Chain(11).apply_defect_count(2, custom_rng)
# you may also chain apply_defect_count calls
>>> reg.apply_defect_count(2, custom_rng)
# you can also use apply_defect_count on custom geometries
>>> from bloqade import start
>>> start.add_position([(0,0), (1,1)]).apply_defect_count(1, custom_rng)
- Next possible steps are:
- Continuing to build your geometry via:
...apply_defect_count(defect_counts).add_position(positions)
: to add more positions...apply_defect_count(defect_counts) .apply_defect_count(n_defects)
: to randomly drop out n_atoms...apply_defect_count(defect_counts) .apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...apply_defect_count(defect_counts).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...apply_defect_count(defect_counts).rydberg
: to specify Rydberg coupling...apply_defect_count(defect_counts).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...apply_defect_count(defect_counts).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
|
apply_defect_density
apply_defect_density(
defect_probability: float,
rng: Generator = np.random.default_rng(),
)
Drop atoms randomly with defect_probability
probability (range of 0 to 1).
Internally this occurs by setting certain sites to have a SiteFilling
set to false indicating no atom is present at the coordinate.
A default numpy-based Random Number Generator is used but you can explicitly override this by passing in your own.
Usage Example:
>>> from bloqade.analog.atom_arrangement import Chain
>>> import numpy as np
# set a custom seed for a numpy-based RNG
>>> custom_rng = np.random.default_rng(888)
# randomly remove two atoms from the geometry
>>> reg = Chain(11).apply_defect_density(0.2, custom_rng)
# you may also chain apply_defect_density calls
>>> reg.apply_defect_count(0.1, custom_rng)
# you can also use apply_defect_density on custom geometries
>>> from bloqade import start
>>> start.add_position([(0,0), (1,1)])
.apply_defect_density(0.5, custom_rng)
- Next possible steps are:
- Continuing to build your geometry via:
...apply_defect_count(defect_counts).add_position(positions)
: to add more positions...apply_defect_count(defect_counts).apply_defect_count(n_defects)
: to randomly drop out n_atoms...apply_defect_count(defect_counts) .apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...apply_defect_count(defect_counts).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...apply_defect_count(defect_counts).rydberg
: to specify Rydberg coupling...apply_defect_count(defect_counts).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...apply_defect_count(defect_counts).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
|
enumerate
enumerate() -> Generator[LocationInfo, None, None]
enumerate all locations in the register.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
128 129 130 |
|
figure
figure(fig_kwargs=None, **assignments)
obtain a figure object from the atom arrangement.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
132 133 134 |
|
rydberg_interaction
rydberg_interaction(**assignments) -> NDArray
calculate the Rydberg interaction matrix.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**assignments
|
the values to assign to the variables in the register. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
NDArray |
NDArray
|
the Rydberg interaction matrix in the lower triangular form. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
scale
scale(scale: ScalarType)
Scale the geometry of your atoms.
Usage Example:
>>> reg = start.add_position([(0,0), (1,1)])
# atom positions are now (0,0), (2,2)
>>> new_reg = reg.scale(2)
# you may also use scale on pre-defined geometries
>>> from bloqade.analog.atom_arrangement import Chain
# atoms in the chain will now be 2 um apart versus
# the default 1 um
>>> Chain(11).scale(2)
- Next possible steps are:
- Continuing to build your geometry via:
...add_position(positions).add_position(positions)
: to add more positions...add_position(positions).apply_defect_count(n_defects)
: to randomly drop out n_atoms...add_position(positions).apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...add_position(positions).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...add_position(positions).rydberg
: to specify Rydberg coupling...add_position(positions).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...add_position(positions).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
|
show
show(**assignments) -> None
Display the current program being defined with the given arguments and batch ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Additional arguments for display. |
()
|
|
batch_id
|
int
|
The batch ID to be displayed. Defaults to 0. |
0
|
Note
This method uses the display_builder
function to render the builder's state.
Example:
>>> class MyBuilder(Show):
... pass
>>> builder = MyBuilder()
>>> builder.show()
>>> builder.show(batch_id=1)
>>> builder.show('arg1', 'arg2', batch_id=2)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
136 137 |
|
BoundedBravais
BoundedBravais(parent: Optional[Builder] = None)
Bases: AtomArrangement
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
__match_args__
class-attribute
instance-attribute
__match_args__ = ('shape', 'lattice_spacing')
Base classe for Bravais lattices
[AtomArrangement
][bloqade.ir.location.base.AtomArrangement].
- [
Square
][bloqade.ir.location.bravais.Square] - [
Chain
][bloqade.ir.location.bravais.Chain] - [
Honeycomb
][bloqade.ir.location.bravais.Honeycomb] - [
Triangular
][bloqade.ir.location.bravais.Triangular] - [
Lieb
][bloqade.ir.location.bravais.Lieb] - [
Kagome
][bloqade.ir.location.bravais.Kagome] - [
Rectangular
][bloqade.ir.location.bravais.Rectangular]
n_atoms
cached
property
n_atoms: int
number of atoms (filled sites) in the register.
n_dims
property
n_dims
dimension of the lattice
Returns:
Name | Type | Description |
---|---|---|
int |
dimension of the lattice |
n_sites
property
n_sites: int
number of sites in the register.
n_vacant
property
n_vacant: int
number of vacant sites in the register.
coordinates
coordinates(index: List[int]) -> NDArray
calculate the coordinates of a cell in the lattice given the cell index.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
113 114 115 116 117 118 119 120 121 122 |
|
enumerate
enumerate() -> Generator[LocationInfo, None, None]
enumerate all locations in the register.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
124 125 126 127 128 |
|
scale
scale(factor: ScalarType) -> BoundedBravais
Scale the current location with a factor.
(x,y) -> factor*(x,y)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
factor
|
str | Real | Decimal | Scalar
|
scale factor |
required |
Returns:
Name | Type | Description |
---|---|---|
BoundedBravais |
BoundedBravais
|
The lattice with the scaled locations |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
Chain
Chain(
L: int,
*,
lattice_spacing: ScalarType = 1.0,
vertical_chain: bool = False
)
Bases: BoundedBravais
Chain lattice.
- 1D lattice
- primitive (cell) vector(s)
- a1 = (1,0).
- unit cell (1 atom(s))
- loc (0,0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L
|
int
|
number of sites in the chain |
required |
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
183 184 185 186 187 188 189 190 |
|
Honeycomb
Honeycomb(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Honeycomb lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (1/2, sqrt(3)/2)
- unit cell (2 atom(s))
- loc1 (0, 0)
- loc2 (1/2, 1/(2*sqrt(3))
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of unit cells in linear direction. n_atoms = L1 * L1 * 2. |
required |
L2
|
Optional[int]
|
number of unit cells in direction a2. n_atoms = L1 * L2 * 2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
420 421 422 423 424 425 426 427 428 429 430 431 |
|
Kagome
Kagome(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Kagome lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (1/2, sqrt(3)/2)
- unit cell (3 atom(s))
- loc1 (0, 0)
- loc2 (0.5, 0)
- loc3 (0.25 ,0.25sqrt(3))
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of sites in linear direction. n_atoms = 3 * L1 * L1. |
required |
L2
|
Optional[int]
|
number of unit cells along a2 direction, n_atoms = 3 * L1 * L2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
589 590 591 592 593 594 595 596 597 598 599 |
|
Lieb
Lieb(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Lieb lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (0, 1)
- unit cell (3 atom(s))
- loc1 (0, 0)
- loc2 (0.5, 0)
- loc3 (0 ,0.5)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of unit cells in linear direction. n_atoms = 3* L1 * L1. |
required |
L2
|
Optional[int]
|
number of unit cells along a2 direction, n_atoms = 3 * L1 * L2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
534 535 536 537 538 539 540 541 542 |
|
ListOfLocations
ListOfLocations(
location_list: List[
Union[LocationInfo, Tuple[ScalarType, ScalarType]]
] = [],
)
Bases: AtomArrangement
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 |
|
n_atoms
property
n_atoms
number of atoms (filled sites) in the register.
n_dims
property
n_dims
number of dimensions in the register.
n_sites
property
n_sites
number of sites in the register.
n_vacant
property
n_vacant
number of vacant sites in the register.
enumerate
enumerate()
enumerate all locations in the register.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
661 662 |
|
ParallelRegister
ParallelRegister(parent: Optional[Builder] = None)
Bases: ProgramStart
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
n_atoms
property
n_atoms
Return the number of atoms in the program.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
The number of atoms in the parsed register. |
Raises:
Type | Description |
---|---|
ValueError
|
If the register type is unsupported. |
Note
If the register is of type ParallelRegister, the number of atoms is extracted from its internal register.
Example:
>>> class MyBuilder(Parse):
... pass
>>> builder = MyBuilder()
>>> n_atoms = builder.n_atoms
show
show(**assignments) -> None
Display the current program being defined with the given arguments and batch ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Additional arguments for display. |
()
|
|
batch_id
|
int
|
The batch ID to be displayed. Defaults to 0. |
0
|
Note
This method uses the display_builder
function to render the builder's state.
Example:
>>> class MyBuilder(Show):
... pass
>>> builder = MyBuilder()
>>> builder.show()
>>> builder.show(batch_id=1)
>>> builder.show('arg1', 'arg2', batch_id=2)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
559 560 |
|
Rectangular
Rectangular(
width: int,
height: int,
*,
lattice_spacing_x: ScalarType = 1.0,
lattice_spacing_y: ScalarType = 1.0
)
Bases: BoundedBravais
Rectangular lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1,0)
- a2 = (0,1)
- unit cell (1 atom(s))
- loc (0,0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
number of sites in x direction. |
required |
height
|
int
|
number of sites in y direction. |
required |
lattice_spacing_x
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
lattice_spacing_y
|
(Scalar, Real)
|
lattice spacing in y direction. optional. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
|
Square
Square(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Square lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1,0)
- a2 = (0,1)
- unit cell (1 atom(s))
- loc (0,0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of sites in linear direction. n_atoms = L1 * L1. |
required |
L2
|
Optional[int]
|
number of sites in direction a2. n_atoms = L1 * L2, default is L1 |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
240 241 242 243 244 245 246 247 248 249 |
|
Triangular
Triangular(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Triangular lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (1/2, sqrt(3)/2)
- unit cell (1 atom(s))
- loc (0, 0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L
|
int
|
number of sites in linear direction. n_atoms = L * L. |
required |
L2
|
Optional[int]
|
number of sites along a2 direction, n_atoms = L1 * L2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
477 478 479 480 481 482 483 484 485 486 487 |
|
bravais
BoundedBravais
BoundedBravais(parent: Optional[Builder] = None)
Bases: AtomArrangement
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
__match_args__
class-attribute
instance-attribute
__match_args__ = ('shape', 'lattice_spacing')
Base classe for Bravais lattices
[AtomArrangement
][bloqade.ir.location.base.AtomArrangement].
- [
Square
][bloqade.ir.location.bravais.Square] - [
Chain
][bloqade.ir.location.bravais.Chain] - [
Honeycomb
][bloqade.ir.location.bravais.Honeycomb] - [
Triangular
][bloqade.ir.location.bravais.Triangular] - [
Lieb
][bloqade.ir.location.bravais.Lieb] - [
Kagome
][bloqade.ir.location.bravais.Kagome] - [
Rectangular
][bloqade.ir.location.bravais.Rectangular]
n_atoms
cached
property
n_atoms: int
number of atoms (filled sites) in the register.
n_dims
property
n_dims
dimension of the lattice
Returns:
Name | Type | Description |
---|---|---|
int |
dimension of the lattice |
n_sites
property
n_sites: int
number of sites in the register.
n_vacant
property
n_vacant: int
number of vacant sites in the register.
coordinates
coordinates(index: List[int]) -> NDArray
calculate the coordinates of a cell in the lattice given the cell index.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
113 114 115 116 117 118 119 120 121 122 |
|
enumerate
enumerate() -> Generator[LocationInfo, None, None]
enumerate all locations in the register.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
124 125 126 127 128 |
|
scale
scale(factor: ScalarType) -> BoundedBravais
Scale the current location with a factor.
(x,y) -> factor*(x,y)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
factor
|
str | Real | Decimal | Scalar
|
scale factor |
required |
Returns:
Name | Type | Description |
---|---|---|
BoundedBravais |
BoundedBravais
|
The lattice with the scaled locations |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 |
|
Chain
Chain(
L: int,
*,
lattice_spacing: ScalarType = 1.0,
vertical_chain: bool = False
)
Bases: BoundedBravais
Chain lattice.
- 1D lattice
- primitive (cell) vector(s)
- a1 = (1,0).
- unit cell (1 atom(s))
- loc (0,0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L
|
int
|
number of sites in the chain |
required |
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
183 184 185 186 187 188 189 190 |
|
Honeycomb
Honeycomb(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Honeycomb lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (1/2, sqrt(3)/2)
- unit cell (2 atom(s))
- loc1 (0, 0)
- loc2 (1/2, 1/(2*sqrt(3))
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of unit cells in linear direction. n_atoms = L1 * L1 * 2. |
required |
L2
|
Optional[int]
|
number of unit cells in direction a2. n_atoms = L1 * L2 * 2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
420 421 422 423 424 425 426 427 428 429 430 431 |
|
Kagome
Kagome(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Kagome lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (1/2, sqrt(3)/2)
- unit cell (3 atom(s))
- loc1 (0, 0)
- loc2 (0.5, 0)
- loc3 (0.25 ,0.25sqrt(3))
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of sites in linear direction. n_atoms = 3 * L1 * L1. |
required |
L2
|
Optional[int]
|
number of unit cells along a2 direction, n_atoms = 3 * L1 * L2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
589 590 591 592 593 594 595 596 597 598 599 |
|
Lieb
Lieb(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Lieb lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (0, 1)
- unit cell (3 atom(s))
- loc1 (0, 0)
- loc2 (0.5, 0)
- loc3 (0 ,0.5)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of unit cells in linear direction. n_atoms = 3* L1 * L1. |
required |
L2
|
Optional[int]
|
number of unit cells along a2 direction, n_atoms = 3 * L1 * L2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
534 535 536 537 538 539 540 541 542 |
|
Rectangular
Rectangular(
width: int,
height: int,
*,
lattice_spacing_x: ScalarType = 1.0,
lattice_spacing_y: ScalarType = 1.0
)
Bases: BoundedBravais
Rectangular lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1,0)
- a2 = (0,1)
- unit cell (1 atom(s))
- loc (0,0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
width
|
int
|
number of sites in x direction. |
required |
height
|
int
|
number of sites in y direction. |
required |
lattice_spacing_x
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
lattice_spacing_y
|
(Scalar, Real)
|
lattice spacing in y direction. optional. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 |
|
Square
Square(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Square lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1,0)
- a2 = (0,1)
- unit cell (1 atom(s))
- loc (0,0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L1
|
int
|
number of sites in linear direction. n_atoms = L1 * L1. |
required |
L2
|
Optional[int]
|
number of sites in direction a2. n_atoms = L1 * L2, default is L1 |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
240 241 242 243 244 245 246 247 248 249 |
|
Triangular
Triangular(
L1: int,
L2: Optional[int] = None,
*,
lattice_spacing: ScalarType = 1.0
)
Bases: BoundedBravais
Triangular lattice.
- 2D lattice
- primitive (cell) vector(s)
- a1 = (1, 0)
- a2 = (1/2, sqrt(3)/2)
- unit cell (1 atom(s))
- loc (0, 0)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
L
|
int
|
number of sites in linear direction. n_atoms = L * L. |
required |
L2
|
Optional[int]
|
number of sites along a2 direction, n_atoms = L1 * L2, default is L1. |
None
|
lattice_spacing
|
(Scalar, Real)
|
lattice spacing. Defaults to 1.0. |
1.0
|
- Possible Next:
continue with
.
to see possible next step in auto-prompt supported setting (IPython, IDE ...)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/bravais.py
477 478 479 480 481 482 483 484 485 486 487 |
|
location
AtomArrangement
AtomArrangement(parent: Optional[Builder] = None)
Bases: ProgramStart
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
n_atoms
property
n_atoms: int
number of atoms (filled sites) in the register.
n_dims
property
n_dims: int
number of dimensions in the register.
n_sites
property
n_sites: int
number of sites in the register.
n_vacant
property
n_vacant: int
number of vacant sites in the register.
add_position
add_position(
position: Union[
PositionArray,
List[Tuple[ScalarType, ScalarType]],
Tuple[ScalarType, ScalarType],
],
filling: Optional[
Union[BoolArray, List[bool], bool]
] = None,
) -> ListOfLocations
Add a position or multiple positions to a pre-existing geometry.
add_position
is capable of accepting:
- A single tuple for one atom coordinate: (1.0, 2.5)
- A list of tuples: `[(0.0, 1.0), (2.0,1.5), etc.]
- A numpy array of shape (N, 2) where N is the number of atoms
You may also intersperse variables anywhere a value may be present.
You can also pass in an optional argument which determines the atom "filling" (whether or not at a specified coordinate an atom should be present).
Usage Example:
# single coordinate
>>> reg = start.add_position((0,0))
# you may chain add_position calls
>>> reg_plus_two = reg.add_position([(2,2),(5.0, 2.1)])
# you can add variables anywhere a value may be present
>>> reg_with_var = reg_plus_two.add_position(("x", "y"))
# and specify your atom fillings
>>> reg_with_filling = reg_with_var.add_position([(3.1, 0.0), (4.1, 2.2)],
[True, False])
# alternatively you could use one boolean to specify
# all coordinates should be empty/filled
>>> reg_with_more_filling = reg_with_filling.add_positions([(3.1, 2.9),
(5.2, 2.2)], False)
- Next possible steps are:
- Continuing to build your geometry via:
...add_position(positions).add_position(positions)
: to add more positions...add_position(positions).apply_defect_count(n_defects)
: to randomly drop out n_atoms...add_position(positions).apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...add_position(positions).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...add_position(positions).rydberg
: to specify Rydberg coupling...add_position(positions).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...add_position(positions).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 |
|
apply_defect_count
apply_defect_count(
n_defects: int, rng: Generator = np.random.default_rng()
)
Drop n_defects
atoms from the geometry randomly. Internally this occurs
by setting certain sites to have a SiteFilling set to false indicating
no atom is present at the coordinate.
A default numpy-based Random Number Generator is used but you can explicitly override this by passing in your own.
Usage Example:
>>> from bloqade.analog.atom_arrangement import Chain
>>> import numpy as np
# set a custom seed for a numpy-based RNG
>>> custom_rng = np.random.default_rng(888)
# randomly remove two atoms from the geometry
>>> reg = Chain(11).apply_defect_count(2, custom_rng)
# you may also chain apply_defect_count calls
>>> reg.apply_defect_count(2, custom_rng)
# you can also use apply_defect_count on custom geometries
>>> from bloqade import start
>>> start.add_position([(0,0), (1,1)]).apply_defect_count(1, custom_rng)
- Next possible steps are:
- Continuing to build your geometry via:
...apply_defect_count(defect_counts).add_position(positions)
: to add more positions...apply_defect_count(defect_counts) .apply_defect_count(n_defects)
: to randomly drop out n_atoms...apply_defect_count(defect_counts) .apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...apply_defect_count(defect_counts).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...apply_defect_count(defect_counts).rydberg
: to specify Rydberg coupling...apply_defect_count(defect_counts).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...apply_defect_count(defect_counts).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
|
apply_defect_density
apply_defect_density(
defect_probability: float,
rng: Generator = np.random.default_rng(),
)
Drop atoms randomly with defect_probability
probability (range of 0 to 1).
Internally this occurs by setting certain sites to have a SiteFilling
set to false indicating no atom is present at the coordinate.
A default numpy-based Random Number Generator is used but you can explicitly override this by passing in your own.
Usage Example:
>>> from bloqade.analog.atom_arrangement import Chain
>>> import numpy as np
# set a custom seed for a numpy-based RNG
>>> custom_rng = np.random.default_rng(888)
# randomly remove two atoms from the geometry
>>> reg = Chain(11).apply_defect_density(0.2, custom_rng)
# you may also chain apply_defect_density calls
>>> reg.apply_defect_count(0.1, custom_rng)
# you can also use apply_defect_density on custom geometries
>>> from bloqade import start
>>> start.add_position([(0,0), (1,1)])
.apply_defect_density(0.5, custom_rng)
- Next possible steps are:
- Continuing to build your geometry via:
...apply_defect_count(defect_counts).add_position(positions)
: to add more positions...apply_defect_count(defect_counts).apply_defect_count(n_defects)
: to randomly drop out n_atoms...apply_defect_count(defect_counts) .apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...apply_defect_count(defect_counts).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...apply_defect_count(defect_counts).rydberg
: to specify Rydberg coupling...apply_defect_count(defect_counts).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...apply_defect_count(defect_counts).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 |
|
enumerate
enumerate() -> Generator[LocationInfo, None, None]
enumerate all locations in the register.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
128 129 130 |
|
figure
figure(fig_kwargs=None, **assignments)
obtain a figure object from the atom arrangement.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
132 133 134 |
|
rydberg_interaction
rydberg_interaction(**assignments) -> NDArray
calculate the Rydberg interaction matrix.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
**assignments
|
the values to assign to the variables in the register. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
NDArray |
NDArray
|
the Rydberg interaction matrix in the lower triangular form. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 |
|
scale
scale(scale: ScalarType)
Scale the geometry of your atoms.
Usage Example:
>>> reg = start.add_position([(0,0), (1,1)])
# atom positions are now (0,0), (2,2)
>>> new_reg = reg.scale(2)
# you may also use scale on pre-defined geometries
>>> from bloqade.analog.atom_arrangement import Chain
# atoms in the chain will now be 2 um apart versus
# the default 1 um
>>> Chain(11).scale(2)
- Next possible steps are:
- Continuing to build your geometry via:
...add_position(positions).add_position(positions)
: to add more positions...add_position(positions).apply_defect_count(n_defects)
: to randomly drop out n_atoms...add_position(positions).apply_defect_density(defect_probability)
: to drop out atoms with a certain probability...add_position(positions).scale(scale)
: to scale the geometry
- Targeting a level coupling once you're done with the atom geometry:
...add_position(positions).rydberg
: to specify Rydberg coupling...add_position(positions).hyperfine
: to specify Hyperfine coupling
- Visualizing your atom geometry:
...add_position(positions).show()
: shows your geometry in your web browser
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 |
|
show
show(**assignments) -> None
Display the current program being defined with the given arguments and batch ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Additional arguments for display. |
()
|
|
batch_id
|
int
|
The batch ID to be displayed. Defaults to 0. |
0
|
Note
This method uses the display_builder
function to render the builder's state.
Example:
>>> class MyBuilder(Show):
... pass
>>> builder = MyBuilder()
>>> builder.show()
>>> builder.show(batch_id=1)
>>> builder.show('arg1', 'arg2', batch_id=2)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
136 137 |
|
ListOfLocations
ListOfLocations(
location_list: List[
Union[LocationInfo, Tuple[ScalarType, ScalarType]]
] = [],
)
Bases: AtomArrangement
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 |
|
n_atoms
property
n_atoms
number of atoms (filled sites) in the register.
n_dims
property
n_dims
number of dimensions in the register.
n_sites
property
n_sites
number of sites in the register.
n_vacant
property
n_vacant
number of vacant sites in the register.
enumerate
enumerate()
enumerate all locations in the register.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
661 662 |
|
ParallelRegister
ParallelRegister(parent: Optional[Builder] = None)
Bases: ProgramStart
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/builder/base.py
10 11 12 13 14 |
|
n_atoms
property
n_atoms
Return the number of atoms in the program.
Returns:
Name | Type | Description |
---|---|---|
int |
int
|
The number of atoms in the parsed register. |
Raises:
Type | Description |
---|---|
ValueError
|
If the register type is unsupported. |
Note
If the register is of type ParallelRegister, the number of atoms is extracted from its internal register.
Example:
>>> class MyBuilder(Parse):
... pass
>>> builder = MyBuilder()
>>> n_atoms = builder.n_atoms
show
show(**assignments) -> None
Display the current program being defined with the given arguments and batch ID.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
Additional arguments for display. |
()
|
|
batch_id
|
int
|
The batch ID to be displayed. Defaults to 0. |
0
|
Note
This method uses the display_builder
function to render the builder's state.
Example:
>>> class MyBuilder(Show):
... pass
>>> builder = MyBuilder()
>>> builder.show()
>>> builder.show(batch_id=1)
>>> builder.show('arg1', 'arg2', batch_id=2)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
559 560 |
|
ParallelRegisterInfo
ParallelRegisterInfo(parallel_register: ParallelRegister)
ParallelRegisterInfo
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/location/location.py
571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 |
|
routine
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 |
|
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 |
|
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 |
|
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 |
|
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 |
|
bloqade
BloqadeEmulation
dataclass
BloqadeEmulation(
task_data: TaskData,
compile_cache: Optional[CompileCache] = None,
)
Data class to hold the Hamiltonian and metadata for a given set of parameters
hamiltonian
property
hamiltonian: RydbergHamiltonian
Return the Hamiltonian object for the given task data.
metadata
property
metadata: NamedTuple
The metadata for the given task data.
evolve
evolve(
state: Optional[StateVector] = None,
solver_name: str = "dop853",
atol: float = 1e-07,
rtol: float = 1e-14,
nsteps: int = 2147483647,
times: Sequence[float] = (),
interaction_picture: bool = False,
) -> Iterator[StateVector]
Evolve an initial state vector using the Hamiltonian
Parameters:
Name | Type | Description | Default |
---|---|---|---|
state
|
Optional[StateVector]
|
The initial state vector to |
None
|
solver_name
|
str
|
Which SciPy Solver to use. Defaults to |
'dop853'
|
atol
|
float
|
Absolute tolerance for ODE solver. Defaults |
1e-07
|
rtol
|
float
|
Relative tolerance for adaptive step in |
1e-14
|
nsteps
|
int
|
Maximum number of steps allowed per integration |
2147483647
|
times
|
Sequence[float]
|
The times to evaluate the state vector |
()
|
interaction_picture
|
bool
|
Use the interaction picture when |
False
|
Returns:
Type | Description |
---|---|
Iterator[StateVector]
|
Iterator[StateVector]: An iterator of the state vectors at each time step. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/bloqade.py
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 |
|
fock_state
fock_state(
fock_state_str: str, dtype: dtype = np.float64
) -> StateVector
Return the fock state for the given Hamiltonian.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/bloqade.py
91 92 93 94 95 96 97 98 |
|
zero_state
zero_state(dtype: dtype = np.float64) -> StateVector
Return the zero state for the given Hamiltonian.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/bloqade.py
87 88 89 |
|
BloqadePythonRoutine
Bases: RoutineBase
hamiltonian
hamiltonian(
*args: LiteralType,
blockade_radius: float = 0.0,
use_hyperfine: bool = False,
waveform_runtime: str = "interpret",
cache_matrices: bool = False
) -> List[BloqadeEmulation]
Generates a list of BloqadeEmulation objects which contain the Hamiltonian of your program.
If you have a variable(s) in your program you have assigned multiple values via batch_assign()
there will be multiple BloqadeEmulation
objects, one for each value. On the other hand
if the program only assumes a singular value per each variable, there will only be
one BloqadeEmulation
object but it will still be encapsulated in a list.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
*args
|
LiteralType
|
If your program has a variable that was declared as run-time assignable
via |
()
|
blockade_radius
|
float
|
The radius in which atoms blockade eachother. Default value is 0.0 micrometers. |
0.0
|
use_hyperfine
|
bool
|
Should the Hamiltonian account for hyperfine levels. Default value is False. |
False
|
waveform_runtime
|
str
|
Specify which runtime to use for waveforms. If "numba" is specify the waveform is compiled, otherwise it is interpreted via the "interpret" argument. Defaults to "interpret". |
'interpret'
|
cache_matrices
|
bool
|
Speed up Hamiltonian generation by reusing data (when possible) from previously generated Hamiltonians. Default value is False. |
False
|
Returns:
Type | Description |
---|---|
List[BloqadeEmulation]
|
List[BloqadeEmulation] |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/bloqade.py
505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 |
|
run
run(
shots: int,
args: Tuple[LiteralType, ...] = (),
name: Optional[str] = None,
blockade_radius: float = 0.0,
waveform_runtime: str = "interpret",
interaction_picture: bool = False,
cache_matrices: bool = False,
multiprocessing: bool = False,
num_workers: Optional[int] = None,
solver_name: str = "dop853",
atol: float = 1e-07,
rtol: float = 1e-14,
nsteps: int = 2147483647,
) -> LocalBatch
Run the current program using bloqade python backend
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shots
|
int
|
number of shots after running state vector simulation |
required |
args
|
Tuple[LiteralType, ...]
|
The values for parameters defined |
()
|
name
|
Optional[str]
|
Name to give this run. Defaults to None. |
None
|
blockade_radius
|
float
|
Use the Blockade subspace given a |
0.0
|
waveform_runtime
|
str
|
(bool, optional): Use Numba to compile the waveforms, |
'interpret'
|
interaction_picture
|
bool
|
Use the interaction picture when |
False
|
cache_matrices
|
bool
|
Reuse previously evaluated matrcies when |
False
|
multiprocessing
|
bool
|
Use multiple processes to process the |
False
|
num_workers
|
Optional[int]
|
Number of processes to run with |
None
|
solver_name
|
str
|
Which SciPy Solver to use. Defaults to |
'dop853'
|
atol
|
float
|
Absolute tolerance for ODE solver. Defaults to |
1e-07
|
rtol
|
float
|
Relative tolerance for adaptive step in ODE solver. |
1e-14
|
nsteps
|
int
|
Maximum number of steps allowed per integration |
2147483647
|
Raises:
Type | Description |
---|---|
ValueError
|
Cannot use multiprocessing and cache_matrices at the same time. |
Returns:
Name | Type | Description |
---|---|---|
LocalBatch |
LocalBatch
|
Batch of local tasks that have been executed. |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/bloqade.py
233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 |
|
run_callback
run_callback(
callback: Callable[
[StateVector, NamedTuple, RydbergHamiltonian, Any],
Any,
],
program_args: Tuple[LiteralType, ...] = (),
callback_args: Tuple = (),
ignore_exceptions: bool = False,
blockade_radius: float = 0.0,
waveform_runtime: str = "interpret",
interaction_picture: bool = False,
cache_matrices: bool = False,
multiprocessing: bool = False,
num_workers: Optional[int] = None,
solver_name: str = "dop853",
atol: float = 1e-07,
rtol: float = 1e-14,
nsteps: int = 2147483647,
use_hyperfine: bool = False,
) -> List
Run state-vector simulation with a callback to access full state-vector from emulator
Parameters:
Name | Type | Description | Default |
---|---|---|---|
callback
|
Callable[[StateVector, Metadata, RydbergHamiltonian, Any], Any]
|
|
required |
program_args
|
Tuple[LiteralType, ...]
|
The values for parameters |
()
|
callback_args
|
Tuple[Any, ...]
|
Extra arguments to pass into |
()
|
ignore_exceptions
|
bool
|
(bool, optional) If |
False
|
blockade_radius
|
float
|
Use the Blockade subspace given a |
0.0
|
waveform_runtime
|
str
|
(str, optional): Specify which runtime to use for |
'interpret'
|
interaction_picture
|
bool
|
Use the interaction picture when |
False
|
cache_matrices
|
bool
|
Reuse previously evaluated matrcies when |
False
|
multiprocessing
|
bool
|
Use multiple processes to process the |
False
|
num_workers
|
Optional[int]
|
Number of processes to run with |
None
|
solver_name
|
str
|
Which SciPy Solver to use. Defaults to |
'dop853'
|
atol
|
float
|
Absolute tolerance for ODE solver. Defaults to |
1e-07
|
rtol
|
float
|
Relative tolerance for adaptive step in ODE solver. |
1e-14
|
nsteps
|
int
|
Maximum number of steps allowed per integration |
2147483647
|
Returns:
Name | Type | Description |
---|---|---|
List |
List
|
List of resulting outputs from the callbacks |
Raises:
Type | Description |
---|---|
RuntimeError
|
Raises the first error that occurs, only if |
Note
For the callback
function, first argument is the many-body wavefunction
as a 1D complex numpy array, the second argument is of type Metadata
which
is a Named Tuple where the fields correspond to the parameters of that given
task, RydbergHamiltonian is the object that contains the Hamiltonian used to
generate the evolution for that task, Finally any optional positional
arguments are allowed after that. The return value can be anything, the
results will be collected in a list for each task in the batch.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/bloqade.py
347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 |
|
TaskData
dataclass
TaskData(
task_id: int,
emulator_ir: EmulatorProgram,
metadata_dict: Dict[str, LiteralType],
)
Data class to hold the program ir and metadata for a given set of parameters
braket
BraketHardwareRoutine
Bases: RoutineBase
__call__
__call__(
*args: LiteralType,
shots: int = 1,
name: Optional[str] = None,
use_experimental: bool = False,
shuffle: bool = False,
**kwargs
)
Compile to a RemoteBatch, which contain Braket backend specific tasks, run_async to Braket, and wait until the results are coming back.
Note
This is sync, and will wait until remote results finished.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shots
|
int
|
number of shots |
1
|
args
|
LiteralType
|
additional arguments for args variables. |
()
|
name
|
str
|
custom name of the batch |
None
|
shuffle
|
bool
|
shuffle the order of jobs |
False
|
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/braket.py
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 |
|
run
run(
shots: int,
args: Tuple[LiteralType, ...] = (),
name: Optional[str] = None,
use_experimental: bool = False,
shuffle: bool = False,
**kwargs
) -> RemoteBatch
Compile to a RemoteBatch, which contain Braket backend specific tasks, run_async to Braket, and wait until the results are coming back.
Note
This is sync, and will wait until remote results finished.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shots
|
int
|
number of shots |
required |
args
|
Tuple
|
additional arguments |
()
|
name
|
str
|
custom name of the batch |
None
|
shuffle
|
bool
|
shuffle the order of jobs |
False
|
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/braket.py
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 |
|
run_async
run_async(
shots: int,
args: Tuple[LiteralType, ...] = (),
name: Optional[str] = None,
use_experimental: bool = False,
shuffle: bool = False,
**kwargs
) -> RemoteBatch
Compile to a RemoteBatch, which contain Braket backend specific tasks, and run_async to Braket.
Note
This is async.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shots
|
int
|
number of shots |
required |
args
|
Tuple
|
Values of the parameter defined in |
()
|
name
|
str | None
|
custom name of the batch, defaults to None |
None
|
use_experimental
|
bool
|
Use experimental hardware capabilities |
False
|
shuffle
|
bool
|
shuffle the order of jobs |
False
|
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/braket.py
84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
|
BraketLocalEmulatorRoutine
Bases: RoutineBase
__call__
__call__(
*args: LiteralType,
shots: int = 1,
name: Optional[str] = None,
multiprocessing: bool = False,
num_workers: Optional[int] = None,
**kwargs
)
Compile to a LocalBatch, and run. The LocalBatch contain tasks to run on local emulator.
Note
This is sync, and will wait until remote results finished.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shots
|
int
|
number of shots |
1
|
args
|
LiteralType
|
additional arguments for args variables. |
()
|
multiprocessing
|
bool
|
enable multi-process |
False
|
num_workers
|
int
|
number of workers to run the emulator |
None
|
Return
LocalBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/braket.py
263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 |
|
run
run(
shots: int,
args: Tuple[LiteralType, ...] = (),
name: Optional[str] = None,
multiprocessing: bool = False,
num_workers: Optional[int] = None,
**kwargs
) -> LocalBatch
Compile to a LocalBatch, and run. The LocalBatch contain tasks to run on local emulator.
Note
This is sync, and will wait until remote results finished.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shots
|
int
|
number of shots |
required |
args
|
Tuple[LiteralType, ...]
|
additional arguments for args variables. |
()
|
multiprocessing
|
bool
|
enable multi-process |
False
|
num_workers
|
int
|
number of workers to run the emulator |
None
|
Return
LocalBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/braket.py
230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
|
quera
CustomSubmissionRoutine
Bases: RoutineBase
run
run(
shots: int,
RemoteTask: type[RemoteTaskType],
args: Tuple[LiteralType, ...] = (),
name: Optional[str] = None,
use_experimental: bool = False,
shuffle: bool = False,
**kwargs
) -> RemoteBatch
Run the custom task and return the result.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shots
|
int
|
number of shots |
required |
RemoteTask
|
type
|
type of the remote task, must subclass of CustomRemoteTaskABC |
required |
args
|
Tuple
|
additional arguments for remaining un |
()
|
name
|
str
|
name of the batch object |
None
|
shuffle
|
bool
|
shuffle the order of jobs |
False
|
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/quera.py
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 |
|
run_async
run_async(
shots: int,
RemoteTask: type[RemoteTaskType],
args: Tuple[LiteralType, ...] = (),
name: Optional[str] = None,
use_experimental: bool = False,
shuffle: bool = False,
**kwargs
) -> RemoteBatch
Compile to a RemoteBatch, which contain QuEra backend specific tasks, and run_async through QuEra service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shots
|
int
|
number of shots |
required |
args
|
Tuple
|
additional arguments |
()
|
name
|
str
|
custom name of the batch |
None
|
shuffle
|
bool
|
shuffle the order of jobs |
False
|
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/quera.py
218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|
submit
submit(
shots: int,
url: str,
json_body_template: str,
method: str = "POST",
args: Tuple[LiteralType] = (),
request_options: Dict[str, Any] = {},
use_experimental: bool = False,
sleep_time: float = 0.1,
) -> List[Tuple[NamedTuple, Response]]
Compile to QuEraTaskSpecification and submit to a custom service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shots
|
int
|
number of shots |
required |
url
|
str
|
url of the custom service |
required |
json_body_template
|
str
|
json body template, must contain '{task_ir}' |
required |
method
|
str
|
http method to be used. Defaults to "POST". |
'POST'
|
args
|
Tuple[LiteralType]
|
additional arguments to be passed into the |
()
|
request_options
|
Dict[str, Any]
|
additional options to be passed into the request method, |
{}
|
use_experimental
|
bool
|
Enable experimental hardware capabilities |
False
|
sleep_time
|
float
|
time to sleep between each request. Defaults to 0.1. |
0.1
|
Returns:
Type | Description |
---|---|
List[Tuple[NamedTuple, Response]]
|
List[Tuple[NamedTuple, Response]]: List of parameters for each batch in |
List[Tuple[NamedTuple, Response]]
|
the task and the response from the post request. |
Examples:
Here is a simple example of how to use this method. Note the body_template has double curly braces on the outside to escape the string formatting.
>>> body_template = "{{"token": "my_token", "task": {task_ir}}}"
>>> responses = (
program.quera.custom.submit(
100,
"http://my_custom_service.com",
body_template
)
)
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/quera.py
90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 |
|
QuEraHardwareRoutine
Bases: RoutineBase
run_async
run_async(
shots: int,
args: Tuple[LiteralType, ...] = (),
name: Optional[str] = None,
use_experimental: bool = False,
shuffle: bool = False,
**kwargs
) -> RemoteBatch
Compile to a RemoteBatch, which contain QuEra backend specific tasks, and run_async through QuEra service.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
shots
|
int
|
number of shots |
required |
args
|
Tuple
|
additional arguments |
()
|
name
|
str
|
custom name of the batch |
None
|
shuffle
|
bool
|
shuffle the order of jobs |
False
|
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/routine/quera.py
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 |
|
scalar
Literal
Bases: Real
value
instance-attribute
value: Decimal
Scalar Literal, which stores a decimaal value instance.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
value
|
Decimal
|
decimal value instance |
required |
Scalar
Base class for all scalar expressions.
<scalar> ::= <literal>
| <variable>
| <default>
| <negative>
| <add>
| <mul>
| <min>
| <max>
| <slice>
| <inverval>
<mul> ::= <scalar> '*' <scalar>
<add> ::= <scalar> '+' <scalar>
<min> ::= 'min' <scalar>+
<max> ::= 'max' <scalar>+
<slice> ::= <scalar expr> '[' <interval> ']'
<interval> ::= <scalar expr> '..' <scalar expr>
<real> ::= <literal> | <var>
Variable
Bases: Real
Variable, which stores a variable name.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
name
|
str
|
variable instance. |
required |
cast
cast(py) -> Scalar
-
cast Real number (or list/tuple of Real numbers) to [
Scalar Literal
][bloqade.ir.scalar.Literal]. -
cast str (or list/tuple of Real numbers) to [
Scalar Variable
][bloqade.ir.scalar.Variable].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
py
|
Union[str, Real, Tuple[Real], List[Real]]
|
python object to cast |
required |
Returns:
Type | Description |
---|---|
Scalar
|
Scalar |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/scalar.py
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 |
|
var
var(py: str) -> Variable
cast string (or list/tuple of strings)
to [Variable
][bloqade.ir.scalar.Variable].
Parameters:
Name | Type | Description | Default |
---|---|---|---|
py
|
Union[str, List[str]]
|
a string or list/tuple of strings |
required |
Returns:
Type | Description |
---|---|
Variable
|
Union[Variable] |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/ir/scalar.py
241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 |
|
serialize
dumps
dumps(
o: Any, use_decimal: bool = True, **json_kwargs
) -> str
Serialize object to string
Parameters:
Name | Type | Description | Default |
---|---|---|---|
o
|
Any
|
the object to serialize |
required |
use_decimal
|
bool
|
use decimal.Decimal for numbers. Defaults to True. |
True
|
**json_kwargs
|
other arguments passed to json.dumps |
{}
|
Returns:
Name | Type | Description |
---|---|---|
str |
str
|
the serialized object as a string |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/serialize.py
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 |
|
load
load(
fp: Union[TextIO, str],
use_decimal: bool = True,
**json_kwargs
)
Load object from file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
fp
|
Union[TextIO, str]
|
the file path or file object |
required |
use_decimal
|
bool
|
use decimal.Decimal for numbers. Defaults to True. |
True
|
**json_kwargs
|
other arguments passed to json.load |
{}
|
Returns:
Name | Type | Description |
---|---|---|
Any |
the deserialized object |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/serialize.py
132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
|
loads
loads(s: str, use_decimal: bool = True, **json_kwargs)
Load object from string
Parameters:
Name | Type | Description | Default |
---|---|---|---|
s
|
str
|
the string to load |
required |
use_decimal
|
bool
|
use decimal.Decimal for numbers. Defaults to True. |
True
|
**json_kwargs
|
other arguments passed to json.loads |
{}
|
Returns:
Name | Type | Description |
---|---|---|
Any |
the deserialized object |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/serialize.py
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
|
save
save(
o: Any,
fp: Union[TextIO, str],
use_decimal=True,
**json_kwargs
) -> None
Serialize object to file
Parameters:
Name | Type | Description | Default |
---|---|---|---|
o
|
Any
|
the object to serialize |
required |
fp
|
Union[TextIO, str]
|
the file path or file object |
required |
use_decimal
|
bool
|
use decimal.Decimal for numbers. Defaults to True. |
True
|
**json_kwargs
|
other arguments passed to json.dump |
{}
|
Returns:
Type | Description |
---|---|
None
|
None |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/serialize.py
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 |
|
submission
ir
braket
Helper functions related to IR submission co-ordinations between Bloqade and Braket
BraketTaskSpecification
Bases: BaseModel
Class representing geometry of an atom arrangement.
Attributes:
Name | Type | Description |
---|---|---|
nshots |
int
|
Number of shots |
program |
Program
|
IR(Intermediate Representation) program suitable for braket |
extract_braket_program
extract_braket_program(
quera_task_ir: QuEraTaskSpecification,
)
Extracts the Braket program.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
quera_task_ir
|
QuEraTaskSpecification
|
Quera IR(Intermediate representation) of the task. |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/submission/ir/braket.py
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
from_braket_status_codes
from_braket_status_codes(
braket_status: str,
) -> QuEraTaskStatusCode
Gets the QuEraTaskStatusCode
object for working with Bloqade SDK.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
braket_status
|
str
|
str
The value of status in metadata() in the Amazon Braket.
|
required |
Returns:
Type | Description |
---|---|
QuEraTaskStatusCode
|
An object of the type |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/submission/ir/braket.py
188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
|
from_braket_task_results
from_braket_task_results(
braket_task_results: AnalogHamiltonianSimulationTaskResult,
) -> QuEraTaskResults
Get the QuEraTaskResults
object for working with Bloqade SDK.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
braket_task_results
|
AnalogHamiltonianSimulationTaskResult
|
AnalogHamiltonianSimulationTaskResult Quantum task result of braket system |
required |
Returns:
Type | Description |
---|---|
QuEraTaskResults
|
An object of the type |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/submission/ir/braket.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 |
|
to_braket_field
to_braket_field(
quera_field: Union[GlobalField, LocalField],
) -> Field
Converts to TimeSeries
object supported by Braket.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
quera_field
|
Union[GlobalField, LocalField)]
|
Field supported by Quera |
required |
Returns:
Type | Description |
---|---|
Field
|
An object of the type |
Raises:
Type | Description |
---|---|
TypeError
|
If field is not of the type |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/submission/ir/braket.py
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 |
|
to_braket_task
to_braket_task(
quera_task_ir: QuEraTaskSpecification,
) -> Tuple[int, AnalogHamiltonianSimulation]
Converts to Tuple[int, AnalogHamiltonianSimulation]
object supported by Braket.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
quera_task_ir
|
QuEraTaskSpecification
|
Quera IR(Intermediate representation) of the task. |
required |
Returns:
Type | Description |
---|---|
Tuple[int, AnalogHamiltonianSimulation]
|
An tuple of the type |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/submission/ir/braket.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 |
|
to_braket_task_ir
to_braket_task_ir(
quera_task_ir: QuEraTaskSpecification,
) -> BraketTaskSpecification
Converts quera IR(Intermendiate Representation) to
to BraketTaskSpecification
object.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
quera_task_ir
|
QuEraTaskSpecification
|
Quera IR(Intermediate representation) of the task. |
required |
Returns:
Type | Description |
---|---|
BraketTaskSpecification
|
An object of the type |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/submission/ir/braket.py
145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
to_braket_time_series
to_braket_time_series(
times: List[Decimal], values: List[Decimal]
) -> TimeSeries
Converts to TimeSeries
object supported by Braket.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
times
|
List[Decimal]
|
Times of the value. |
required |
values
|
List[Decimal]
|
Corresponding values to add to the time series |
required |
Returns:
Type | Description |
---|---|
TimeSeries
|
An object of the type |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/submission/ir/braket.py
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
|
to_quera_capabilities
to_quera_capabilities(paradigm) -> cp.QuEraCapabilities
Converts to QuEraCapabilities
object supported by Braket.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
paradigm
|
The |
required |
Returns:
Type | Description |
---|---|
QuEraCapabilities
|
An object of the type |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/submission/ir/braket.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
|
parallel
ClusterLocationInfo
Bases: BaseModel
Class that stores the mapping of batched jobs.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
cluster_index
|
int
|
the index of the cluster a site belongs to |
required |
global_location_index
|
int
|
the index of the site in the multplexed system |
required |
cluster_location_index
|
int
|
the index of the site in the original system |
required |
task_results
QuEraTaskResults
Bases: BaseModel
export_as_probabilities
export_as_probabilities() -> TaskProbabilities
converts from shot results to probabilities
Returns:
Name | Type | Description |
---|---|---|
TaskProbabilities |
TaskProbabilities
|
The task results as probabilties |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/submission/ir/task_results.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
QuEraTaskStatusCode
Bases: str
, Enum
An Enum representing the various states a task can be in within the QuEra system.
Attributes:
Name | Type | Description |
---|---|---|
Created |
The task has been created but not yet started. |
|
Running |
The task is currently running. |
|
Completed |
The task has completed successfully. |
|
Failed |
The task has failed. |
|
Cancelled |
The task has been cancelled. |
|
Executing |
The task is currently being executed. |
|
Enqueued |
The task is in the queue waiting to be executed. |
|
Accepted |
The task has been accepted for execution. |
|
Unaccepted |
The task has not been accepted for execution. |
|
Partial |
The task has partially completed. |
|
Unsubmitted |
The task has not been submitted for execution. |
task
base
Geometry
Class representing geometry of an atom arrangement.
Attributes:
Name | Type | Description |
---|---|---|
sites |
List[Tuple[float, float]]
|
Atom site arrangement |
filling |
List[int]
|
Which sites are filled |
parallel_decoder |
Optional[ParallelDecoder]
|
Decoder object for decoding Geometry object |
LocalTask
Bases: Task
Task
to use for local executions for simulation purposes..
RemoteTask
Bases: Task
Task
to use for remote executions to run the program on Quera
Quantum Computers.
Report
Report(data, metas, geos, name='')
Report is a helper class for organizing and analysing data
Analyzing Results
When you've retrieved your results from either emulation
or hardware you can generate a .report()
:
report = results.report()
For the examples below we analyze the results of a two atom program.
The report contains useful information such as:
The raw bitstrings measured per each execution of the program
>>> report.bitstrings()
[array([[1, 1],
[1, 1],
[1, 1],
...,
[1, 1],
[1, 1],
The number of times each unique bitstring occurred:
>>> report.counts()
[OrderedDict([('11', 892), ('10', 59), ('01', 49)])]
The Rydberg Density for each atom
>>> report.rydberg_densities()
0 1
task_number
0 0.053 0.054
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/base.py
234 235 236 237 238 239 240 |
|
markdown
property
markdown: str
Get the markdown representation of the dataframe
bitstrings
bitstrings(
filter_perfect_filling: bool = True,
clusters: Union[
tuple[int, int], List[tuple[int, int]]
] = [],
) -> List[NDArray]
Get the bitstrings from the data.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_perfect_filling
|
bool
|
whether return will only contain perfect filling shots. Defaults to True. |
True
|
clusters
|
Union[tuple[int, int], List[tuple[int, int]]]
|
(tuple[int, int], Sequence[Tuple[int, int]]): cluster index to filter shots from. If none are provided all clusters are used, defaults to []. |
[]
|
Returns:
Name | Type | Description |
---|---|---|
bitstrings |
list of ndarray
|
list corresponding to each task in the report. Each element is an ndarray of shape (nshots, nsites) where nshots is the number of shots for the task and nsites is the number of sites in the task. For example:
|
Note
Note that nshots may vary between tasks if filter_perfect_filling is set to True.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/base.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 |
|
counts
counts(
filter_perfect_filling: bool = True,
clusters: Union[
tuple[int, int], List[tuple[int, int]]
] = [],
) -> List[OrderedDict[str, int]]
Get the counts of unique bit strings.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_perfect_filling
|
bool
|
whether return will only contain perfect filling shots. Defaults to True. |
True
|
clusters
|
Union[tuple[int, int], List[tuple[int, int]]]
|
(tuple[int, int], Sequence[Tuple[int, int]]): cluster index to filter shots from. If none are provided all clusters are used, defaults to []. |
[]
|
Returns:
Name | Type | Description |
---|---|---|
counts |
list of OrderedDict[str, int]
|
list corresponding to each task in the report. Each element is an ndarray of shape (nshots, nsites) where nshots is the number of shots for the task and nsites is the number of sites in the task. For example:
|
Note
Note that nshots may vary between tasks if filter_perfect_filling is set to True.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/base.py
349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 |
|
list_param
list_param(field_name: str) -> List[Union[Number, None]]
List the parameters associate with the given variable field_name for each tasks.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
field_name
|
str
|
variable name |
required |
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/base.py
242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 |
|
rydberg_densities
rydberg_densities(
filter_perfect_filling: bool = True,
clusters: Union[
tuple[int, int], List[tuple[int, int]]
] = [],
) -> Union[pd.Series, pd.DataFrame]
Get rydberg density for each task.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
filter_perfect_filling
|
bool
|
whether return will only contain perfect filling shots. Defaults to True. |
True
|
clusters
|
Union[tuple[int, int], List[tuple[int, int]]]
|
(tuple[int, int], Sequence[Tuple[int, int]]): cluster index to filter shots from. If none are provided all clusters are used, defaults to []. |
[]
|
Returns:
Name | Type | Description |
---|---|---|
rydberg_densities |
Union[Series, DataFrame]
|
per-site rydberg density for each task as a pandas DataFrame or Series. For example:
|
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/base.py
395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 |
|
show
show()
Interactive Visualization of the Report
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/base.py
426 427 428 429 430 431 |
|
batch
Filter
filter_metadata
filter_metadata(
__match_any__: bool = False,
**metadata: MetadataFilterType
) -> Union[LocalBatch, RemoteBatch]
Create a Batch object that has tasks filtered based on the values of metadata.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
__match_any__
|
bool
|
if True, then a task will be included if it matches any of the metadata filters. If False, then a task will be included only if it matches all of the metadata filters. Defaults to False. |
False
|
**metadata
|
MetadataFilterType
|
the metadata to filter on. The keys are the metadata names and the values (as a set) are the values to filter on. The elements in the set can be Real, Decimal, Tuple[Real], or Tuple[Decimal]. |
{}
|
Return
type(self): a Batch object with the filtered tasks, either LocalBatch or RemoteBatch depending on the type of self
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 |
|
LocalBatch
dataclass
LocalBatch(
source: Optional[Builder],
tasks: OrderedDict[
int, Union[BraketEmulatorTask, BloqadeTask]
],
name: Optional[str] = None,
)
Bases: Serializable
, Filter
report
report() -> Report
Generate analysis report base on currently completed tasks in the LocalBatch.
Return
Report
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 |
|
rerun
rerun(
multiprocessing: bool = False,
num_workers: Optional[int] = None,
**kwargs
)
Rerun all the tasks in the LocalBatch.
Return
Report
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 |
|
RemoteBatch
dataclass
RemoteBatch(
source: Builder,
tasks: Union[
OrderedDict[int, QuEraTask],
OrderedDict[int, BraketTask],
OrderedDict[int, CustomRemoteTaskABC],
],
name: Optional[str] = None,
)
Bases: Serializable
, Filter
total_nshots
property
total_nshots
Total number of shots of all tasks in the RemoteBatch
Return
number of shots
cancel
cancel() -> RemoteBatch
Cancel all the tasks in the Batch.
Return
self
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
360 361 362 363 364 365 366 367 368 369 370 371 372 |
|
fetch
fetch() -> RemoteBatch
Fetch the tasks in the Batch.
Note
Fetching will update the status of tasks, and only pull the results for those tasks that have completed.
Return
self
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 |
|
get_completed_tasks
get_completed_tasks() -> RemoteBatch
Create a RemoteBatch object that contain completed tasks from current Batch.
Tasks consider completed with following status codes:
- Completed
- Partial
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 |
|
get_failed_tasks
get_failed_tasks() -> RemoteBatch
Create a RemoteBatch object that contain failed tasks from current Batch.
failed tasks with following status codes:
- Failed
- Unaccepted
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 |
|
get_finished_tasks
get_finished_tasks() -> RemoteBatch
Create a RemoteBatch object that contain finished tasks from current Batch.
Tasks consider finished with following status codes:
- Failed
- Unaccepted
- Completed
- Partial
- Cancelled
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 |
|
get_tasks
get_tasks(*status_codes: str) -> RemoteBatch
Get Tasks with specify status_codes.
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 |
|
pull
pull() -> RemoteBatch
Pull results of the tasks in the Batch.
Note
Pulling will pull the results for the tasks. If a given task(s) has not been completed, wait until it finished.
Return
self
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
|
remove_failed_tasks
remove_failed_tasks() -> RemoteBatch
Create a RemoteBatch object that contain tasks from current Batch, with failed tasks removed.
failed tasks with following status codes:
- Failed
- Unaccepted
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 |
|
remove_invalid_tasks
remove_invalid_tasks() -> RemoteBatch
Create a RemoteBatch object that contain tasks from current Batch, with all Unaccepted tasks removed.
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
461 462 463 464 465 466 467 468 469 470 471 |
|
remove_tasks
remove_tasks(
*status_codes: Literal[
"Created",
"Running",
"Completed",
"Failed",
"Cancelled",
"Executing",
"Enqueued",
"Accepted",
"Unaccepted",
"Partial",
"Unsubmitted",
]
) -> RemoteBatch
Remove Tasks with specify status_codes.
Return
RemoteBatch
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 |
|
report
report() -> Report
Generate analysis report base on currently completed tasks in the RemoteBatch.
Return
Report
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 |
|
resubmit
resubmit(shuffle_submit_order: bool = True) -> RemoteBatch
Resubmit all the tasks in the RemoteBatch
Return
self
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
475 476 477 478 479 480 481 482 483 484 485 486 |
|
retrieve
retrieve() -> RemoteBatch
Retrieve missing task results.
Note
Retrieve will update the status of tasks, and only pull the results for those tasks that have completed.
Return
self
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 |
|
tasks_metric
tasks_metric() -> pd.DataFrame
Get current tasks status metric
Return
dataframe with ["task id", "status", "shots"]
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 |
|
Serializable
json
json(**options) -> str
Serialize the object to JSON string.
Return
JSON string
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/batch.py
37 38 39 40 41 42 43 44 45 46 47 |
|
exclusive
ExclusiveRemoteTask
dataclass
ExclusiveRemoteTask(
_task_ir: QuEraTaskSpecification | None,
_metadata: Dict[str, ParamType],
_parallel_decoder: ParallelDecoder | None,
_http_handler: HTTPHandlerABC = HTTPHandler(),
_task_id: str | None = None,
_task_result_ir: QuEraTaskResults | None = None,
)
Bases: CustomRemoteTaskABC
pull
pull(poll_interval: float = 20)
Blocking pull to get the task result. poll_interval is the time interval to poll the task status. Please ensure that it is relatively large, otherwise the server could get overloaded with queries.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/exclusive.py
249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 |
|
HTTPHandler
HTTPHandler(
zapier_webhook_url: str = None,
zapier_webhook_key: str = None,
vercel_api_url: str = None,
)
Bases: HTTPHandlerABC
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/exclusive.py
76 77 78 79 80 81 82 83 84 |
|
fetch_results
fetch_results(task_id: str)
Fetch the task results from the AirTable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
str
|
The task id to be queried. |
required |
returns response: The response from the AirTable. used for error handling
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/exclusive.py
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
|
query_task_status
query_task_status(task_id: str)
Query the task status from the AirTable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
str
|
The task id to be queried. |
required |
returns response: The response from the AirTable. used for error handling
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/exclusive.py
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 |
|
submit_task_via_zapier
submit_task_via_zapier(
task_ir: QuEraTaskSpecification,
task_id: str,
task_note: str,
)
Submit a task and add task_id to the task fields for querying later.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_ir
|
QuEraTaskSpecification
|
The task to be submitted. |
required |
task_id
|
str
|
The task id to be added to the task fields. |
required |
returns response: The response from the Zapier webhook. used for error handling
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/exclusive.py
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
|
HTTPHandlerABC
fetch_results
abstractmethod
fetch_results(task_id: str)
Fetch the task results from the AirTable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
str
|
The task id to be queried. |
required |
returns response: The response from the AirTable. used for error handling
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/exclusive.py
50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
query_task_status
abstractmethod
query_task_status(task_id: str)
Query the task status from the AirTable.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_id
|
str
|
The task id to be queried. |
required |
returns response: The response from the AirTable. used for error handling
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/exclusive.py
37 38 39 40 41 42 43 44 45 46 47 48 |
|
submit_task_via_zapier
abstractmethod
submit_task_via_zapier(
task_ir: QuEraTaskSpecification, task_id: str
)
Submit a task and add task_id to the task fields for querying later.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
task_ir
|
QuEraTaskSpecification
|
The task to be submitted. |
required |
task_id
|
str
|
The task id to be added to the task fields. |
required |
returns response: The response from the Zapier webhook. used for error handling
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/task/exclusive.py
23 24 25 26 27 28 29 30 31 32 33 34 35 |
|
visualization
display
atom_arrangement_figure
atom_arrangement_figure(atom_arrangement, assignments)
show the register.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/visualization/display.py
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 |
|
report_visualize
plot_register_bits
plot_register_bits(geo)
obtain a figure object from the atom arrangement.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/visualization/report_visualize.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
|
plot_register_ryd_dense
plot_register_ryd_dense(geo, ryds)
obtain a figure object from the atom arrangement.
Source code in .venv/lib/python3.12/site-packages/bloqade/analog/visualization/report_visualize.py
159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 |
|