EvaluationSetup#
Qualified name: api.postprocessor.evaluations.evaluation_setup.EvaluationSetup
- class api.postprocessor.evaluations.evaluation_setup.EvaluationSetup(evaluation)[source]#
Bases:
ABC
Methods
Creates a viewer and returns a
ViewerSetup
objectDuplicates a viewer object and returns the
ViewerSetup
object for the newly created copyGets the names of viewer types compatible with this evaluation
Returns the name of the evaluation
Gets the names of the results, typically these are the job labels assigned in the study
Creates a
ViewerSetup
for an already existing viewerGets the names of existing child viewers
Removes a viewer object
Changes the name of the evaluation
- abstract create_viewer(viewer_type: str) ViewerSetup [source]#
Creates a viewer and returns a
ViewerSetup
objectExample
>>> 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 viewer types: {}".format(evaluation_setup.get_compatible_viewer_types())) Available viewer types: [...] >>> viewer_setup = evaluation_setup.create_viewer(viewer_type='Figure')
- Parameters:
viewer_type (str) – The name of the evaluation type to add, to check which names are compatible run the
get_compatible_viewer_types()
method- Returns:
An object for managing viewer setup
- Return type:
- Raises:
NameNotFoundError – Raised if no viewer with the given type exists
NotCompatibleError – Raised if the viewer is not compatible
- abstract duplicate_viewer(name: str) ViewerSetup [source]#
Duplicates a viewer object and returns the
ViewerSetup
object for the newly created copyExample
>>> 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').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 viewer object to duplicate
- Returns:
The setup object for the newly created copy
- Return type:
- Raises:
NameNotFoundError – Raised if no viewer with the given name exist
- abstract get_compatible_viewer_types() List[str] [source]#
Gets the names of viewer 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='Custom') >>> 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 viewer types
- Return type:
list of strings
- abstract 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='Custom').set_name(name='new_name') >>> evaluation_setup.get_name() 'new_name'
- Returns:
name – The name of the evaluation
- Return type:
str
- abstract 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
- abstract get_viewer(name: str) ViewerSetup [source]#
Creates a
ViewerSetup
for an already existing viewerExample
>>> 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') >>> 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 viewer for which to return a
ViewerSetup
- Returns:
A
ViewerSetup
object for the found viewer- Return type:
- Raises:
NameNotFoundError – Raised if no viewer with the given name was found
- abstract get_viewer_names() List[str] [source]#
Gets the names of existing child viewers
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') >>> 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 viewers
- Return type:
list of strings
- abstract remove_viewer(name: str) EvaluationSetup [source]#
Removes a viewer 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='Custom').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:
- Raises:
NameNotFoundError – Raised if no viewer with the given name exist
- abstract 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='Custom') >>> evaluation_setup.set_name(name='new_name') <more...> >>> second_evaluation_setup = simresult_setup.create_evaluation(evaluation_type='Custom')\ ... .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:
- Raises:
NameNotUniqueError – Raised if the given name is not unique
TypeError – Raised if the given name is not a string