QSimulation

class QSimulation(design: QDesign | None = None, renderer_name: str | None = None, *args, **kwargs)[source]

A subclass of QAnalysis, intended to standardize across all Analysis classes select and name renderers.

Default Setup:
  • name (str): Name of simulation setup. Defaults to “Setup”.

Data Labels:
  • sim_setup_name (str): Name given to the current setup.

Variables and method needed from all those Analysis types that need a renderer.

Parameters:
  • design (QDesign) – The Metal design you are working on. Defaults to None.

  • renderer_name (str) – Name of the renderer you intend to use. Defaults to None.

Attributes

data_labels = ['sim_setup_name']

Default data labels.

default_setup = {'name': 'Setup', 'reuse_selected_design': True, 'reuse_setup': True}

Default setup

logger

Returns the logger.

renderer_initialized

Reports whether the renderer is initialized or stopped.

setup

Dictionary intended to be used to modify the analysis behavior.

Returns:

Current setup.

Return type:

Dict

Type:

Getter

sim_setup_name

Getter

Returns:

Name of the setup being executed.

Return type:

str

supported_data

Set that contains the names of the variables supported from the analysis.

Returns:

list of supported variable names.

Return type:

set

Type:

Getter

Methods

clear_data(data_name: str | list | None = None)

Clear data. Can optionally specify one or more labels to delete those labels and data.

Parameters:

data_name (Union[str, list], optional) – Can list specific labels to clean. Defaults to None.

close()[source]

Stops the renderer by executing the routine of the selected renderer.

get_data(data_name: str | None = None)

Retrieves the analysis module data. Returns None if nothing is found.

Parameters:

data_name (str, optional) – Label to query for data. If not specified, the entire dictionary is returned. Defaults to None.

Returns:

The data associated with the label, or the entire list of labels and data.

Return type:

Any

get_data_labels() list

Retrieves the list of data labels currently set. Returns None if nothing is found.

Returns:

list of data names

Return type:

list

print_run_args()

Prints the args and kwargs that were used in the last run() of this Analysis instance.

run(*args, **kwargs)[source]

Alias for run_sim() necessary to implement super-class method, while preventing method name collision when sim and non-sim QAnalysis classes are inherited.

abstract run_sim(*args, **kwargs)[source]

Abstract method. Must be implemented by the subclass. Write in here the code to launch the simulations. You will be able to execute this with the alias run().

run_sweep(*args, **kwargs)

User requests sweeper based on arguments from Sweeper.run_sweep().

save_run_args(**kwargs)

Intended to be used to store the kwargs passed to the run() method, for repeatability and for later identification of the QAnalysis instance.

save_screenshot()[source]

Saves the screenshot.

Returns:

Path to png formatted screenshot.

Return type:

(pathlib.WindowsPath)

select_renderer(renderer_name: str)[source]

Makes sure the renderer exists in qiskit-metal. If yes it sets the analysis class variables to be able to reach it easily. Else it throws an error.

Parameters:

renderer_name (str) – Name of the renderer you intend to use.

Returns:

The renderer to be used in the analysis.

Return type:

(QRenderer)

set_data(data_name: str, data: Any)

Stores data in a structure for later retrieval. Could be output, intermediate or even input data. Current implementation uses Dict()

Parameters:
  • data_name (str) – Label for the data. Used a storage key.

  • data (Any) – Free format

setup_update(section: str | None = None, **kwargs)

Intended to modify multiple setup settings at once, while retaining previous settings. If you intend to change a single setting, the better way is: setup.setting1 = value.

Parameters:

section (str) – Setup section that contains the setup keys to update.

start()[source]

Starts the renderer by executing the routine of the selected renderer.