0

Can somebody help me translate this code in the below method call in DIAdem to python, this is used for noise reduction in the signal data with a given cutoff frequency and other conditions

ChnFiltCalc(XW, Y, ResultChannel, FiltStruc, FiltStyle, FiltType, FiltDegree, FiltLimit, FiltLowLimit, FiltUppLimit, FiltWave, FiltSamples, FiltWndFct, FiltZeroPhase, FiltCorrection)

ChnFiltCalc("/Zeit1_IPE: Time_abs", "Lenkradwinkel", "/Lenkradwinkel_2Hz", "IIR", "Bessel", "Low pass", 2, 2, 0, 0, 1.2, 25, "Hamming", False, False)  

XW = Time_abs
Y = Signal in degree
ResultColumn = filt_2Hz
FiltStruc = IIR
FiltStyle = Bessel
FiltType = Low pass
FiltDegree = 2
FiltLimit = 2
FiltLowLimit = 0
FiltUppLimit = 0
FiltWave = 1.2
FiltSamples = 25
FiltWndFct = Hamming
FiltZeroPhase = False
FiltCorrection = False

This is for filtering signal data, using a low pass Bessel filter with hamming window and 2Hz cutoff frequency.

Have been trying out the ways already available but am not able to achieve the expected results.

import numpy as np
from scipy import signal

signal = np.array([-4.08321, -3.80345,-3.13202,-2.96416,-2.68439])
cutoff = 2
fs = 10
order = 4
nyquist = 0.5 * fs
normal_cutoff = cutoff / nyquist
b, a = signal.butter(order, normal_cutoff, 'low')
signal_filtered = signal.filtfilt(b, a, signal)

Tried the above code. The signal array has got the sample of actual values expected in it.

Output for this sample is expected to be as below , an array with values:

signal_filtered= [-1.00948,-3.04446,-3.84736,-3.32330,-2.90206]
Michael M.
  • 10,486
  • 9
  • 18
  • 34
  • you are using Butterworth filter instead of Bessel. Take look at https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.bessel.html – dankal444 Feb 07 '23 at 16:44

0 Answers0