finesse.analysis.actions.base module
Base level Actions utilities and classes.
- class finesse.analysis.actions.base.Action(name, analysis_state_manager=False)[source]
Bases:
objectBase class for all actions
- class finesse.analysis.actions.base.AnalysisState(model, name='AnalysisState', parent=None, simulation_type=None, simulation_options=None)[source]
Bases:
TreeNode- property action_workspaces[source]
Actions can use themselves, self, as a key to store simulation specific data and reuse it each time run is called.
Use a
weakref.WeakKeyDictionaryrather than a plaindictbecause a plaindictusing id(self) as a key would:leak an entry for every transient action for the lifetime of this state
allow a new action to have the same key as a stale one thus having the new action try to use the stale actions workspace
- set_parameter_values(parameter_values: Mapping[Parameter, float | Symbol]) None[source]
Change a collection of parameter values and recalculates the ABCD matrices if necessary. To be used inside actions which temporarily adjust parameter values, but are meant to leave the model in the same state as before the action.
This code used to be copy-pasted in different places of Finesse. At the time of writing we are not sure whether it is always necessary to call this function when you are changing parameters inside of an action (calling
finesse.simulations.simulation.BaseSimulation.run_carrier()probably has the same effect), or whether this only necessary as a ‘clean-up’ at the end of an action.Parameters
- parameter_valuesdict[Parameter, float | Symbol]
Parameters and the value they need to be set to
- finesse.analysis.actions.base.convert_str_to_parameter(model, attr)[source]
Converts names component.parameter or component to a parameter object. Will return default parameter when component name is given.
Parameters
- modelModel
Model object to look for parameter in
- attr[str | Parameter]
String value for the name of an element or a parameters full name. If a Parameter is given its full name will be used to grab the equivalent parameter in this Model.
Returns
- parameter
The equivalent Parameter object for the attr provided