"Hello, World!" - OqtAPI¶
This notebook runs on Oqtant hardware and uses 2 jobs
Welcome to the Oqtant Python API
, aka OqtAPI
! OqtAPI is an object-oriented interface for creating, submitting, and retrieving results from experiments with ultracold quantum matter on Infleqtion's Oqtant Quantum Matter Services (QMS) platform. In this example notebook, we will use Oqtant to make real quantum matter: a Bose-Einstein condensate (BEC) of rubidium-87 atoms. We will manipulate the quantum matter with a (user designed) optical potential and observe the result.
OqtAPI includes in-depth, walkthrough-style jupyter notebooks to introduce the powerful capabilities of OqtAPI and Oqtant.
For more install instructions, please refer to our Quick Start Guide.
See our web application https://oqtant.infleqtion.com/ for quick access to job creation, results, and account management.
Visit our support page for FAQs, contact information, and to share feedback and report bugs: https://oqtant.infleqtion.com/support
All our example notebooks are publicly available on our GitLab repository.
This example notebook is a small sample of OqtAPI and Oqtant capabilities. Walkthroughs will explore how to use OqtAPI, user options, accessible abstractions, and data structures in more detail.
Imports and user authentication¶
from oqtant.schemas.quantum_matter import QuantumMatterFactory
qmf = QuantumMatterFactory()
Authenticate automatically¶
The easiest way to authenticate as an Oqtant user is to execute the following cell. This will activate a widget that will let you sign in, assuming you already have a verified account at oqtant.infleqtion.com. If popups are blocked, or you are on a system that does not support this method, please follow the steps just below to authenticate manually instead.
Note that currently the automatic authentication method is only compatible with classic jupyter notebooks, and not jupyter lab, nanohub, binder, colab, etc.
qmf.get_login()
Authenticate manually¶
If you cannot use the automatic authentication method above, you can instead authenticate using a slightly more manual process:
- Navigate to oqtant.infleqtion.com and create an account (if you haven't already)
- Log in, if this is your first time you will need to activate your account with the verification email
- On the left-hand menu selector, click on "Oqtant API" (or go to oqtant.infleqtion.com/oqtantAPI)
- At the bottom of that page, click the box that copies your API access token to the clipboard
- Paste that token just below and execute the cell (the if statement keeps the code from executing if you already authenticated above)
if qmf.login.access_token == "":
qmf.login.access_token = "Paste your token here between the quotes!"
Get client¶
At this point you should have a valid access token and be able to establish a client for communicating with the Oqtant REST service. Executing the cell just below should show your current job quota limits.
qmf.get_client()
Make Quantum Matter¶
The first type of job we will run is a BEC Generator, which allows users to experiment with the quantity of atoms that arrive in the quantum state (the BEC) as the ensemble is cooled.
1. Create a QuantumMatter object¶
matter = qmf.create_quantum_matter(temperature=100, name="Hello, quantum world!")
2. Submit it to Oqtant QMS¶
matter.submit(track=True)
Submitting 1 job(s): - Job: Hello, quantum world! Job ID: 7b5918bc-de99-47ea-99ab-64869e236a59 Tracking 1 job(s):
3. Fetch the results¶
matter.get_result()
matter.status
'COMPLETE'
4. View and/or analyze the results (in this case, "just" view the quantum wavefunction)¶
matter.output.plot_tof(figsize=(6, 6))
matter.output.plot_slice(axis="x")
Manipulate with "painted" light¶
OqtAPI also allows users to manipulate the BEC using repulsive optical potential barriers. Barrier manipulation occurs after the cooling process is complete. Barrier manipulation is the starting point for atomtronics, sensors, and more!
1. Create a dynamic "Barrier"¶
barrier = qmf.create_barrier(
positions=[10, 0],
heights=[20, 25],
widths=[2, 1],
times=[0, 2.5],
shape="GAUSSIAN",
)
# add dynamics with a scripting style
barrier.evolve(duration=2.5, height=5)
barrier.show_dynamics()
barrier.show_potential(times=[2.0, 3.0, 4.0, 5.0], xlimits=[-10, 25], ylimits=[-2, 30])
2. Make and manipulate QuantumMatter¶
import numpy as np
matter = qmf.create_quantum_matter(
temperature=100,
image="IN_TRAP", # option to view atom ensemble while in trap
barriers=[barrier],
lifetime=8,
name="Now with barriers!",
)
matter.show_potential(times=[2.0, 3.0, 4.0, 5.0])
3. Submit it to Oqtant QMS¶
matter.submit(track=True)
Submitting 1 job(s): - Job: Now with barriers! Job ID: ac4243a6-ac3f-4129-90e7-f3e0c8ec56ed Tracking 1 job(s): - Job: Now with barriers! - RUNNING - COMPLETE All job(s) complete
4. Fetch the results¶
matter.get_result()
matter.status
'COMPLETE'
5. View and/or analyze results¶
matter.output.plot_it()