2D State Preparation
Download Script · Download Job
This notebook was executed using the upstream saved emulator and hardware results. No Aquila jobs were submitted during this website build.
Introduction
In this example we show how to create the Striated Phase on a 2D chain of atoms.
You might notice that the tools we need to import are a lot shorter than prior instances. This is because we’re taking advantage of bloqade Python’s built-in visualization capabilities instead of crafting a new plot with matplotlib.
import os
from bokeh.io import output_notebookfrom bloqade.analog import load, savefrom bloqade.analog.atom_arrangement import Square
if not os.path.isdir("data"): os.mkdir("data")
# This tells Bokeh to display output in the notebook# versus opening a browser windowoutput_notebook()Program Definition
We define a program where our geometry is a square lattice of 3x3 atoms. Notice that unlike the 1D Z2 state preparation example the detuning now ramps to a higher value and the atoms are closer together.
# Have atoms separated by 5.9 micrometersL = 3lattice_spacing = 5.9
rabi_amplitude_values = [0.0, 15.8, 15.8, 0.0]rabi_detuning_values = [-16.33, -16.33, "delta_end", "delta_end"]durations = [0.8, "sweep_time", 0.8]
prog = ( Square(L, lattice_spacing=lattice_spacing) .rydberg.rabi.amplitude.uniform.piecewise_linear(durations, rabi_amplitude_values) .detuning.uniform.piecewise_linear(durations, rabi_detuning_values))
batch = prog.assign(delta_end=42.66, sweep_time=2.4)Submitting to Emulator and Hardware
Just as in prior examples, we submit our program to both hardware and the emulator and save the intermediate data in files for convenient fetching when the results are ready from hardware, as well as avoiding having to repeat emulation runs for the purposes of analysis.
Considering how small a 3 x 3 lattice of atoms is relative to machine capabilities, we also take advantage of parallelization to duplicate the geometry and get more data per shot when submitting to Hardware.
emu_filename = os.path.join( os.path.abspath(""), "data", "striated-phase-emulation.json")if not os.path.isfile(emu_filename): emu_future = batch.braket.local_emulator().run(shots=10000) save(emu_future, emu_filename)
hw_filename = os.path.join(os.path.abspath(""), "data", "striated-phase-hardware.json")if not os.path.isfile(hw_filename): future = batch.parallelize(24).braket.aquila().run_async(shots=100) save(future, hw_filename)Extracting Results
We can reload our files to get results:
# retrieve results from emulator and HWemu_batch = load(emu_filename)hardware_batch = load(hw_filename)
# Uncomment lines below to fetch results from Braket# hardware_batch = hardware_batch.fetch()# save(hardware_batch, filename)Visualizing Results With Ease
In prior examples we’ve leverage Bloqade’s ability to automatically put hardware and emulation results into the formats we need to make analysis easier.
Now we’ll go one step further by letting Bloqade Python do the visualization for us. In this case we’ll visualize the Rydberg Densities of our system overlaid on the original geometry with just the following:
emu_batch.report().show()0.0 11.8 0.0 11.8Just as before, we let Bloqade generate a report which contains all the results in
easy to digest format but we invoke the .show() method of our report which us
easily get an idea of the results of our experiment with interactive plots.
The plot that mos interests us is the one on the right under the “Rydberg Density” section.
hardware_batch.report().show()0.0 47.6 0.0 47.6Considering Bloqade’s goal of a uniform visualization pipeline, we can get the same ability for results from hardware. Note that we can confirm the program does what it’s supposed to as results from emulation agree with those from hardware quite well.