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:
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
- supported_data¶
Set that contains the names of the variables supported from the analysis.
- Returns:
list of supported variable names.
- Return type:
- Type:
Getter
Methods
- clear_data(data_name: str | list = None)¶
Clear data. Can optionally specify one or more labels to delete those labels and data.
- get_data(data_name: str = 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:
- 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.
- abstractmethod 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:
- 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.
- 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