save_platform

qililab.save_platform(path, platform)

Serialize and save the given platform to the specified path.

This function saves the cache values of the Platform object during execution as a YAML file. It does not read the actual instruments. If you have previously used platform.set_parameter() without being connected to the instruments, it will save this “set” value as the cache values of the Platform object were modified.

If the path string doesn’t end with .yml or .yaml, this function assumes that path corresponds to an existing folder. The platform will then be saved inside the folder specified by path in a file called platform_name.yml, where platform_name corresponds to the name attribute of the given Platform.

Parameters:
  • path (str) – Path to the folder/file where the YAML file will be saved.

  • platform (Platform) – Platform class to serialize and save to a YAML file.

Returns:

Path to the file where the platform is saved.

Return type:

str

Examples

If you save a platform by giving the path to a folder:

>>> ql.save_platform(path="examples/runcards/", platform=platform)

Qililab will use the name of the platform to create the YAML file. If platform.name == "galadriel", a file will be created in examples/runcards/galadriel.yml.