finesse.analysis.actions.series module

Serial Action.

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.

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]

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.

class finesse.analysis.actions.series.ForSolution[source]

Bases: BaseSolution

Solution generated by a For Action.

Attributes

parameterobject | str

Model parameter that was varied by the For action

valuesarray_like

Array of values that were iterated over

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]
class finesse.analysis.actions.series.Series(*actions, flatten=True, name=None)[source]

Bases: Action

A sequential series of actions to apply during a simulation.

Parameters

actionsAction

A collection of Actions to run in series

flattenbool

When True, each action will be stored in the top level of the solution tree. When False, each action will be a child of the previous solution generated.

namestr

Optional name for the solution generated by these actions

class finesse.analysis.actions.series.SeriesSolution[source]

Bases: BaseSolution

SeriesSolution is a solution object that contains the results from running the requested actions by a Series. You can see what solutions are contained by printing this object or by inspecting the children attribute.