SimresultSetup#

Qualified name: api.postprocessor.simresult_setup.SimresultSetup

class api.postprocessor.simresult_setup.SimresultSetup(simresult)[source]#

Bases: ABC

Methods

copy_evaluation_from

Copies an evaluation from the given simresult to this one and renames it, returns the newly created evaluation setup

create_evaluation

Creates a EvaluationSetup object for handling evaluations

duplicate_evaluation

Duplicates an evaluation and return the EvaluationSetup object for the newly created evaluation

get_compatible_evaluation_types

Gets the names of evaluation types compatible with this simresults

get_evaluation

Creates a EvaluationSetup for an already existing evaluation

get_evaluation_names

Gets the names of existing evaluations

get_name

Returns the name of the object

get_result_names

Gets the names of the results, typically those are the job labels assigned in the study

remove_evaluation

Removes an evaluation

set_name

Changes the name of the simresults

abstract copy_evaluation_from(source_evaluation_setup: EvaluationSetup, target_evaluation_name: str | None = None) EvaluationSetup[source]#

Copies an evaluation from the given simresult to this one and renames it, returns the newly created evaluation setup

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> postprocessor_setup = api.create_postprocessor_setup()
>>> # Prepare source simresult and source evaluation for copying, the source simresult must already exist
>>> source_simresult = postprocessor_setup.get_simresult(name='source_simresult')
>>> source_evaluation = source_simresult.create_evaluation(evaluation_type='Custom').set_name('source_evaluation')
>>> # Prepare target simresult setup, the simresult must already exist
>>> target_simresult = postprocessor_setup.get_simresult(name='target_simresult')
>>> # Copy source evaluation from source simresult to target simresult
>>> target_evaluation = target_simresult.copy_evaluation_from(source_evaluation_setup=source_evaluation,
...                                                           target_evaluation_name='target_evaluation')
Parameters:
  • source_evaluation_setup (EvaluationSetup) – The name of the evaluation in the source simresult to copy

  • target_evaluation_name (Optional[str]) – Optional name to use for the new evaluation, if not given then the same name will be used as in the source

Returns:

The newly created duplicate evaluation

Return type:

EvaluationSetup

Raises:

NameNotUniqueError – Raised when the provided target name is a duplicate

abstract create_evaluation(evaluation_type: str) EvaluationSetup[source]#

Creates a EvaluationSetup object for handling evaluations

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> postprocessor_setup = api.create_postprocessor_setup()
>>> simresult_setup = postprocessor_setup.get_simresult(name='example_simresult') # The simresult object must already exist
>>> print("Available evaluation types: {}".format(simresult_setup.get_compatible_evaluation_types()))
Available evaluation types: [...]
>>> evaluation_setup = simresult_setup.create_evaluation(evaluation_type='Custom')
Parameters:

evaluation_type (str) – The name of the evaluation type to add, to check which names are compatible run the get_compatible_evaluation_types() method

Returns:

An object for managing evaluation setup

Return type:

EvaluationSetup

Raises:
  • NameNotFoundError – Raised if no evaluation with the given type exists

  • NotCompatibleError – Raised if the chosen evaluation type exists, but is not compatible with the current evaluation

abstract duplicate_evaluation(name: str) EvaluationSetup[source]#

Duplicates an evaluation and return the EvaluationSetup object for the newly created evaluation

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> postprocessor_setup = api.create_postprocessor_setup()
>>> simresult_setup = postprocessor_setup.get_simresult(name='example_simresult') # The simresult object must already exist
>>> original_evaluation = simresult_setup.create_evaluation(evaluation_type='Custom').set_name(name='example_evaluation')
>>> duplicate_evaluation = simresult_setup.duplicate_evaluation(name='example_evaluation')
>>> print("Automatically assigned name of the duplicate: {}".format(duplicate_evaluation.get_name()))
Automatically assigned name of the duplicate: ...
Parameters:

name (str) – The name of the evaluation to duplicate

Returns:

The evaluation setup object for the new evaluation

Return type:

more.api.postprocessor.evaluations.EvaluationSetup

