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