Skip to content

Simulator API

qm.simulate.interface.SimulationConfig

Creates a configuration object to pass to qm.quantum_machines_manager.QuantumMachinesManager.simulate

PARAMETER DESCRIPTION
duration

The duration to run the simulation for, in clock cycles

TYPE: int DEFAULT: 0

include_analog_waveforms

True to collect simulated analog waveform names

TYPE: bool DEFAULT: False

include_digital_waveforms

True to collect simulated digital waveform names

TYPE: bool DEFAULT: False

simulation_interface

Interface for to simulator. Currently supported interfaces - None - Zero inputs - qm.simulate.loopback.LoopbackInterface - Loopback output to input - qm.simulate.raw.RawInterface - Specify samples for inputs

TYPE: SimulatorInterface DEFAULT: None

controller_connections

A list of connections between the controllers in the config

TYPE: List[ControllerConnection] DEFAULT: None

extraProcessingTimeoutInMs

timeout in ms to wait for stream processing to finish. Default is -1, which is disables the timeout

TYPE: int DEFAULT: -1

qm.simulate.loopback.LoopbackInterface

Creates a loopback interface for use in qm.simulate.interface.SimulationConfig. A loopback connects the output of the OPX into it's input. This can be defined directly using the ports or through the elements.

PARAMETER DESCRIPTION
connections

List of tuples with loopback connections. Each tuple should represent physical connection between ports:

    ``(from_controller: str, from_port: int, to_controller: str, to_port: int)``

TYPE: list

latency

The latency between the OPX outputs and its input.

TYPE: int DEFAULT: 24

noisePower

How much noise to add to the input.

``(fromController: str, fromFEM: int, fromPort: int, toController: str, toFEM: int, toPort: int)``
  1. Virtual connection between elements:

    (fromQE: str, toQE: str, toQEInput: int)

TYPE: float DEFAULT: 0.0

latency

The latency between the OPX outputs and its input.

TYPE: int DEFAULT: 24

noisePower

How much noise to add to the input.

TYPE: float DEFAULT: 0.0