Raises:

NameNotFoundError – Raised if no evaluation with the given name exist

abstract get_compatible_evaluation_types() List[str][source]#

Gets the names of evaluation types compatible with this simresults

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> postprocessor_setup = api.create_postprocessor_setup()
>>> simresult_setup = postprocessor_setup.get_simresult(name='example_simresult') # The simresult object must already exist
>>> print("Available evaluation types: {}".format(simresult_setup.get_compatible_evaluation_types()))
Available evaluation types: [...]
Returns:

Names of compatible evaluation types

Return type:

list of strings

abstract get_evaluation(name: str) EvaluationSetup[source]#

Creates a EvaluationSetup for an already existing evaluation

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> postprocessor_setup = api.create_postprocessor_setup()
>>> simresult_setup = postprocessor_setup.get_simresult(name='example_simresult') # The simresult object must already exist
>>> evaluation_setup = simresult_setup.get_evaluation(name='example_evaluation') # The evaluation object must already exist
Parameters:

name (str) – The name of the existing evaluation for which to return a EvaluationSetup

Returns:

A EvaluationSetup object for the found evaluation object

Return type:

EvaluationSetup

Raises:

NameNotFoundError – Raised if no evaluation with the given name was found

abstract get_evaluation_names() List[str][source]#

Gets the names of existing evaluations

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> postprocessor_setup = api.create_postprocessor_setup()
>>> simresult_setup = postprocessor_setup.get_simresult(name='example_simresult') # The simresult object must already exist
>>> print("Available evaluations: {}".format(simresult_setup.get_evaluation_names()))
Available evaluations: [...]
Returns:

Names of existing evaluations

Return type:

list of strings

abstract get_name() str[source]#

Returns the name of the object

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> postprocessor_setup = api.create_postprocessor_setup()
>>> simresult_setup = postprocessor_setup.get_simresult(name='example_simresult') # The simresult object must already exist
>>> simresult_setup.set_name('new_name')
<more...>
>>> simresult_setup.get_name()
'new_name'
Returns:

name – The name of the object

Return type:

str

abstract get_result_names() List[str][source]#

Gets the names of the results, typically those are the job labels assigned in the study

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> postprocessor_setup = api.create_postprocessor_setup()
>>> simresult_setup = postprocessor_setup.get_simresult(name='example_simresult') # The simresult object must already exist
>>> print("Available results: {}".format(simresult_setup.get_result_names()))
Available results: [...]
Returns:

Names of available results

Return type:

list of strings

abstract remove_evaluation(name: str) SimresultSetup[source]#

Removes an evaluation

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> postprocessor_setup = api.create_postprocessor_setup()
>>> simresult_setup = postprocessor_setup.get_simresult(name='example_simresult') # The simresult object must already exist
>>> simresult_setup.remove_evaluation(name='example_evaluation') # The evaluation object must already exist
<more...>
Parameters:

name (str) – The name of the evaluation object to remove

Returns:

self

Return type:

SimresultSetup

Raises:

NameNotFoundError – Raised if no evaluation with the given name exist

abstract set_name(name: str, resolve_duplicate_name: bool = False) SimresultSetup[source]#

Changes the name of the simresults

Example

>>> from more.api import ApiGateway
>>> api = ApiGateway(proj=proj)
>>> postprocessor_setup = api.create_postprocessor_setup()
>>> simresult_setup = postprocessor_setup.get_simresult(name='example_simresult') # The simresult object must already exist
>>> simresult_setup.set_name('new_name')
<more...>
>>> second_simresult_setup = postprocessor_setup.get_simresult(name='other_example_simresult') \
...     .set_name(name='new_name', resolve_duplicate_name=True)
>>> second_simresult_setup.get_name()
'new_name 1'
Parameters:
  • resolve_duplicate_name (bool) – Whether to automatically assign a new name when the chosen one is already taken

  • name (str) – The new name

Returns:

self – This object

Return type:

SimresultSetup

Raises:
  • TypeError – Raised if the given name is not a string

  • NameNotUniqueError – Raised if the given name is not unique