Learn how to use the Qiskit SDK to submit quantum circuits to IonQ’s simulators and quantum computers.
python --version
from your command line if you aren’t sure which version
you have running.IONQ_API_KEY
, so if you’ve already followed our guide on setting up and managing your API keys, Qiskit will automatically find it.
Alternatively, you can set an environment variable temporarily from your command line, by running:
IONQ_API_KEY
, or if you are working from a Python environment where accessing environment variables is not straightforward. You can import your key explicitly or load it from a file, and pass it into the IonQProvider()
object directly:
IonQProvider()
initialized with no arguments and assume that Qiskit will automatically find your API key, but you can always use this approach instead.
.get_counts()
method samples from this probability distribution, so we didn’t end up with exactly 5,000 counts for each state. You can use job.get_probabilities()
to see the calculated probabilities for a circuit that was run on the simulator.run()
function in a list instead:
noise_model
like: noise_model="aria-1"
. The available noise models are harmony
(legacy), aria-1
, aria-2
, and forte-1
. You can read more about these noise models here.
noise_model="aria-1"
to the simulator backend when submitting a job, in the simulator_backend.run()
function call. This will run the job with the specified noise model and will override the backend-level settings.
However, the behavior of job.get_counts()
still depends on the backend-level settings for the backend that created the job: if the backend was an ideal simulator, .get_counts()
will always sample from the result’s stored probability distribution and can generate slightly different counts every time it’s called. If the backend itself has an assigned noise model, as in this example, .get_counts()
will reproducibly retrieve the same counts that were actually recorded (the noisy simulator runs one simulation and stores one count for every shot). We recommend using backend-level noise model settings where possible.
ionq_qpu.aria-1
, ionq_qpu.aria-2
, ionq_qpu.forte-1
, or ionq_qpu.forte-enterprise-1
. You can view which of these systems you can access in the /v0.3/backends resource in the API and on the “Backends” tab of the IonQ Cloud Console.
job.get_counts()
is different depending on the type of backend (ideal simulator, or noisy simulator or QPU) used to retrieve the job. We recommend always retrieving a job with the same backend type and settings that were used to run the job. In particular, a job retrieved using an ideal simulator backend will get counts by sampling the stored distribution rather than reproducibly returning the counts that were actually recorded.