pyquil.qpu

Module for facilitating connections to the QPU.

exception pyquil.qpu.NoParametersFoundException

Bases: exceptions.Exception

class pyquil.qpu.QPUConnection(device_name='Device', **kwargs)

Bases: pyquil.api.JobConnection

bit_string_probabilities(quil_program)
expectation(prep_prog, operator_programs=[<pyquil.quil.Program object>])
get_info()

Gets information about what devices are currently available through the Forest API.

Returns:A JSON dictionary with configuration information.
Return type:dict
get_params(qcid, func)

Get and parse the configuration information from the Forest API.

Parameters:
  • qcid (int) – Unique identifier of the qubit in question
  • func – A function to apply to the qubit specific JSON dictionary of config info
Returns:

A dictionary with the parameter info

Return type:

dict

get_qubits()
Returns:A list of active qubit ids on this device.
Return type:list
get_rabi_params(qcid)

Gets the current Rabi experiment parameters for a specific qubit on a specific device.

Parameters:qcid (int) – Unique identifier of the qubit in question
Returns:A dictionary with the parameter info
Return type:dict
get_ramsey_params(qcid)

Gets the current Ramsey experiment parameters for a specific qubit on a specific device.

Parameters:qcid (int) – Unique identifier of the qubit in question
Returns:A dictionary with the parameter info
Return type:dict
get_t1_params(qcid)

Gets the current T1 experiment parameters for a specific qubit on a specific device.

Parameters:qcid (int) – Unique identifier of the qubit in question
Returns:A dictionary with the parameter info
Return type:dict
rabi(qubit_id)

Runs a Rabi experiment on the given qubit.

Parameters:qubit_id (int) – Unique identifier of the qubit in question
Returns:A RabiResult object
ramsey(qubit_id)

Runs a Ramsey experiment on the given qubit.

Parameters:qubit_id (int) – Unique identifier of the qubit in question
Returns:A RamseyResult object
run(quil_program, classical_addresses, trials=1)

Run a pyQuil program on the QPU. This functionality is in beta.

Parameters:
  • quil_program (Program) – Quil program to run on the QPU
  • classical_addresses (list) – Currently unused
  • trials (int) – Number of shots to take
Returns:

A job result

Return type:

JobResult

run_and_measure(quil_program, qubits, trials=1)

Run a pyQuil program on the QPU multiple times, measuring all the qubits in the QPU simultaneously at the end of the program each time. This functionality is in beta.

Parameters:
  • quil_program (Program) – Quil program to run on the QPU
  • qubits (list) – The list of qubits to return results for
  • trials (int) – Number of shots to take
Returns:

A job result

Return type:

JobResult

t1(qubit_id)

Runs a T1 experiment on the given qubit.

Parameters:qubit_id (int) – Unique identifier of the qubit in question
Returns:A T1Result object
wavefunction(quil_program, classical_addresses=[])