finesse.components.electronics module

class finesse.components.electronics.Amplifier(*args, **kwargs)[source]

Bases: Connector

eval(f)[source]
fill(ws)[source]
property gain

Gain

class finesse.components.electronics.ButterFilter(*args, **kwargs)[source]

Bases: ZPKFilter

property analog[source]
property btype[source]
property frequency[source]
property gain

Gain

property order[source]
set_zpk()[source]
class finesse.components.electronics.Cheby1Filter(*args, **kwargs)[source]

Bases: ZPKFilter

property gain

Gain

class finesse.components.electronics.Filter(*args, **kwargs)[source]

Bases: Connector

This is a generic Filter element that encapsulates some of the Scipy signal filter tools. The sys attribute is the filter object which can be ZPK, BA, or SOS.

Parameters

namestr

Name of element in the model

gainParameter

Overall floating point value gain to apply to the filter.

bode_plot(f=None, n=None, return_axes=False)[source]

Plots Bode for this filter.

Parameters

foptional

Frequencies to plot for in Hz (Not radians)

nint, optional

number of points to plot

Returns

axis : Matplotlib axis for plot if return_axes=True

fill(ws)[source]
property gain

gain : Parameter Overall floating point value gain to apply to the filter.

class finesse.components.electronics.FilterWorkspace[source]

Bases: ConnectorWorkspace

class finesse.components.electronics.TestPoint(*args, **kwargs)[source]

Bases: Connector

A simple component which has an arbitrary number of test nodes that can be connected to and from.

Examples

You could make an electronic element that has three ports:

>>> from finesse.components.electronics import TestPoint
>>> model.add(TestPoint('test', 'A', 'B', 'C'))

The element is called test. This has three ports called A, B, and C, each with a single node called io, as it can be outputed to inputted to.

class finesse.components.electronics.ZPKFilter(*args, **kwargs)[source]

Bases: Filter

A zero-pole-gain filter element that is used for shaping signals in simulations. It is a two port element. p1 is the input port and p2 is the output port. Each one has a single node: p1.i and p2.o.

Parameters

namestr

Name of element in the model

zarray_like[float | Symbols]

A 1D-array of zeros. Use [] if none are required. By default these are provided in units of radians/s, not Hz.

parray_like[float | Symbols]

A 1D-array of poles. Use [] if none are required. By default these are provided in units of radians/s, not Hz.

k[float | Symbol], optional

Gain factor for the zeros and poles. If None then its value is automatically set to generate a unity gain at DC.

fQbool, optional

When True the zeros and poles can be specified in a tuple of (frequency, quality factor) for each pole and zero. This automatically adds the complex conjugate pair.

gainParameter

Overall gain for the filter. Differs from k as this is a Parameter so can be easily switched on/off or varied during a simulation.

Examples

Below are a few examples of using a ZPK filter in a simple simulation and plotting the output.

>>> import finesse
>>> finesse.init_plotting()
>>> model = finesse.Model()
>>> model.parse("""
... # Finesse always expects some optics to be present
... # so we make a laser incident on some photodiode
... l l1 P=1
... readout_dc PD l1.p1.o
... # Amplitude modulate a laser
... sgen sig l1.amp
...
... zpk ZPK_unity [] []
... link(PD.DC, ZPK_unity)
... ad unity ZPK_unity.p2.o f=fsig
...
... zpk ZPK_1 [] [-10*2*pi]
... link(PD.DC, ZPK_1)
... ad zpk1 ZPK_1.p2.o f=fsig
...
... zpk ZPK_2 [-10*2*pi] []
... link(PD.DC, ZPK_2)
... ad zpk2 ZPK_2.p2.o f=fsig
...
... # Using symbolics
... variable a 20*2*pi
... zpk ZPK_symbol [] [-1j*a, 1j*a] -1
... link(PD.DC, ZPK_symbol)
... ad symbol ZPK_symbol.p2.o f=fsig
...
... # Using gain parameter instead of k keeps the unity response at DC but
... # just flips the sign
... zpk ZPK_symbol2 [] [-1j*a, 1j*a] gain=-1
... link(PD.DC, ZPK_symbol2)
... ad symbol_gain ZPK_symbol2.p2.o f=fsig
...
... # Symbolics for an RC low pass filter
... variable R 100
... variable C 10u
... zpk ZPK_RC [] [-1/(R*C)]
... link(PD.DC, ZPK_RC)
... ad RC ZPK_RC.p2.o f=fsig
...
... fsig(1)
... """)
>>> sol = model.run("xaxis(fsig, log, 0.1, 10k, 1000)")
>>> sol.plot(log=True)
eval(f)[source]

Calculate the value of this filter over some frequencies.

Parameters

farray_like

Frequencies in units of Hz

Returns

Harray_like

Complex valued filter output

property gain

gain : Parameter Overall gain for the filter. Differs from k as this is a Parameter so can be easily switched on/off or varied during a simulation.

property sys[source]

The scipy sys object.

In this case it is a tuple of (zeros, poles, k). This does not convert any symbolics used into numerics.