quchip.interop.scqubits.devices

Shipped scqubits <-> quchip device mappings.

Each ModelMapping here transcribes one scqubits circuit-QED object into the quchip device that carries the same spectrum. Where the inversion is well-defined, the mapping also goes back. Import reads the source object’s native parameters and passes them to the matching quchip constructor. The constructor rebuilds the Hamiltonian from those parameters, so the imported device stays differentiable in them. Export reads the concrete device parameters, guards each against JAX tracers via maybe_concrete_scalar(), and reconstructs the scqubits object.

Each mapping’s docstring states its parameter translation and serves as a reference example for new mappings. scqubits stores energies in its global unit, scqubits.get_units() (GHz by default). Every energy is converted between that unit and quchip’s GHz at this boundary.

Classes

DuffingTransmonMapping()

Map DuffingTransmon to scqubits.Transmon (export-only).

FluxoniumMapping()

Map scqubits.Fluxonium to and from Fluxonium.

GenericQubitMapping()

Map scqubits.GenericQubit to DuffingTransmon (import-only).

KerrOscillatorMapping()

Map scqubits.KerrOscillator to KerrCavity (import-only).

OscillatorMapping()

Map scqubits.Oscillator to and from Resonator.

TransmonMapping()

Map scqubits.Transmon to and from ChargeBasisTransmon.

TunableTransmonMapping()

Map scqubits.TunableTransmon to ChargeBasisTransmon (import-only).

ZeroPiMapping()

Map scqubits.ZeroPi to EigenbasisDevice (import-only).

class quchip.interop.scqubits.devices.TransmonMapping[source]

Bases: ModelMapping

Map scqubits.Transmon to and from ChargeBasisTransmon.

Both sides diagonalize the Cooper-pair-box Hamiltonian \(H = 4 E_C (\hat n - n_g)^2 - E_J \cos\hat\varphi\) in the integer charge basis, so the translation is a direct parameter copy:

scqubits

quchip

EC

E_C

EJ

E_J

ng

n_g

ncut

num_basis = 2*ncut + 1

truncated_dim

levels

source: ClassVar[str | None] = 'scqubits.Transmon'
target

alias of ChargeBasisTransmon

import_model(obj, *, levels=None, label=None, **noise_kwargs)[source]

Convert third-party object obj into a quchip device.

Override to support import. The base implementation raises NotImplementedError.

Parameters:
  • obj (object) – Third-party instance to convert.

  • **opts – Mapping-specific keyword options. Subclasses must document supported keys.

Returns:

Converted quchip model, as defined by the subclass.

Return type:

object

export_model(device, **opts)[source]

Convert quchip device into a third-party object.

Override to support export, and also set target. The base implementation raises NotImplementedError.

Parameters:
  • device (object) – quchip device to convert.

  • **opts (Any) – Mapping-specific keyword options. Subclasses must document supported keys.

Returns:

Converted third-party model, as defined by the subclass.

Return type:

object

library: ClassVar[str | None] = 'scqubits'
class quchip.interop.scqubits.devices.TunableTransmonMapping[source]

Bases: ModelMapping

Map scqubits.TunableTransmon to ChargeBasisTransmon (import-only).

The flux-tunable SQUID transmon has a flux-dependent effective Josephson energy

\[E_J(\Phi) = E_J^{\max} \sqrt{\cos^2(\pi\Phi) + d^2 \sin^2(\pi\Phi)},\]

with d the junction asymmetry. Import evaluates \(E_J(\Phi)\) at the object’s flux and passes the resulting fixed-frequency transmon to ChargeBasisTransmon. The other parameters copy across exactly as in TransmonMapping. There is no export, because a single frequency does not set (EJmax, d, flux).

source: ClassVar[str | None] = 'scqubits.TunableTransmon'
target: ClassVar[type | None] = None
import_model(obj, *, levels=None, label=None, **noise_kwargs)[source]

Convert third-party object obj into a quchip device.

Override to support import. The base implementation raises NotImplementedError.

Parameters:
  • obj (object) – Third-party instance to convert.

  • **opts – Mapping-specific keyword options. Subclasses must document supported keys.

Returns:

Converted quchip model, as defined by the subclass.

Return type:

object

