Simulator API¶
qm.simulate.interface.SimulationConfig ¶
SimulationConfig(
duration: int = 0,
include_analog_waveforms: bool = False,
include_digital_waveforms: bool = False,
simulation_interface: Optional[
SimulationInterfaceTypes
] = None,
controller_connections: Optional[
List[ControllerConnection]
] = None,
extraProcessingTimeoutInMs: int = -1,
)
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:
|
include_analog_waveforms
|
True to collect simulated analog waveform names
TYPE:
|
include_digital_waveforms
|
True to collect simulated digital waveform names
TYPE:
|
simulation_interface
|
Interface for to simulator. Currently supported interfaces
-
TYPE:
|
controller_connections
|
A list of connections between the controllers in the config
TYPE:
|
extraProcessingTimeoutInMs
|
timeout in ms to wait for stream processing to finish. Default is -1, which is disables the timeout
TYPE:
|
qm.simulate.loopback.LoopbackInterface ¶
LoopbackInterface(
connections: List[SupportedConnectionTypes],
latency: int = 24,
noisePower: float = 0.0,
)
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:
TYPE:
|
latency
|
The latency between the OPX outputs and its input.
TYPE:
|
noisePower
|
How much noise to add to the input.
TYPE:
|
latency
|
The latency between the OPX outputs and its input.
TYPE:
|
noisePower
|
How much noise to add to the input.
TYPE:
|
Example
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:
TYPE:
|
noisePower
|
How much noise to add to the input.
TYPE:
|
Example
qm.results.simulator_samples.SimulatorControllerSamples ¶
SimulatorControllerSamples(
analog: Mapping[str, Sequence[Union[float, complex]]],
digital: Mapping[str, Sequence[bool]],
analog_sampling_rate: Optional[
Mapping[str, float]
] = None,
)
plot ¶
plot(
analog_ports: Optional[
Union[str, int, List[Union[str, int]]]
] = None,
digital_ports: Optional[
Union[str, int, List[Union[str, int]]]
] = None,
) -> None
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:
|
digital_ports
|
Union[None, str, list[str]]
TYPE:
|
Cloud Simulator API¶
qm_saas.client ¶
ClusterConfig ¶
A configuration of the cluster and its controllers.
controllers
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
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:
|
mw_fems ¶
Add MW FEMs to numbered slots in the cluster configuration.
PARAMETER | DESCRIPTION |
---|---|
*slots
|
The slots for the MW FEMs.
TYPE:
|
FemType ¶
An enum containing the available Front-End Module (FEM) types.
QOPVersion ¶
Represents a Quantum Orchestration Platform (QOP) version.
PARAMETER | DESCRIPTION |
---|---|
name
|
The name of the version.
TYPE:
|
ATTRIBUTE | DESCRIPTION |
---|---|
name |
The name of the version.
TYPE:
|
major |
The major version number.
TYPE:
|
minor |
The minor version number.
TYPE:
|
patch |
The patch version number.
TYPE:
|
Initialize a QmSaasInstanceVersion instance.
PARAMETER | DESCRIPTION |
---|---|
name
|
The name of the version in the format 'vX_Y_Z'.
TYPE:
|
major
property
¶
Get the major version number.
RETURNS | DESCRIPTION |
---|---|
int
|
The major version number. |
minor
property
¶
Get the minor version number.
RETURNS | DESCRIPTION |
---|---|
int
|
The minor version number. |
name
property
¶
Get the name of the version.
RETURNS | DESCRIPTION |
---|---|
str
|
The name of the version. |
patch
property
¶
Get the patch version number.
RETURNS | DESCRIPTION |
---|---|
int
|
The patch version number. |
QmSaas ¶
QmSaas(
host: str = "qm-saas.quantum-machines.co",
port: int = 443,
email: str = None,
password: str = None,
auto_cleanup: bool = True,
log: Logger = None,
)
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:
|
port
|
The port of the endpoint of the cloud platform api
TYPE:
|
email
|
The user's email
TYPE:
|
password
|
The user's password
TYPE:
|
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:
|
log
|
The logger to use for logging messages. If not provided, a default logger will be used.
TYPE:
|
host
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
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 |
latest_version ¶
Get latest available QoP version.
RETURNS | DESCRIPTION |
---|---|
QOPVersion
|
Latest QoP version. |
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:
|
cluster_config
|
The cluster configuration for the simulator instance for QoP v3.x.x
TYPE:
|
versions ¶
Get the available QoP versions.
RETURNS | DESCRIPTION |
---|---|
list[QOPVersion]
|
List of available QoP versions. |
QmSaasInstance ¶
QmSaasInstance(
client: Client,
version: any,
cluster_config: ClusterConfig = None,
auto_cleanup: bool = True,
log: Logger = None,
)
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:
|
version
|
The version to use for the simulator instance
TYPE:
|
cluster_config
|
The cluster configuration for the simulator instance for QoP v3.x.x
TYPE:
|
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:
|
log
|
The logger to use for logging messages. If not provided, a default logger will be used.
TYPE:
|
cluster_config
property
¶
Get the cluster configuration.
RETURNS | DESCRIPTION |
---|---|
dict
|
The cluster configuration. |
expires_at
property
¶
Get the expiration time of the simulator instance.
RETURNS | DESCRIPTION |
---|---|
datetime
|
The expiration time of the simulator instance. |
host
property
¶
Get the host of the simulator instance.
RETURNS | DESCRIPTION |
---|---|
str
|
The host of the simulator instance. |
id
property
¶
Get the ID of the simulator instance.
RETURNS | DESCRIPTION |
---|---|
str
|
The ID of the simulator instance. |
is_alive
property
¶
Check if the simulator instance is alive.
RETURNS | DESCRIPTION |
---|---|
bool
|
True if the simulator instance is alive, False otherwise. |
is_spawned
property
¶
Check if the simulator instance is spawned.
RETURNS | DESCRIPTION |
---|---|
bool
|
True if the simulator instance is spawned, False otherwise. |
port
property
¶
Get the port of the host of the simulator instance.
RETURNS | DESCRIPTION |
---|---|
int
|
port of the host of the simulator instance. |
token
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.