Examples
Every example ships in the package repository under pkg/niobium/examples/ and runs
against any platform deployment with an API key:
QUBITRA_API_KEY=qpk_... python examples/submit_bell_pair.pyQUBITRA_API_URL selects the deployment. Every example defaults to one of the platform’s
own simulators — sim-statevector-26q, or sim-openqarp-26 for the OpenQARP portfolio
example — so every example runs on a free backend. The framework examples need their extra installed —
pip install 'qubitra-sdk[qiskit]' and so on — while the core examples run on the base
install.
Each example teaches one thing, ends with output that is checkable at a glance, and exits non-zero on a wrong result — so each doubles as a live smoke test of a deployment.
Each example has a walkthrough page: the problem it addresses, its code section by section, and the output of a live run.
At a glance
Section titled “At a glance”| Example | The problem it addresses |
|---|---|
list_backends.py |
What can I run on, and what does each backend accept? |
submit_bell_pair.py |
Submit a first circuit and read counts back |
submit_ionq_circuit.py |
Submit a circuit in a provider’s JSON format |
estimate_expectation.py |
Measure an observable’s expectation value |
parameter_sweep.py |
Evaluate one circuit at many parameter values, as one job |
qiskit_transpile_and_run.py |
Run existing Qiskit code — provider, transpiler, primitives |
cirq_sampler.py |
Run existing Cirq code through cirq.work.Sampler |
pennylane_expval.py |
Run a PennyLane device, including a gradient step |
pde_poisson_vqls.py |
Solve a discretised PDE — a full variational application |
openqarp_vqe.py |
Find a ground state with an OpenQARP VQE |
openqarp_portfolio.py |
Diversify a portfolio with QAOA and PCE, and size the run first |