kontrol.complementary_filter¶
Primary modules¶
kontrol.complementary_filter.complementary_filter¶
Complementary filter class for sythesis

class
kontrol.complementary_filter.complementary_filter.
ComplementaryFilter
(noise1=None, noise2=None, weight1=None, weight2=None, filter1=None, filter2=None, f=None)¶ Bases:
object
Complementary filter synthesis class.
Parameters:  noise1 (TransferFunction) – Sensor noise 1 transfer function model. A transfer function that has magnitude response matching the amplitude spectral density of noise 1.
 noise2 (TransferFunction) – Sensor noise 2 transfer function model. A transfer function that has magnitude response matching the amplitude spectral density of noise 2.
 weight1 (TransferFunction, optional) – Weighting function 1. Frequency dependent specification for noise 1. Defaults None.
 weight2 (TransferFunction, optional) – Weighting function 2. Frequency dependent specification for noise 2. Defaults None.
 filter1 (TransferFunction, optional) – The complementary filter for noise 1. Defaults None.
 filter2 (TransferFunction, optional) – The complementary filter for noise 2. Defaults None.
 f (array, optional) – The frequency axis in Hz for evaluating the super sensor noise. Defaults None.

h2synthesis
()¶ Complementary filter synthesis that minimizes the \(\mathcal{H}_2\)norm of the super sensor noise. The noise must be specified before using this method.

hinfsynthesis
()¶ Complementary filter synthesis that minimizes the \(\mathcal{H}_\infty\)norm of the super sensor noise. The noise must be specified before using this method.
Notes
This is a utility class for complementary filter synthesis, sensor noise estimation and analysis. To use synthesis methods, specify
noise1
andnoise2
as the transfer function models for the sensor noises, and specifyweight1
andweight2
as the frequencydependent specifications for the two sensor noises.References
[1] T. T. L. Tsang, T. G. F. Li, T. Dehaeze, C. Collette. Optimal Sensor Fusion Method for Active Vibration Isolation Systems in GroundBased GravitationalWave Detectors. https://arxiv.org/pdf/2111.14355.pdf 
f
¶ The frequency axis in Hz.

filter1
¶ First complementary filter.

filter2
¶ Second complementary filter.

h2synthesis
(clean_filter=True, **kwargs) Synthesize complementary filters using H2 synthesis.
Returns:  filter1 (TransferFunction) – The complementary filter filtering noise 1.
 filter2 (TransferFunction) – The complementary filter filtering noise 2.
 clean_filter (boolean, optional) – Remove small outlier coefficients from filters. Defaults True.
 **kwargs – Keyword arguments passed to kontrol.TransferFunction.clean()

hinfsynthesis
(clean_filter=True, **kwargs) Synthesize complementary filters using Hinifinity synthesis.
Returns:  filter1 (TransferFunction) – The complementary filter filtering noise 1.
 filter2 (TransferFunction) – The complementary filter filtering noise 2.
 clean_filter (boolean, optional) – Remove small outlier coefficients from filters. Defaults True.
 **kwargs – Keyword arguments passed to kontrol.TransferFunction.clean()

noise1
¶ Transfer function model of sensor noise 1.

noise2
¶ Transfer function model of sensor noise 2.

noise_super
(f=None, noise1=None, noise2=None, filter1=None, filter2=None)¶ Compute and return predicted the ASD of the super sensor noise
 f : array, optional
 The frequency axis in Hz. Use self.f if None. Defaults None.
 noise1 : array, optional
 The amplitude spectral density of noise 1. Use self.noise1 and self.f to estimate if None. Defaults None.
 noise2 : array, optional
 The amplitude spectral density of noise 2. Use self.noise1 and self.f to estimate if None. Defaults None.
 filter1 : TransferFunction, optional
 The complementary filter for filtering noise1 Use self.filter1 if not specified. Defaults None
 filter2 : TransferFunction, optional
 The complementary filter for filtering noise1 Use self.filter2 if not specified. Defaults None
Returns: The amplitude spectral density of the super sensor noise. Return type: array
Secondary modules¶
kontrol.complementary_filter.predefined¶
Some predefined complementary filters

kontrol.complementary_filter.predefined.
generalized_sekiguchi
(fb, order_low_pass, order_high_pass)¶ Generalized Sekiguchi Filter
Parameters:  fb (float) – Blending frequency in Hz.
 order_low_pass (int) – Order of rolloff of the lowpass filter
 order_high_pass (int) – Order of rolloff of the highpass filter
Returns:  lpf (kontrol.TransferFunction) – The lowpass filter
 hpf (kontrol.TransferFunction) – The highpass filter

kontrol.complementary_filter.predefined.
lucia
(coefs)¶ Lucia Trozzo’s complementary filter
Parameters: coefs (list of float or numpy.ndarray of floats) – Takes 7 parameters, in specification order: \(p_1\), \(p_ 2\), \(z_1\), \(w_1\), \(q_1\), \(w_2\), \(q_2\) . See notes for the meaning of the parameters. Returns:  lpf (control.xferfcn.TransferFunction) – Complementary lowpass filter
 hpf (control.xferfcn.Transferfunction) – Complementary highpass filter
Notes
The modified Sekiguchi complemetary filter is structured as:
\[H = K\frac{s^3(s+z_1)(s^2+w_1/q_1\,s+w_1^2)(s^2+w_2/q_2\,s+w_2^2)} {(s+p_1)^5(s+p_2)^3}\]where \(K\) is a constant normalizing the filter at high frequency.

