Custom evaluations

Custom evaluations enable customized interactions with MORe result sets, for example to further process data or make special plots. They can be accessed from the context menu of each result object in the postprocessor tree.

Open file

Click here to open the dialog window for locating & opening the custom evaluation python script file. After opening, the filename and time/date of its last modification will be displayed.

Export file

Click here to export the opened custom evaluation script (a .py script will be exported)

Load variables

Click here to load the variables defined in the custom evaluation script.

Run

After the variables of the custom evaluation have been suitably adjusted, the run button will execute the evaluation.

Example custom evaluation for basic interaction with results

"""
    Test script for checking variable access

"""

__author__ = 'me'
__version__ = '1.1'

from more.evaluation_utils.custom_evaluation import CustomEvaluationScript, DatasetEnumVariable, DatasetsListVariable, DatasetEnum
from traits.api import Int, Float, Instance, HasTraits, Enum, List, Union, Tuple, Range, Str
from traitsui.api import View, Item, EnumEditor


class SomeScript(CustomEvaluationScript):
    some_float = Float()
    some_int = Int()
    datasets = DatasetEnumVariable(ds_type='states', label='some_label')

    def run(self):
        """ Anything written here will be executed after pressing the run evaluation button """
        print('Running evaluation')
        print('Custom float: {}'.format(self.some_float))
        print('dataset: {}'.format(self.datasets.value))
        print('Selected Result: {}'.format(self.evaluation.selected_result))
        print('Result: {}'.format(self.evaluation.result))
        print('Selected dataset name {}'.format(self.datasets.value))
        print('custom_data: {}'.format(self.evaluation.parent.custom_data))
        new_result = self.evaluation.results[0]
        self.evaluation.result = new_result





if __name__ == '__main__':
    evaluation = proj.post.find_simresults('Transient thermal').evaluations[-1]
    ds_enm = DatasetEnum(value=evaluation.results[0].datasets[0], chosen_key=evaluation.results[0])
    s = SomeScript(proj=proj, evaluation=evaluation, some_float=0.5, some_int=2, datasets=ds_enm)
    s.execute()