17 Nov 2022

Iterate Recipe

This module allows you to run a given recipe while varying a chosen parameter value of any of the modules making up the recipe.

IterateRecipe

Description

This module takes a given recipe, creates a temporary version of it with a modified parameter, and executes that using a hidden Recipe Player module. The parameter's values can be defined explicitly or using a for-loop.


Usage

  • Invoke it by right-clicking on Project View's background, select "Create Object ..." -> "Automation" -> "Xtra" -> "Iterate Recipe".
  • Select the recipe you want to use. Multi-input recipes are supported (up to 9 inputs).
  • The input ports of that recipe will appear. Connect them to appropriate data.
  • Select the name of the recipe module for which you want to vary a port's value.
  • Specify the name of the module's port for which you want to modify the value. Not all ports are supported/displayed.
  • Specify the "Value string": Any occurrence of "$" will be replaced by the current value from the list of values. You can use it to create composite values, e.g. expressions for Arithmetic or filters for Analysis Filter.
  • Choose "List definition".
    • Explicitly: Define "Value list", i.e. give a list of values to replace "$" in "Value string". In the case of one-word values, they can be separated by space (" "). In the case of more complex strings, they have to be separated by a comma (",").
    • Loop: The calculated values will replace "$" in "Value string". You can specify values for start, end, and step-size. Only positive step-size is supported. Integer or floating-point values are possible.

Note: When the selected port is changed, "Value list" will be re-initialized using the port-value taken from the original recipe, and "List definition" is switching back to "explicitly".

  • Press "Apply". The recipe will be run repeatedly with the values taken from the list of values. The results will be created in Project View. The respective value will be appended to the result's name.

Note: Not all ports of all modules are supported: only those which set values using either "setValue", "setIndex", or "setState" are supported. (Ports are excluded if they are in the "ignore_list" - see in the pyscro in the "def update(self):" section).


Example project

In the example project "IterateRecipe_example.hx", a recipe for porosity-analysis is used. That recipe creates two results, a label-field and a spreadsheet.

The final step of that recipe is filtering of analyzed pores by their volume. This is done using Analysis Filter with the "filter"-expression set to "Volume3d > 5000".

For changing the values in that filter-expression, "Value string" of Iterate Recipe has been set to "Volume3d > $".
When pressing "Apply", each value given explicitly in "Value list" will successively be replacing the "$" in "Value string", thus creating the filter expressions "Volume3d > 1000", "Volume3d > 2000", "Volume3d > 3000", and "Volume3d > 5000", respectively, which will be used in the individual runs.

The results of the individual runs can be distinguished by the appended values used for replacing "$".

Note:
In this case, one could have achieved the same behavior by setting "Value string" to "$" and "Value list" to
"Volume3d > 1000, Volume3d > 2000, Volume3d > 3000, Volume3d > 5000".