EvaluationSetup

Qualified name: api.postprocessor.evaluations.evaluation_setup.EvaluationSetup

class api.postprocessor.evaluations.evaluation_setup.EvaluationSetup(item)[source]

Bases: ABC

Methods

create_evaluation

Creates an evaluation and returns a EvaluationSetup object

create_viewer

Creates a viewer and returns a ViewerSetup object

duplicate_evaluation

Duplicates an evaluation object and returns the EvaluationSetup object for the newly created copy

duplicate_viewer

Duplicates a viewer object and returns the ViewerSetup object for the newly created copy

get_compatible_evaluation_types

Gets the names of evaluation types compatible with this evaluation

get_compatible_viewer_types

Gets the names of viewer types compatible with this evaluation

get_evaluation

Creates a EvaluationSetup for an already existing evaluation

get_evaluation_names

Gets the names of existing child evaluations

get_name

Returns the name of the evaluation

get_output_results

Returns the internal representation of the results as processed by this evaluation

get_result_names

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

get_viewer

Creates a ViewerSetup for an already existing viewer

get_viewer_names

Gets the names of existing child viewers

remove_evaluation

Removes an evaluation object

remove_viewer

Removes a viewer object

set_name

Changes the name of the evaluation

abstractmethod create_evaluation(evaluation_type: str) more.api.postprocessor.evaluations.EvaluationSetup[source]

Creates an evaluation and returns a EvaluationSetup 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
>>> evaluation_setup = simresult_setup.create_evaluation(evaluation_type='Result filter')
>>> print("Available viewer types: {}".format(evaluation_setup.get_compatible_viewer_types()))
Available viewer types: [...]
>>> viewer_setup = evaluation_setup.create_viewer(viewer_type='Figure')
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

abstractmethod create_viewer(viewer_type: str) more.api.postprocessor.evaluations.EvaluationSetup[source]

Creates a viewer and returns a ViewerSetup object

Deprecated

the ‘create_viewer’ method is deprecated and will be removed. Viewers are now evaluations,

please use the create_evaluation() method

abstractmethod duplicate_evaluation(name: str) more.api.postprocessor.evaluations.EvaluationSetup[source]

Duplicates an evaluation object and returns the EvaluationSetup object for the newly created copy

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.create_evaluation(evaluation_type='Result filter').set_name(name='example_evaluation')
>>> evaluation_setup.create_viewer(viewer_type='Figure').set_name(name='example_viewer')
<more...>
>>> duplicate_viewer = evaluation_setup.duplicate_viewer(name='example_viewer')
>>> print("Automatically assigned name of the duplicate: {}".format(duplicate_viewer.get_name()))
Automatically assigned name of the duplicate: ...
Parameters:

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

Returns:

The setup object for the newly created copy

Return type:

EvaluationSetup

Raises:

NameNotFoundError – Raised if no evaluation with the given name exist

abstractmethod duplicate_viewer(name: str) more.api.postprocessor.evaluations.EvaluationSetup[source]

Duplicates a viewer object and returns the ViewerSetup object for the newly created copy

Deprecated

the ‘duplicate_viewer’ method is deprecated and will be removed. Viewers are now evaluations,

please use the duplicate_evaluation() method

abstractmethod get_compatible_evaluation_types() List[str][source]

Gets the names of evaluation types compatible with this 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.create_evaluation(evaluation_type='Result filter')
>>> evaluation_setup.create_viewer(viewer_type='Figure').set_name(name='example_viewer')
<more...>
>>> print("Available viewer types: {}".format(evaluation_setup.get_compatible_viewer_types()))
Available viewer types: [...]
Returns:

Names of compatible evaluation types

Return type:

list of strings

abstractmethod get_compatible_viewer_types() List[str][source]

Gets the names of viewer types compatible with this evaluation

Deprecated

the ‘get_compatible_viewer_types’ method is deprecated and will be removed. Viewers are now evaluations,

please use the get_compatible_evaluation_types() method

