finesse.analysis.actions.series.For
¶
Overview
- class finesse.analysis.actions.series.For(param, values, *actions)[source]¶
Bases:
Action
An action changes a parameter value and runs a set of actions for each value in the array. Essentially the same as Series combined with Change. The parameter value is not reset to its original value once this action has finished.
Generates a
ForSolution
output when run.- Parameters
- paramstr|Parameter
Parameter to change in the model
- valuesarray_like
Array of values to use for the parameter
- *actionstuple(Action)
Actions to run for each parameter value.
Examples
A simple example printing some a varied laser power output.
>>> import finesse >>> model = finesse.Model() >>> model.parse(''' ... l l1 ... pd P l1.p1.o ... ''') >>> sol = model.run('for(l1.P, [0, 1, 2, 3], print(l1.P))') 0.0 W 1.0 W 2.0 W 3.0 W >>> print(sol.values) [0, 1, 2, 3]