Skip to content

Commit 85f8c30

Browse files
committed
running linter
1 parent b245128 commit 85f8c30

File tree

175 files changed

+1082
-953
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

175 files changed

+1082
-953
lines changed

docs/home/background.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ For a more nuanced and in-depth read about the neutral atoms that Bloqade and *A
1010

1111
## Analog vs Digital Quantum Computing
1212

13-
There are two modes of quantum computation that [neutral atoms](#neutral-atom-qubits) are capable of: [*Analog*](#analog-mode) and [*Digital*](#digital-mode).
13+
There are two modes of quantum computation that [neutral atoms](#neutral-atom-qubits) are capable of: [*Analog*](#analog-mode) and [*Digital*](#digital-mode).
1414

1515
You can find a brief explanation of the distinction below but for a more in-depth explanation you can refer to QuEra's qBook section on [Analog vs Digital Quantum Computing](https://qbook.quera.com/learn/?course=6630211af30e7d0013c66147&file=6630211af30e7d0013c6614a)
1616

@@ -46,11 +46,11 @@ The [Rydberg Many-Body Hamiltonian](#rydberg-many-body-hamiltonian) already impl
4646
They are a sum of one or more *spatial modulations*, which allows you to *scale* the amplitude of the waveform across the different sites in the system:
4747

4848
$$
49-
F_{i}(t) = \sum_{\alpha} C_{i}^{\alpha}f_{\alpha}(t)
49+
F_{i}(t) = \sum_{\alpha} C_{i}^{\alpha}f_{\alpha}(t)
5050
$$
5151

5252
$$
53-
C_{i}^{\alpha} \in \mathbb{R}
53+
C_{i}^{\alpha} \in \mathbb{R}
5454
$$
5555

5656
$$
@@ -64,6 +64,5 @@ Note that the drive is only applied if the $i$-th site is filled with an atom.
6464
You build fields in Bloqade by first specifying the spatial modulation followed by the waveform
6565
it should be multiplied by.
6666

67-
In the case of a *uniform* spatial modulation, it can be interpreted as
67+
In the case of a *uniform* spatial modulation, it can be interpreted as
6868
a constant scaling factor where $C_{i}^{\alpha} = 1.0$.
69-

docs/home/emulation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Emulation
22

3-
This page is a work in progress!
3+
This page is a work in progress!

docs/home/geometry.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Geometry
22

3-
This page is a work in progress!
3+
This page is a work in progress!

docs/home/quick_start.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Quick Start
22

3-
All the sections below are self-contained, you can click on the links in the Table of Contents to read the relevant parts.
3+
All the sections below are self-contained, you can click on the links in the Table of Contents to read the relevant parts.
44

55
## Navigating the Bloqade API
66

@@ -18,7 +18,7 @@ The same goes for [JetBrains PyCharm](https://www.jetbrains.com/pycharm/):
1818

1919
![PyCharm Hints](../assets/quick_start/pycharm-hints.gif)
2020

21-
### Jupyter Notebook
21+
### Jupyter Notebook
2222

2323
In a [Jupyter Notebook](https://jupyter.org/) you'll need to type `.` and then hit tab for the hints to appear:
2424

@@ -85,7 +85,7 @@ After you've [defined a geometry](#defining-atom-geometry) you:
8585
* Specify `detuning`, `rabi.amplitude` or `rabi.phase`
8686
* Specify the [spatial modulation][local-control]
8787

88-
Which then leads you to the ability to specify a waveform of interest and begin constructing your pulse sequence.
88+
Which then leads you to the ability to specify a waveform of interest and begin constructing your pulse sequence.
8989
In the example below, we target the ground-Rydberg level coupling to drive with uniform [spatial modulation][local-control] for the Rabi amplitude. Our waveform is a piecewise linear one which ramps from $0$ to $5 \,\text{rad/us}$, holds that value for $1 \,\text{us}$ and then ramps back down to $0 \,\text{rad/us}$.
9090

9191
```python
@@ -120,7 +120,7 @@ from math import sin
120120
geometry = start.add_position((0,0))
121121
target_rabi_amplitude = geometry.rydberg.rabi.amplitude.uniform
122122

123-
def custom_waveform(t):
123+
def custom_waveform(t):
124124
return 2.0 * sin(t)
125125

126126
custom_waveform_applied = (
@@ -129,7 +129,7 @@ custom_waveform_applied = (
129129
)
130130
```
131131

132-
In this form you can immediately [emulate](#emulation) it if you'd like but to run this on [hardware](#submitting-to-hardware) you need to discretize it. The waveform on hardware has to either be:
132+
In this form you can immediately [emulate](#emulation) it if you'd like but to run this on [hardware](#submitting-to-hardware) you need to discretize it. The waveform on hardware has to either be:
133133

134134
* Piecewise linear for Rabi amplitude and detuning terms of the Hamiltonian
135135
* Piecewise constant for the Phase term of the Hamiltonian
@@ -146,7 +146,7 @@ custom_discretized_waveform_applied = (
146146

147147
!!! note
148148

149-
Programs that have custom functions as waveforms are not fully serializable. This means that when you are [saving and reloading results](#saving-and-loading-results), the original embedded program will be missing that custom waveform. You will still be able to analyze the saved results!
149+
Programs that have custom functions as waveforms are not fully serializable. This means that when you are [saving and reloading results](#saving-and-loading-results), the original embedded program will be missing that custom waveform. You will still be able to analyze the saved results!
150150

151151

152152
## Slicing and Recording Waveforms
@@ -173,7 +173,7 @@ vars_assigned_program = sliced_program.batch_assign(run_time=run_times)
173173

174174
This program will run fine in [emulation](#emulation) but due to hardware constraints certain waveforms (such as those targeting the Rabi Amplitude), the waveform needs to start and end at $0 \,\text{rad}/\text{us}$. Thus, there needs to be a way to slice our waveform but also add an end component to that waveform. `.record` in Bloqade lets you literally "record" the value at the end of a `.slice` and then use it to construct further parts of the waveform.
175175

176-
In the program below the waveform is still sliced but with the help of `.record` a linear segment that pulls the waveform down to $0.0 \,\text{rad}/\text{us}$ from whatever its current value at the slice is in $0.7 \,\text{us}$ is added.
176+
In the program below the waveform is still sliced but with the help of `.record` a linear segment that pulls the waveform down to $0.0 \,\text{rad}/\text{us}$ from whatever its current value at the slice is in $0.7 \,\text{us}$ is added.
177177

178178
```python
179179
from bloqade import start
@@ -219,7 +219,7 @@ pulse_sequence.show()
219219
And when you're content with it you just `.apply()` it on the geometries of your choice:
220220

221221
```python
222-
from bloqade.atom_arrangement import Honeycomb, Kagome
222+
from bloqade.atom_arrangement import Honeycomb, Kagome
223223

224224
geometry_1 = Honeycomb(2, lattice_spacing = 6.0)
225225
geometry_2 = Kagome(2, lattice_spacing = 6.0)
@@ -318,7 +318,7 @@ report.rydberg_densities()
318318
```
319319
```
320320
0 1
321-
task_number
321+
task_number
322322
0 0.053 0.054
323323
```
324324

@@ -334,7 +334,7 @@ report.show()
334334

335335
## Parameter Sweeps
336336

337-
You can easily do parameter sweeps in emulation and on *Aquila* with variables. Bloqade automatically detects strings in your program as variables that you can later assign singular or multiple values to.
337+
You can easily do parameter sweeps in emulation and on *Aquila* with variables. Bloqade automatically detects strings in your program as variables that you can later assign singular or multiple values to.
338338

339339
In the example below, we define a program with a singular variable that controls the amplitude of the waveform.
340340

@@ -344,7 +344,7 @@ from bloqade import start
344344
rabi_oscillations_program = (
345345
start.add_position((0, 0))
346346
.rydberg.rabi.amplitude.uniform.piecewise_linear(
347-
durations=[0.06, 3, 0.06],
347+
durations=[0.06, 3, 0.06],
348348
values=[0, "rabi_amplitude", "rabi_amplitude", 0]
349349
)
350350
)
@@ -374,7 +374,7 @@ delayed_assignment_program = rabi_oscillations_program.args(["rabi_amplitude"])
374374
results = delayed_assignment_program.bloqade.python().run(100, args=(1.0,))
375375
```
376376

377-
You can alternatively treat the program as a callable after using `.args()` (note the inverted order of arguments in the call!):
377+
You can alternatively treat the program as a callable after using `.args()` (note the inverted order of arguments in the call!):
378378

379379
```python
380380
delayed_assignment_program = rabi_oscillations_program.args(["rabi_amplitude"])
@@ -400,18 +400,18 @@ geometry = start.add_position((0,0))
400400
target_rabi_amplitude = geometry.rydberg.rabi.amplitude.uniform
401401
rabi_waveform = (
402402
target_rabi_amplitude
403-
.piecewise_linear(durations=waveform_durations,
403+
.piecewise_linear(durations=waveform_durations,
404404
values=[0.0, my_var, my_var, 0.0])
405405
)
406406
target_detuning = rabi_waveform.detuning.uniform
407407
detuning_waveform = (
408408
target_detuning
409-
.piecewise_linear(durations=waveform_durations,
409+
.piecewise_linear(durations=waveform_durations,
410410
values=[my_var-1.0, my_var*0.5, my_var/2, my_var+1.0 ])
411411
)
412412
```
413413

414-
You still perform variable assignment just like you normally would:
414+
You still perform variable assignment just like you normally would:
415415

416416
```python
417417
program = detuning_waveform.assign(my_variable=1.0)
@@ -428,7 +428,7 @@ geometry = start.add_position((0,0))
428428
target_rabi_amplitude = geometry.rydberg.rabi.amplitude.uniform
429429
rabi_waveform = (
430430
target_rabi_amplitude
431-
.piecewise_linear(durations=variable_durations,
431+
.piecewise_linear(durations=variable_durations,
432432
values=[0.0, 1.5, 1.5, 0.0])
433433
)
434434
target_detuning = rabi_waveform.detuning.uniform
@@ -456,8 +456,8 @@ your_program = ...
456456
emulation_results = your_program.bloqade.python().run(100)
457457
hardware_results = your_program.braket.aquila.run_async(100)
458458

459-
save(emulation_results, "emulation_results.json")
460-
save(hardware_results, "hardware_results.json")
459+
save(emulation_results, "emulation_results.json")
460+
save(hardware_results, "hardware_results.json")
461461
```
462462

463463
And later reload them into Python using the `load` function:
@@ -469,4 +469,4 @@ hardware_results = load("hardware_results.json")
469469
```
470470

471471
[local-control]: background.md#local-control
472-
[rydberg-hamiltonian]: background.md#rydberg-many-body-hamiltonian
472+
[rydberg-hamiltonian]: background.md#rydberg-many-body-hamiltonian

docs/home/submission.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Submission
22

3-
This page is a work in progress!
3+
This page is a work in progress!

docs/home/visualization.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Visualization
22

3-
This page is a work in progress!
3+
This page is a work in progress!

docs/home/waveforms.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Waveforms
22

3-
This page is a work in progress!
3+
This page is a work in progress!

docs/index.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ from bloqade.atom_arrangement import Honeycomb
3636
geometry = Honeycomb(2, lattice_spacing = 10.0)
3737
```
3838

39-
We can verify what the atom geometry looks like by `.show()`'ing it:
39+
We can verify what the atom geometry looks like by `.show()`'ing it:
4040

4141
```python
4242
geometry.show()
@@ -60,7 +60,7 @@ rabi_program = (
6060
)
6161
```
6262
<!--explain what uniform is-->
63-
Here `rabi.amplitude` means exactly what it is, the Rabi amplitude term of the [Hamiltonian][rydberg-hamiltonian]. `uniform` refers to applying the waveform uniformly across all the atom locations.
63+
Here `rabi.amplitude` means exactly what it is, the Rabi amplitude term of the [Hamiltonian][rydberg-hamiltonian]. `uniform` refers to applying the waveform uniformly across all the atom locations.
6464

6565
We can visualize what our program looks like again with `.show()`:
6666

@@ -88,7 +88,7 @@ Which gives us:
8888
[OrderedDict([('0', 55), ('1', 45)])]
8989
```
9090

91-
If we want to submit our program to hardware we'll need to adjust the waveform as there is a constraint the Rabi amplitude waveform must start and end at zero.
91+
If we want to submit our program to hardware we'll need to adjust the waveform as there is a constraint the Rabi amplitude waveform must start and end at zero.
9292
This is easy to do as we can build off the atom geometry we saved previously but apply a piecewise linear waveform:
9393

9494
```python
@@ -106,8 +106,8 @@ hardware_rabi_program.show()
106106
</picture>
107107
</div>
108108

109-
Now instead of using the built-in Bloqade emulator we submit the program to *Aquila*. You will need to use the [AWS CLI](https://aws.amazon.com/cli/) to obtain credentials from your AWS account
110-
or set the proper environment variables before hand.
109+
Now instead of using the built-in Bloqade emulator we submit the program to *Aquila*. You will need to use the [AWS CLI](https://aws.amazon.com/cli/) to obtain credentials from your AWS account
110+
or set the proper environment variables before hand.
111111

112112
```python
113113
hardware_results = hardware_rabi_program.braket.aquila.run_async(100)
@@ -133,7 +133,7 @@ rabi_program = (
133133
.rydberg.rabi.amplitude.uniform
134134
.constant(value=pi/2, duration=1.0)
135135
)
136-
emulation_results = rabi_program.bloqade.python().run(100)
136+
emulation_results = rabi_program.bloqade.python().run(100)
137137
bitstring_counts = emulation_results.report().counts()
138138

139139
hardware_rabi_program = (
@@ -151,7 +151,7 @@ hardware_bitstring_counts = hardware_results.report().counts()
151151
## Features
152152

153153

154-
### Customizable Atom Geometries
154+
### Customizable Atom Geometries
155155

156156
You can easily explore a number of common geometric lattices with Bloqade's `atom_arrangement`'s:
157157

@@ -256,7 +256,7 @@ hardware_results = rabi_oscillation_job.braket.aquila().run(100)
256256
```
257257
emulation_results.report().rydberg_densities()
258258
0
259-
task_number
259+
task_number
260260
0 0.16
261261
1 0.35
262262
2 0.59
@@ -303,4 +303,4 @@ Bloqade is released under the [Apache License, Version 2.0](https://github.com/Q
303303

304304
[rabi-oscillation-wiki]: https://en.wikipedia.org/wiki/Rabi_cycle
305305
[neutral-atom-qubits]: home/background.md#neutral-atom-qubits
306-
[rydberg-hamiltonian]: home/background.md#rydberg-many-body-hamiltonian
306+
[rydberg-hamiltonian]: home/background.md#rydberg-many-body-hamiltonian

docs/scripts/gen_ref_nav.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
import mkdocs_gen_files
66

7-
87
SRC_PATH = "src"
98

109
skip_keywords = [

src/bloqade/analog/__init__.py

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,27 @@
33
except ImportError:
44
__path__ = __import__("pkgutil").extend_path(__path__, __name__)
55

6-
from bloqade.analog.ir import var, cast, Variable, Literal, start
7-
from bloqade.analog.ir import to_waveform as waveform
8-
from bloqade.analog.serialize import load, save, loads, dumps
6+
import importlib.metadata
97

8+
import bloqade.analog.ir as _ir
9+
from bloqade.analog.ir import (
10+
Literal,
11+
Variable,
12+
var,
13+
cast,
14+
start,
15+
to_waveform as waveform,
16+
)
1017
from bloqade.analog.factory import (
11-
get_capabilities,
12-
piecewise_linear,
13-
piecewise_constant,
1418
linear,
1519
constant,
1620
rydberg_h,
21+
get_capabilities,
22+
piecewise_linear,
23+
piecewise_constant,
1724
)
18-
import bloqade.analog.ir as _ir
1925
from bloqade.analog.constants import RB_C6
20-
21-
import importlib.metadata
26+
from bloqade.analog.serialize import load, save, dumps, loads
2227

2328
__version__ = importlib.metadata.version("bloqade-analog")
2429

0 commit comments

Comments
 (0)