abstractmethod get_evaluation(name: str) more.api.postprocessor.evaluations.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.create_evaluation(evaluation_type='Result filter')
>>> viewer_setup = evaluation_setup.create_viewer(viewer_type='Figure').set_name(name='example_viewer')
>>> print("Available viewer types: {}".format(evaluation_setup.get_compatible_viewer_types()))
Available viewer types: [...]
>>> found_viewer_setup = evaluation_setup.get_viewer(name='example_viewer')
Parameters:

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

Returns:

A EvaluationSetup object for the found evaluation

Return type:

EvaluationSetupp

Raises:

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

abstractmethod get_evaluation_names() List[str][source]

Gets the names of existing child 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
>>> evaluation_setup = simresult_setup.create_evaluation(evaluation_type='Result filter')
>>> evaluation_setup.create_viewer(viewer_type='Figure').set_name(name='example_viewer')
<more...>
>>> print("Available viewers: {}".format(evaluation_setup.get_viewer_names()))
Available viewers: [...]
Returns:

Names of existing child evaluations

Return type:

list of strings

abstractmethod get_name() str[source]

Returns the name of the 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.create_evaluation(evaluation_type='Result filter').set_name(name='new_name')
>>> evaluation_setup.get_name()
'new_name'
Returns:

name – The name of the evaluation

Return type:

str

get_output_results()[source]

Returns the internal representation of the results as processed by this evaluation

Experimental

This method returns an internal representation of results, this may change without notice. In the future an API wrapper will be returned.

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.create_evaluation(evaluation_type='Result filter')
>>> evaluation_setup.get_output_results()
[...]
Returns:

list[Result]

Return type:

A list of results. Results are an internal representation.

abstractmethod get_result_names() List[source]

Gets the names of the results, typically these 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
>>> evaluation_setup = simresult_setup.create_evaluation(evaluation_type='Custom')
>>> print("Available results: {}".format(evaluation_setup.get_result_names()))
Available results: [...]
Returns:

Names of available results

Return type:

list of strings

abstractmethod get_viewer(name: str) more.api.postprocessor.evaluations.EvaluationSetup[source]

Creates a ViewerSetup for an already existing viewer

Deprecated

the ‘get_viewer’ method is deprecated and will be removed. Viewers are now evaluations,

please use the get_evaluation() method

abstractmethod get_viewer_names() List[str][source]

Gets the names of existing child viewers

Deprecated

the ‘get_viewer_names’ method is deprecated and will be removed. Viewers are now evaluations,

please use the get_evaluation_names() method

abstractmethod remove_evaluation(name: str) EvaluationSetup[source]

Removes an evaluation 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
>>> evaluation_setup = simresult_setup.create_evaluation(evaluation_type='Result filter').set_name(name='example_evaluation')
>>> evaluation_setup.create_viewer(viewer_type='Figure').set_name(name='example_viewer')
<more...>
>>> evaluation_setup.remove_viewer(name='example_viewer')
<more...>
Parameters:

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

Returns:

self

Return type:

EvaluationSetup

Raises:

NameNotFoundError – Raised if no viewer with the given name exist

abstractmethod remove_viewer(name: str) EvaluationSetup[source]

Removes a viewer object

Deprecated

the ‘remove_viewer’ method is deprecated and will be removed. Viewers are now evaluations,

please use the remove_evaluation() method

abstractmethod set_name(name: str, resolve_duplicate_name: bool = False) EvaluationSetup[source]

Changes the name of the 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.create_evaluation(evaluation_type='Result filter')
>>> evaluation_setup.set_name(name='new_name')
<more...>
>>> second_evaluation_setup = simresult_setup.create_evaluation(evaluation_type='Result filter')\
...     .set_name(name='new_name', resolve_duplicate_name=True)
>>> second_evaluation_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 of the evaluation

Returns:

self

Return type:

EvaluationSetup

Raises:
  • NameNotUniqueError – Raised if the given name is not unique

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