I need to port the below python code to dart but I can't seem to find the equivalent to the signal.butter() function.
def pan_tompkins_detector(self, unfiltered_ecg, MWA_name='cumulative'):
"""
Jiapu Pan and Willis J. Tompkins.
A Real-Time QRS Detection Algorithm.
In: IEEE Transactions on Biomedical Engineering
BME-32.3 (1985), pp. 230–236.
"""
maxQRSduration = 0.150 #sec
f1 = 5/self.fs
f2 = 15/self.fs
b, a = signal.butter(1, [f1*2, f2*2], btype='bandpass')
filtered_ecg = signal.lfilter(b, a, unfiltered_ecg)
diff = np.diff(filtered_ecg)
squared = diff*diff
N = int(maxQRSduration*self.fs)
mwa = MWA_from_name(MWA_name)(squared, N)
mwa[:int(maxQRSduration*self.fs*2)] = 0
mwa_peaks = panPeakDetect(mwa, self.fs)
return mwa_peaks
This is what I already came up with:
double maxQRSduration = 0.150;
int fs = 250;
double f1 = 5/fs;
double f2 = 15/fs;
dynamic b= firwin(3, Array([f1*2, f2*2]), pass_zero: false, fs: 250);
The firwin function does not seem to do the job. Are there any other dart packages or functions that are the same as the signal.butter function in python?