Skip to content

Synchronized Swept Sine Method according to Novak et al. 2015

License

Notifications You must be signed in to change notification settings

SiggiGue/syncsweptsine

Repository files navigation

Synchronized Swept Sine Method

CodeFactor Coverage Status Documentation Status

This project implements the Synchronized Swept Sine Method as a reusable python package. It is structured according to the papers by Novak et al. 2015 and Novak et al. 2010, but equations and symbol names are adapted to code conventions, also known as PEP 8. However, references to symbols and equations are given in the code comments. Most important classes are

  • SyncSweep for the generation of the synchronized swept sine singal
  • HigherHarmonicImpulseResponse for the deconvolution from sweep input and output signal.
  • HammersteinModel estimation and filtering of signals with the hammerstein model.
  • LinearModel estimation and filtering of signals with the linear kernel e.g. from a HigherHarmonicImpulseResponse

Examples are placed in the examples folder. A small example, estimating the coefficients of a nonlinear system, is listed below:

import numpy as np
from syncsweptsine import SyncSweep
from syncsweptsine import HigherHarmonicImpulseResponse
from syncsweptsine import HammersteinModel

sweep = SyncSweep(
    startfreq=16, 
    stopfreq=16000, 
    durationappr=10, 
    samplerate=96000)

def nonlinear_system(sig):
    return 1.0 * sig + 0.25 * sig**2 + 0.125 * sig**3

outsweep = nonlinear_system(np.array(sweep))

hhir = HigherHarmonicImpulseResponse.from_sweeps(
    syncsweep=sweep, 
    measuredsweep=outsweep)

hm = HammersteinModel.from_higher_harmonic_impulse_response(
    hhir=hhir, 
    length=2048, 
    orders=(1, 2, 3), 
    delay=0)

for kernel, order in zip(hm.kernels, hm.orders):
    print('Coefficient estimate:',  np.round(np.percentile(abs(kernel.frf), 95), 3), 
          'Order:', order)

prints out:

Coefficient estimate: 1.009 Order: 1
Coefficient estimate: 0.25 Order: 2
Coefficient estimate: 0.125 Order: 3

References