netqasm.runtime.interface

netqasm.runtime.interface.config

class netqasm.runtime.interface.config.QuantumHardware(value)

Bases: enum.Enum

An enumeration.

Generic = 'Generic'
NV = 'NV'
TrappedIon = 'TrappedIon'
class netqasm.runtime.interface.config.NoiseType(value)

Bases: enum.Enum

An enumeration.

NoNoise = 'NoNoise'
Depolarise = 'Depolarise'
DiscreteDepolarise = 'DiscreteDepolarise'
Bitflip = 'Bitflip'
class netqasm.runtime.interface.config.Qubit(id, t1, t2)

Bases: object

Parameters
  • id (int) –

  • t1 (float) –

  • t2 (float) –

id: int
t1: float
t2: float
class netqasm.runtime.interface.config.Node(name, hardware, qubits, gate_fidelity=1.0)

Bases: object

Parameters
name: str
hardware: netqasm.runtime.interface.config.QuantumHardware
qubits: List[netqasm.runtime.interface.config.Qubit]
gate_fidelity: float = 1.0

Bases: object

Parameters
  • name (str) –

  • node_name1 (str) –

  • node_name2 (str) –

  • noise_type (NoiseType) –

  • fidelity (float) –

name: str
node_name1: str
node_name2: str
noise_type: netqasm.runtime.interface.config.NoiseType
fidelity: float
class netqasm.runtime.interface.config.NetworkConfig(nodes, links)

Bases: object

Parameters
  • nodes (List[Node]) –

  • links (List[Link]) –

nodes: List[netqasm.runtime.interface.config.Node]
netqasm.runtime.interface.config.default_network_config(node_names, hardware=<QuantumHardware.Generic: 'Generic'>)

Create a config for a fully connected network of nodes with the given names

Parameters
Return type

NetworkConfig

netqasm.runtime.interface.config.parse_network_config(cfg)
Return type

NetworkConfig

netqasm.runtime.interface.config.network_cfg_from_file(network_config_file=None)
Parameters

network_config_file (Optional[str]) –

Return type

NetworkConfig

netqasm.runtime.interface.logging

class netqasm.runtime.interface.logging.QubitGroup(is_entangled, qubit_ids, state)

Bases: object

Parameters
  • is_entangled (Optional[bool]) –

  • qubit_ids (List[List[Union[str, int]]]) –

  • state (Optional[Tuple[Tuple[complex, complex], Tuple[complex, complex]]]) –

is_entangled: Optional[bool]
qubit_ids: List[List[Union[str, int]]]
state: Optional[Tuple[Tuple[complex, complex], Tuple[complex, complex]]]
class netqasm.runtime.interface.logging.EntanglementType(value)

Bases: enum.Enum

An enumeration.

CK = 'CK'
MD = 'MD'
class netqasm.runtime.interface.logging.EntanglementStage(value)

Bases: enum.Enum

An enumeration.

START = 'start'
FINISH = 'finish'
class netqasm.runtime.interface.logging.InstrLogEntry(WCT, SIT, AID, SID, PRC, HLN, HFL, INS, OPR, ANG, QID, VID, OUT, QGR, LOG)

Bases: object

Parameters
  • WCT (str) –

  • SIT (int) –

  • AID (int) –

  • SID (int) –

  • PRC (int) –

  • HLN (int) –

  • HFL (str) –

  • INS (str) –

  • OPR (List[str]) –

  • ANG (Optional[Dict[str, int]]) –

  • QID (List[int]) –

  • VID (List[int]) –

  • OUT (Optional[int]) –

  • QGR (Optional[Dict[int, QubitGroup]]) –

  • LOG (str) –

WCT: str

Wall clock time. Format is Python’s datetime.now().

SIT: int

Time in NetSquid simulation, in nanoseconds.

AID: int

App ID, used internally by the backend.

SID: int

Subroutine ID. Used internally by the Executor.

PRC: int

Program counter. Used internally by the Executor.

HLN: int

Host line number. Line number in source file (.py) related to what is currently executed. The line is in the file given by HFL (see below).

HFL: str

