Formula and Script - What is the Difference?
Formulas and Scripts are both useful capabilities in ProSEM, but they are quite different in their uses and implementation. This page explains the key differences, and provides some information for how to choose which tool is best for your needs.
|Execution Mode||Evaluated Internally to ProSEM||Executed in a sub-process, using a temporary replica of the active ProSEM project. Optionally, this replica can be changed and returned to the interactive ProSEM instance upon script completion|
|Location||In ProSEM's Variables panel||In ProSEM's Scripts menu|
|Result Returned||Each formula returns exactly one value, displayed in the Variables panel||Scripts do not return values, but can write data to files, plot data, display data in dialogs during script execution|
|User Interaction||No user interaction||Can interact, such as ask for user input or provide information in dialogs|
Which to use?
Use Formulas to:
- Create a new property value for each measurement, for example, to label a measurement with a design size or exposure dose or other identifying parameters. Formulas can extract these identifiers from image filenames or image metadata
- Compute new values based on stored measured values, for example, the aspect ratio of a shape, or the distance to other shapes,
Use Scripts to:
- Plot data, using the provided matplotlib plotting library
- Create a custom HTML report for a project
- Export data in a customized format
- Execute Different Recipes based on some image property