kontrol.complementary_filter.predefined.
modified_sekiguchi
(coefs)¶ Modified Sekiguchi Filter with guaranteed 4thorder highpass.
Parameters: coefs (list of (int or float) or numpy.ndarray) – 4 coefficients defining the modified Sekiguchi filter. Returns:  lpf (control.xferfcn.TransferFunction) – Complementary lowpass filter
 hpf (control.xferfcn.Transferfunction) – Complementary highpass filter
Notes
The modified Sekiguchi complemetary filter is structured as:
\[H = \frac{s^7 + 7a_1s^6 + 21a_2^2s^5 + 35a_3^3s^4}{(s+a_4)^7}\]where \(a_1\), \(a_2\), \(a_3\), \(a_4\) are some parameters that defines the filter.

kontrol.complementary_filter.predefined.
sekiguchi
(coefs)¶ 4thorder complementary filters specified by the blending frequencies.
Parameters: coefs (float) – Blending frequency of the filter in [rad/s] Returns:  lpf (control.xferfcn.TransferFunction) – Complementary low passfilter
 hpf (control.xferfcn.Transferfunction) – Complementary high passfilter
Notes
4thorder complemetary filter used in Sekiguchi’s thesis [1]_ whose highpass is structured as:
\[H = \frac{s^7 + 7w_bs^6 + 21w_b^2s^5 + 35w_b^3s^4}{(s+w_b)^7}\]where \(w_b\) is the blending frequency in [rad/s].
References
[1] T. Sekiguchi, A Study of Low Frequency Vibration Isolation System for Large Scale Gravitational Wave Detectors
kontrol.complementary_filter.synthesis¶
Filter synthesis functions.

kontrol.complementary_filter.synthesis.
generalized_plant
(noise1, noise2, weight1, weight2)¶ Return the generalized plant of a 2 complementary filter system
Parameters:  noise1 (TransferFunction) – Sensor noise 1 transfer function model. A transfer function that has magnitude response matching the amplitude spectral density of noise 1.
 noise2 (TransferFunction) – Sensor noise 2 transfer function model. A transfer function that has magnitude response matching the amplitude spectral density of noise 2.
 weight1 (TransferFunction) – Weighting function 1. Frequency dependent specification for noise 1.
 weight2 (TransferFunction) – Weighting function 2. Frequency dependent specification for noise 2.
Returns: The plant.
Return type: control.xferfcn.TransferFunction

kontrol.complementary_filter.synthesis.
h2complementary
(noise1, noise2, weight1=None, weight2=None)¶ H2 optimal complementary filter synthesis
Parameters:  noise1 (TransferFunction) – Sensor noise 1 transfer function model. A transfer function that has magnitude response matching the amplitude spectral density of noise 1.
 noise2 (TransferFunction) – Sensor noise 2 transfer function model. A transfer function that has magnitude response matching the amplitude spectral density of noise 2.
 weight1 (TransferFunction, optional) – Weighting function 1. Frequency dependent specification for noise 1. Defaults None.
 weight2 (TransferFunction, optional) – Weighting function 2. Frequency dependent specification for noise 2.
Returns:  filter1 (TransferFunction) – The complementary filter filtering noise1.
 filter2 (TransferFunction) – The complementary filter filtering noise2.
Notes
This function ultilizes control.robust.h2syn() which depends on the slycot module. If you are using under a conda virtual environment, the slycot module can be installed easily from condaforge. Using pip to install slycot is a bit more involved (I have yet to suceed installing slycot in my Windows machine). Please refer to the pythoncontrol package for further instructions.
It is possible that h2syn yields no solution for some tricky noise profiles . Try adjusting the noise profiles at some irrelevant frequencies.
Thomas Dehaeze [1]_ had the idea first so credits goes to him. (Properly cite when the paper is published.)
References
[1] Dehaeze, T. https://tdehaeze.github.io/dehaeze20_optim_robus_compl_filte/matlab/index.html [2] T. T. L. Tsang, T. G. F. Li, T. Dehaeze, C. Collette. Optimal Sensor Fusion Method for Active Vibration Isolation Systems in GroundBased GravitationalWave Detectors. https://arxiv.org/pdf/2111.14355.pdf

kontrol.complementary_filter.synthesis.
hinfcomplementary
(noise1, noise2, weight1=None, weight2=None)¶ Hinfinity optimal complementary filter synthesis
Parameters:  noise1 (TransferFunction) – Sensor noise 1 transfer function model. A transfer function that has magnitude response matching the amplitude spectral density of noise 1.
 noise2 (TransferFunction) – Sensor noise 2 transfer function model. A transfer function that has magnitude response matching the amplitude spectral density of noise 2.
 weight1 (TransferFunction, optional) – Weighting function 1. Frequency dependent specification for noise 1. Defaults None.
 weight2 (TransferFunction, optional) – Weighting function 2. Frequency dependent specification for noise 2.
Returns:  filter1 (TransferFunction) – The complementary filter filtering noise1.
 filter2 (TransferFunction) – The complementary filter filtering noise2.
Notes
This function ultilizes control.robust.hinfsyn() which depends on the slycot module. If you are using under a conda virtual environment, the slycot module can be installed easily from condaforge. Using pip to install slycot is a bit more involved (I have yet to suceed installing slycot in my Windows machine). Please refer to the pythoncontrol package for further instructions.
Thomas Dehaeze [1]_ had the idea first so credits goes to him. (Properly cite when the paper is published.)
References
[1] Dehaeze, T. https://tdehaeze.github.io/dehaeze20_optim_robus_compl_filte/matlab/index.html [2] T. T. L. Tsang, T. G. F. Li, T. Dehaeze, C. Collette. Optimal Sensor Fusion Method for Active Vibration Isolation Systems in GroundBased GravitationalWave Detectors. https://arxiv.org/pdf/2111.14355.pdf