diff --git a/src/qibocal/auto/task.py b/src/qibocal/auto/task.py index 33a038680..c8a07d9fc 100644 --- a/src/qibocal/auto/task.py +++ b/src/qibocal/auto/task.py @@ -1,11 +1,13 @@ """Action execution tracker.""" import copy +import json from dataclasses import asdict, dataclass from pathlib import Path from typing import Any, NewType, Optional, Union import yaml +from qibo import Circuit from qibolab.platform import Platform from qibolab.qubits import QubitId, QubitPairId @@ -21,6 +23,7 @@ """Elements to be calibrated by a single protocol.""" SINGLE_ACTION = "action.yml" +CIRCUIT = "circuit.json" @dataclass @@ -40,6 +43,12 @@ class Action: def dump(self, path: Path): """Dump single action to yaml.""" + if self.parameters is not None: + for param, value in self.parameters.items(): + if type(value) is Circuit: + circuit_path = path / CIRCUIT + circuit_path.write_text(json.dumps(value.raw)) + self.parameters[param] = str(circuit_path) (path / SINGLE_ACTION).write_text(yaml.safe_dump(asdict(self))) @classmethod