library: ClassVar[str | None] = 'scqubits'
class quchip.interop.scqubits.devices.FluxoniumMapping[source]

Bases: ModelMapping

Map scqubits.Fluxonium to and from Fluxonium.

Parameter copy across the three circuit energies and the external flux:

scqubits

quchip

EC

E_C

EJ

E_J

EL

E_L

flux

phi_ext

truncated_dim

levels

The native discretizations differ: scqubits uses a harmonic-oscillator basis of size cutoff, whereas quchip uses a finite-difference phase grid of num_basis points. Therefore quchip keeps its own default grid and does not mirror cutoff. Both represent the fluxonium Hamiltonian, but check each discretization’s convergence for the selected parameters. Export uses the scqubits default cutoff=110.

source: ClassVar[str | None] = 'scqubits.Fluxonium'
target

alias of Fluxonium

import_model(obj, *, levels=None, label=None, **noise_kwargs)[source]

Convert third-party object obj into a quchip device.

Override to support import. The base implementation raises NotImplementedError.

Parameters:
  • obj (object) – Third-party instance to convert.

  • **opts – Mapping-specific keyword options. Subclasses must document supported keys.

Returns:

Converted quchip model, as defined by the subclass.

Return type:

object

export_model(device, **opts)[source]

Convert quchip device into a third-party object.

Override to support export, and also set target. The base implementation raises NotImplementedError.

Parameters:
  • device (object) – quchip device to convert.

  • **opts (Any) – Mapping-specific keyword options. Subclasses must document supported keys.

Returns:

Converted third-party model, as defined by the subclass.

Return type:

object

library: ClassVar[str | None] = 'scqubits'
class quchip.interop.scqubits.devices.OscillatorMapping[source]

Bases: ModelMapping

Map scqubits.Oscillator to and from Resonator.

A harmonic oscillator \(H = E_{\rm osc}\, a^\dagger a\) maps to the resonator \(H = \omega\, \hat n\) with freq = E_osc and levels = truncated_dim. The scqubits l_osc (an operator-definition convention) has no spectral effect and is dropped.

source: ClassVar[str | None] = 'scqubits.Oscillator'
target

alias of Resonator

import_model(obj, *, levels=None, label=None, **noise_kwargs)[source]

Convert third-party object obj into a quchip device.

Override to support import. The base implementation raises NotImplementedError.

Parameters:
  • obj (object) – Third-party instance to convert.

  • **opts – Mapping-specific keyword options. Subclasses must document supported keys.

Returns:

Converted quchip model, as defined by the subclass.

Return type:

object

export_model(device, **opts)[source]

Convert quchip device into a third-party object.

Override to support export, and also set target. The base implementation raises NotImplementedError.

Parameters:
  • device (object) – quchip device to convert.

  • **opts (Any) – Mapping-specific keyword options. Subclasses must document supported keys.

Returns:

Converted third-party model, as defined by the subclass.

Return type:

object

library: ClassVar[str | None] = 'scqubits'
class quchip.interop.scqubits.devices.KerrOscillatorMapping[source]

Bases: ModelMapping

Map scqubits.KerrOscillator to KerrCavity (import-only).

