finesse.analysis.actions.lti.FrequencyResponseSolution

Overview

class finesse.analysis.actions.lti.FrequencyResponseSolution[source]

Bases: BaseSolution

A solution from running a FrequencyResponse action on a model. This solution contains the frequency vector and potentially multiple input and output transfer function matrix.

Examples

Note that the name indexing below is only available when used with the FrequencyResponse action, the other frequency-response actions must be accessed using the out attribute.

Results from a FrequencyResponseSolution can be retrieved in two ways, first through the FrequencyResponseSolution.out array or by name using [outputs, inputs]. As an example we will create a fake solution:

>>> from finesse.analysis.actions.lti import FrequencyResponseSolution
>>> sol = FrequencyResponseSolution("name")
>>> sol.inputs = ("A", "B", "C")
>>> sol.outputs = ("D", "E", "F", "G")
>>> sol.out = np.random.rand(3, len(sol.outputs), len(sol.inputs))

The names will map to those provided in the FrequencyResponse action you called to generate the solution.

The following will work to select single transfer functions between some input and output by name: >>> sol[“D”, “A”] # Select A -> D >>> sol[“D”, “C”] # Select C -> D >>> sol[“F”, “C”] # Select C -> F

Transfer function matrices can be extracted by providing multiple >>> sol[“F”, (“C”, “A”)] >>> sol[(“F”, “G”), (“C”, “A”)]

Slicing can also be used: >>> sol[“D”, :] # Select all inputs to “D” >>> sol[“D”, ::2] # Select every other input to “D” >>> sol[:, “B”] # Select “B” to all outputs >>> sol[1:, “B”] # Select “B” to all but the first output

Attributes
farray_like

Frequency vector [Hz]

inputsarray_like

The input names injected into for this analysis

outputsarray_like

The output names read out for this analysis

outarrray_like[dtype=np.complex128]

A matrix of transfer functions for each input to every output over the array of frequencies requested. Depending on which frequency response action was run will decide what shape this output matrix actually is. The shape of out is dependent on the analysis done:

  • FrequencyResponse - (N_f, N_outputs, N_inputs)

  • FrequencyResponse2 - (N_f, N_outputs, N_inputs, N_hom)

  • FrequencyResponse3 - (N_f, N_outputs, N_inputs, N_hom, N_hom)

  • FrequencyResponse4 - (N_f, N_outputs, N_inputs, N_hom)

typetype

Type of FrequencyResponse that was used to generate this solution

Methods

FrequencyResponseSolution.outputs_inputs_indices(...)

Returns the indices to use for selecting certain inputs and outputs from the out attribute of this solution object.

FrequencyResponseSolution.plot_inputs(*inputs)

Plot all transfer functions on a NxM grid with a max_width.

FrequencyResponseSolution.plot_outputs(*outputs)

Plot all transfer functions on a NxM grid with a max_width.