class QAnalysis(*args, **kwargs)[source]#

QAnalysis is the core class from which all Metal analysis classes are derived.

The class defines the user interface for working with analysis.

For front-end user:
  • Manipulates the setup dictionary to fine-tune the analysis parameters.

For creator user:
  • Creates a class that inherits this or the QSimulation classes.

  • Implements the run and run_*** methods to define the analysis procedures.

  • Defines the methods to communicate with the QRenderers. (see QSimulation)

  • Defines default_setup, which describes the parameteric interface to the analysis class.

Default Setup:

Nested default setup parameters can be overwritten with the setup_update method, or directly by using the dot operator enabled by the Dict type.

Creates a new Analysis object with a setup derived from the default_setup Dict.


data_labels = []#

Default data labels.

default_setup = {}#

Default setup.


Returns the logger.


Dictionary intended to be used to modify the analysis behavior.


Current setup.

Return type:





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


list of supported variable names.

Return type:





clear_data(data_name: str | list | None = None)[source]#

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


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

get_data(data_name: str | None = None)[source]#

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


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


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

Return type:


get_data_labels() list[source]#

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


list of data names

Return type:



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

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

Abstract method. Must be implemented by the subclass. Use as an alias for the main analysis method. Call the main analysis method run_***(). Subclass implementation of run() must: * always call the main analysis method(s) named run_***(). * never implement the analysis, which should be instead in the method run_***().

run_***() must always call self.save_run_args(*args, **kwargs) to save the inputs.


def run(self, *args, **kwargs):
    self.run_sim(*args, **kwargs)
def run_sim(self, *args, **kwargs):
    self.save_run_args(*args, **kwargs)

Make sure the name of the method run_***() does not conflict with that of another QAnalysis subclass, in case you expect them to be both inherited from the same subclass.

run_sweep(*args, **kwargs)[source]#

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


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

set_data(data_name: str, data: Any)[source]#

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

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

  • data (Any) – Free format

setup_update(section: str | None = None, **kwargs)[source]#

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.


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