Skip to content

Commit

Permalink
Modify execute function.
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertMitjans committed Sep 6, 2023
1 parent 261ac56 commit 930a6b7
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/qililab/execute_circuit.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,18 @@

from .data_management import build_platform
from .experiment.experiment import Experiment
from .platform import Platform
from .transpiler import translate_circuit
from .typings import ExperimentOptions, ExperimentSettings


def execute(circuit: Circuit, platform_path: str, nshots: int = 1):
def execute(circuit: Circuit, platform: str | Platform, nshots: int = 1):
"""Execute a qibo with qililab and native gates
Args:
circuit (Circuit): Qibo Circuit.
platform_path (str): Path to the YAML file containing the serialization of the Platform to be used.
platform_path (Platform | str): Platform used to execute the circuit. If a string is given, it should correspond
to the path to the YAML file containing the serialization of the Platform to be used.
nshots (int, optional): Number of shots to execute. Defaults to 1.
Returns:
Expand Down Expand Up @@ -62,7 +64,8 @@ def execute(circuit: Circuit, platform_path: str, nshots: int = 1):
circuit = translate_circuit(circuit, optimize=True)

# create platform
platform = build_platform(path=platform_path)
if isinstance(platform, str):
platform = build_platform(path=platform)

settings = ExperimentSettings(hardware_average=1, repetition_duration=200000, software_average=1, num_bins=nshots)
options = ExperimentOptions(settings=settings)
Expand Down

0 comments on commit 930a6b7

Please sign in to comment.