finesse.analysis.actions.temporary module
Temporary actions allow for temporary state changes to perform some chosen set of actions with, then returning to the original state.
- class finesse.analysis.actions.temporary.Temporary(temp_action, *actions)[source]
Bases:
ActionMake the first action in a series of actions temporary, i.e. restore its parameters after the rest of the actions are complete.
- class finesse.analysis.actions.temporary.TemporaryParameters(action, *, include=None, exclude=None)[source]
Bases:
ActionAn action that will revert any changed parameters back to their values before this action was called. Options exist to include or exclude certain Parameters from this reversion. This action does not generate any Solution.
Parameters
- action
finesse.analysis.actions.base.Action Action to perform followed by reverting requested Parameters in the model
- include[iterable|str], optional
Parameters that should be included.
If a single string is given it can be a Unix file style wildcard (See
fnmatch). A value of None means everything is included.If an iterable is provided it must be a list of names or Parameter objects.
- exclude[iterable|str], optional
Parameters that should not be included.
If a single string is given it can be a Unix file style wildcard (See
fnmatch). A value of None means nothing is excluded.If an iterable is provided it must be a list of names or Parameter objects.
- action
- finesse.analysis.actions.temporary.temporary(action)[source]
Converts an action into a temporary action.
This function takes a target action, and returns an action that takes multiple actions as arguments. When the returned action is run, it will first run the target action, then all actions passed to it, then restore the changes made by the target action, e.g.
temporary(Change({'m1.phi': 10}))( Xaxis(l1.P, 'lin', 0, 10, 100) )
will first set the parameter m1.phi to 10, then run a sweep of l1.P, then restore m1.phi to its previous value.
Parameters
- actionAction
The action to make temporary.
Returns
- action
An action that temporarily applies the passed action when run.