Host file. Source file (.py) of current executed instruction.

INS: str

Mnemonic of the NetQASM instruction being executed.

OPR: List[str]

Operands (register, array-entries..). List of “op=val” strings

ANG: Optional[Dict[str, int]]

Angle represented as the fraction num/den. For non-rotation instructions, ANG is None. For rotation instructions ANG is a dictionary with 2 entries: ‘num’ (an int) and ‘den’ (an int).

QID: List[int]

Physical qubit IDs of qubits part of the current operation.

VID: List[int]

Virtual qubit IDs of qubits part of the current operation.

OUT: Optional[int]

Measurement outcome. Only set in case of a measurement instruction.

QGR: Optional[Dict[int, netqasm.runtime.interface.logging.QubitGroup]]

Dictionary specifying groups of qubits across the network.

LOG: str

Human-readable message.

class netqasm.runtime.interface.logging.NetworkLogEntry(WCT, SIT, TYP, INS, BAS, MSR, NOD, PTH, QID, QGR, LOG)

Bases: object

Parameters
  • WCT (str) –

  • SIT (int) –

  • TYP (Optional[EntanglementType]) –

  • INS (EntanglementStage) –

  • BAS (Optional[List[int]]) –

  • MSR (List[int]) –

  • NOD (List[str]) –

  • PTH (List[str]) –

  • QID (List[int]) –

  • QGR (Optional[Dict[int, QubitGroup]]) –

  • LOG (str) –

WCT: str

Wall clock time. Format is Python’s datetime.now().

SIT: int

Time in NetSquid simulation, in nanoseconds.

TYP: Optional[netqasm.runtime.interface.logging.EntanglementType]

Entanglement generation type(Measure Directly or Create and Keep). For the ‘start’ entanglement stage (see INS below), this value is None since at this stage the value cannot be determined yet. For the ‘finish’ stage, the correct value is filled in, however.

INS: netqasm.runtime.interface.logging.EntanglementStage

Entanglement generation stage(start or finish).

BAS: Optional[List[int]]

Bases in which the two qubits(one on each end) were measured in . Only applies to the Measure Directly case. It is None otherwise.

MSR: List[int]

Measurement outcomes of the two qubits(one on each end). Only applies to the Measure Directly case. It is None otherwise.

NOD: List[str]

Node names involved in this entanglement operation.

PTH: List[str]

Path of links used for entanglement generation. Links are identified using their names.

QID: List[int]

Physical qubit IDs of qubits part of the current operation.

QGR: Optional[Dict[int, netqasm.runtime.interface.logging.QubitGroup]]

Dictionary specifying groups of qubits across the network, as they are after the current operation.

LOG: str

Human-readable message.

class netqasm.runtime.interface.logging.ClassCommLogEntry(WCT, HLN, HFL, INS, MSG, SEN, REC, SOD, LOG)

Bases: object

Parameters
  • WCT (str) –

  • HLN (int) –

  • HFL (str) –

  • INS (str) –

  • MSG (str) –

  • SEN (str) –

  • REC (str) –

  • SOD (str) –

  • LOG (str) –

WCT: str

Wall clock time. Format is Python’s datetime.now().

HLN: int

Host line number. Line number in source file (.py) related to what is currently executed. The line is in the file given by HFL(see below).

HFL: str

Host file. Source file (.py) of current executed instruction.

INS: str

Classical operation being performed.

MSG: str

Message that is sent or received.

SEN: str

Name(role) of the sender.

REC: str

Name(role) of the receiver.

SOD: str

Socket ID(used internally).

LOG: str

Human-readable message.

class netqasm.runtime.interface.logging.AppLogEntry(WCT, HLN, HFL, LOG)

Bases: object

Parameters
  • WCT (str) –

  • HLN (int) –

  • HFL (str) –

  • LOG (str) –

WCT: str

Wall clock time. Format is Python’s datetime.now().

HLN: int

Host line number. Line number in source file (.py) related to what is currently executed. The line is in the file given by HFL(see below).

HFL: str
LOG: str

Human-readable message.

netqasm.runtime.interface.results