Example
job = qmm.simulate(config, prog, SimulationConfig(
duration=20000,
# loopback from output 1 to input 2 of controller 1:
simulation_interface=LoopbackInterface([("con1", 1, "con1", 2)])

qm.simulate.raw.RawInterface

Creates a raw interface for use in qm.simulate.interface.SimulationConfig. A raw interface defines samples that will be inputted into the OPX inputs.

PARAMETER DESCRIPTION
connections

List of tuples with the connection. Each tuple should be:

``(toController: str, toFEM: int, toPort: int, toSamples: List[float])``

TYPE: list

noisePower

How much noise to add to the input.

TYPE: float DEFAULT: 0.0

Example
job = qmm.simulate(config, prog, SimulationConfig(
                  duration=20000,
                  # 500 ns of DC 0.2 V into con1 input 1
                  simulation_interface=RawInterface([("con1", 1, [0.2]*500)])

qm.results.simulator_samples.SimulatorControllerSamples

plot

Plots the simulated output of the OPX in the given ports. If no ports are given, all active ports are plotted.

PARAMETER DESCRIPTION
analog_ports

Union[None, str, list[str]]

TYPE: Optional[Union[str, int, List[Union[str, int]]]] DEFAULT: None

digital_ports

Union[None, str, list[str]]

TYPE: Optional[Union[str, int, List[Union[str, int]]]] DEFAULT: None

Cloud Simulator API

qm_saas.client

ClusterConfig

A configuration of the cluster and its controllers.

controllers: dict property

Get the controllers' configuration.

RETURNS DESCRIPTION
dict

A dictionary of the controllers and their configuration.

controller

Add a controller to the cluster configuration.

RETURNS DESCRIPTION
ControllerConfig

The controller configuration.

to_dict

Convert the cluster configuration to a dictionary.

RETURNS DESCRIPTION
dict

A dictionary of the cluster controllers and their FEM.

ControllerConfig

A configuration of a controller and its FEMs in the cluster.

slots: dict property

Get the slots' FEM configuration.

RETURNS DESCRIPTION
dict

A dictionary of the slots and their FEM types.

lf_fems

Add LF FEMs to numbered slots in the cluster configuration.

PARAMETER DESCRIPTION
*slots

The slots for the LF FEMs.

TYPE: int DEFAULT: ()

mw_fems

Add MW FEMs to numbered slots in the cluster configuration.

PARAMETER DESCRIPTION
*slots

The slots for the MW FEMs.

TYPE: int DEFAULT: ()

FemType

An enum containing the available Front-End Module (FEM) types.

QmSaas

A simulator client for QmSaas - The Quantum Orchestration Platform (QoP) on the cloud.

Create a QmSaas client.

PARAMETER DESCRIPTION
host

The host of the endpoint of the cloud platform api

TYPE: str DEFAULT: 'qm-saas.quantum-machines.co'

port

The port of the endpoint of the cloud platform api

TYPE: int DEFAULT: 443

email

The user's email

TYPE: str DEFAULT: None

password

The user's password

TYPE: str DEFAULT: None

auto_cleanup

If true (default), automatically delete the simulator instance when the context manager exits otherwise it will be left running until it timeouts or is manually closed.

TYPE: bool DEFAULT: True

log

The logger to use for logging messages. If not provided, a default logger will be used.

TYPE: Logger DEFAULT: None

host: str property

Get the host of the endpoint of the cloud platform api

RETURNS DESCRIPTION
str

The host of the endpoint of the cloud platform api

port: int property

Get the port of the endpoint of the cloud platform api

RETURNS DESCRIPTION
int

The port of the endpoint of the cloud platform api

close_all

Close all the simulator instances created by this client

simulator

Create a simulator instance on the cloud platform.

PARAMETER DESCRIPTION
version

The QoP version to use for the simulator instance. Defaults to the latest version

TYPE: QoPVersion DEFAULT: latest

cluster_config

The cluster configuration for the simulator instance for QoP v3.x.x

TYPE: ClusterConfig DEFAULT: None

QmSaasInstance

A simulator instance on the cloud platform.

Create a simulator instance on the cloud platform.

PARAMETER DESCRIPTION
client

The client to use for the simulator instance

TYPE: Client

version

The QoP version to use for the simulator instance

TYPE: QoPVersion

cluster_config

The cluster configuration for the simulator instance for QoP v3.x.x

TYPE: ClusterConfig DEFAULT: None

auto_cleanup

If true (default), automatically delete the simulator instance when the context manager exits otherwise it will be left running until it timeouts or is manually closed.

TYPE: bool DEFAULT: True

log

The logger to use for logging messages. If not provided, a default logger will be used.

TYPE: Logger DEFAULT: None

cluster_config: dict property

Get the cluster configuration.

RETURNS DESCRIPTION
dict

The cluster configuration.

expires_at: datetime.datetime property

Get the expiration time of the simulator instance.

RETURNS DESCRIPTION
datetime

The expiration time of the simulator instance.

host: str property

Get the host of the simulator instance.

RETURNS DESCRIPTION
str

The host of the simulator instance.

id: str property

Get the ID of the simulator instance.

RETURNS DESCRIPTION
str

The ID of the simulator instance.

is_alive: bool property

Check if the simulator instance is alive.

RETURNS DESCRIPTION
bool

True if the simulator instance is alive, False otherwise.

is_spawned: bool property

Check if the simulator instance is spawned.

RETURNS DESCRIPTION
bool

True if the simulator instance is spawned, False otherwise.

port: int property

Get the port of the host of the simulator instance.

RETURNS DESCRIPTION
int

port of the host of the simulator instance.

token: str property

Get the token of the simulator instance.

RETURNS DESCRIPTION
str

The token of the simulator instance.

close

Closes the remote simulator and the session. This operation is idempotent and can be called multiple times.

spawn

Spawns the simulator instance on the QmSaaS platform. This is a blocking operation.

The simulator is spawned only once, subsequent calls to this method will not spawn a new simulator, unless the current one is closed.

QoPVersion

An enum containing the available Quantum Orchestration Platform (QoP) versions.