scqubits writes the Kerr oscillator as \(H = E_{\rm osc}\, a^\dagger a - K\, a^\dagger a^\dagger a a\), with the eigenvalues \(E_n = (E_{\rm osc} + K)\, n - K\, n^2\). The quchip KerrCavity writes \(H = \omega\, \hat n - K'\, \hat n(\hat n - 1)\), with the eigenvalues \(E_n = \omega\, n - K'\, n(n-1) = (\omega + K')\, n - K'\, n^2\).

Match the terms one by one. The \(n^2\) coefficient gives kerr = K. With kerr = K fixed, the \(n\) coefficient gives freq = E_osc. Both spectra start at \(E_0 = 0\), so the translation is the direct copy freq = E_osc, kerr = K, with no sign flip. Import only: KerrCavity requires kerr >= 0, and it models the K > 0 (self-focusing) branch that scqubits uses.

source: ClassVar[str | None] = 'scqubits.KerrOscillator'
target

alias of KerrCavity

import_model(obj, *, levels=None, label=None, **noise_kwargs)[source]

Convert third-party object obj into a quchip device.

Override to support import. The base implementation raises NotImplementedError.

Parameters:
  • obj (object) – Third-party instance to convert.

  • **opts – Mapping-specific keyword options. Subclasses must document supported keys.

Returns:

Converted quchip model, as defined by the subclass.

Return type:

object

library: ClassVar[str | None] = 'scqubits'
class quchip.interop.scqubits.devices.GenericQubitMapping[source]

Bases: ModelMapping

Map scqubits.GenericQubit to DuffingTransmon (import-only).

The generic two-level system \(H = \tfrac12 E\, \sigma_z\) has the level splitting E. It maps to a two-level DuffingTransmon with freq = E, anharmonicity = 0 (irrelevant at two levels), and levels = 2.

source: ClassVar[str | None] = 'scqubits.GenericQubit'
target: ClassVar[type | None] = None
import_model(obj, *, levels=None, label=None, **noise_kwargs)[source]

Convert third-party object obj into a quchip device.

Override to support import. The base implementation raises NotImplementedError.

Parameters:
  • obj (object) – Third-party instance to convert.

  • **opts – Mapping-specific keyword options. Subclasses must document supported keys.

Returns:

Converted quchip model, as defined by the subclass.

Return type:

object

library: ClassVar[str | None] = 'scqubits'
class quchip.interop.scqubits.devices.DuffingTransmonMapping[source]

Bases: ModelMapping

Map DuffingTransmon to scqubits.Transmon (export-only).

A Duffing transmon is specified by (freq, anharmonicity). The scqubits Transmon.find_EJ_EC inverts that pair to the (EJ, EC) that best reproduce the same 0->1 splitting and anharmonicity. The export builds the charge-basis transmon from these values (truncated_dim = device.levels). ncut (default 30, the scqubits inversion default) is an export option. The same ncut goes to find_EJ_EC and to the reconstructed Transmon, so the two always agree. DuffingTransmon has no offset-charge concept of its own to translate, so the export builds the transmon at the charge sweet spot ng=0. The other direction is import only and already covered by TransmonMapping.

library: ClassVar[str | None] = 'scqubits'
source: ClassVar[str | None] = None
target

alias of DuffingTransmon

export_model(device, *, ncut=30, **opts)[source]

Convert quchip device into a third-party object.

Override to support export, and also set target. The base implementation raises NotImplementedError.

Parameters:
  • device (object) – quchip device to convert.

  • **opts (Any) – Mapping-specific keyword options. Subclasses must document supported keys.

Returns:

Converted third-party model, as defined by the subclass.

Return type:

object

class quchip.interop.scqubits.devices.ZeroPiMapping[source]

Bases: ModelMapping

Map scqubits.ZeroPi to EigenbasisDevice (import-only).

ZeroPi is a two-mode circuit (\(\phi\), \(\theta\)), which scqubits diagonalizes on a joint phi-grid / charge-basis product space. There is no native quchip model for it, because none of its circuit devices carry a second coordinate. Instead of reimplementing that two-mode Hamiltonian, this mapping takes the frozen-snapshot path and diagonalizes with scqubits. It passes the resulting energies and eigenbasis-projected operators to EigenbasisDevice. That class uses an already-diagonal spectrum as its native basis (see its docstring).

The snapshot reproduces the spectrum and charge/phase matrix elements of obj exactly at its parameter point, but it is a frozen numeric table, not a parametric Hamiltonian model. Unlike the parametric mappings above, the imported device is not differentiable in the ZeroPi circuit parameters (EJ, EL, ECJ, EC, ng, flux). This path is the reference for wrapping any other scqubits (or third-party) type that has no native quchip model.

source: ClassVar[str | None] = 'scqubits.ZeroPi'
target: ClassVar[type | None] = None
import_model(obj, *, levels=None, label=None, **noise_kwargs)[source]

Convert third-party object obj into a quchip device.

Override to support import. The base implementation raises NotImplementedError.

Parameters:
  • obj (object) – Third-party instance to convert.

  • **opts – Mapping-specific keyword options. Subclasses must document supported keys.

Returns:

Converted quchip model, as defined by the subclass.

Return type:

object

library: ClassVar[str | None] = 'scqubits'