pyrates.frontend.fileio module

Interfaces for loading and saving (dumping) templates and circuits from/to file. object, filename: str, filetype: str, **kwargs)[source]

Save an object to file.

The object to dump to file. It must either be pickleable or have a to_dict method for ‘yaml’ mode.
Path to file (absolute or relative).
Chooses which loader to use to load the file. Allowed types: pickle, yaml


pyrates.frontend.fileio.pickle module

Interface to load from and save to python pickles.

pyrates.frontend.fileio.pickle.dump(data, filename, **kwargs)[source]
pyrates.frontend.fileio.pickle.load(filename, **kwargs)[source]

pyrates.frontend.fileio.yaml module

Some utility functions for parsing YAML-based definitions of circuits and components.

pyrates.frontend.fileio.yaml.dict_from_yaml(path: str)[source]

Load a template from YAML and return the resulting dictionary.

Parameters:path – (str) path to YAML template of the form or path/to/template_file/template_name.TemplateName. The dot notation refers to a path that can be found using python’s import functionality. That means it needs to be a module (a folder containing an located in the Python path (e.g. the current working directory). The slash notation refers to a file in an absolute or relative path from the current working directory. In either case the second-to-last part refers to the filename without file extension and the last part refers to the template name.
pyrates.frontend.fileio.yaml.dump_to_yaml(circuit, path: str, **kwargs) → None[source]

Interface to dump a CircuitTemplate instance to YAML.

  • circuit
  • path

Return type: