finesse.components.electronics.ZPKFilter

Overview

class finesse.components.electronics.ZPKFilter(name, *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)

Properties

ZPKFilter.sys

The scipy sys object.

Methods

ZPKFilter.__init__(name, z, p[, k, fQ, gain])

ZPKFilter.eval(f)

Calculate the value of this filter over some frequencies.