'(Python) How to design a passband filter from a graph

I was wondering if someone would be able to explain how to design a passband filter (Butterworth specifically) for an ECG given a lead plot for the ECG. The current code that I'm working with is as followed:

screenshot of how the published code looks

And I was wondering how I would be able to reproduce the same data with a passband filter applied, along with how to adjust the sampling rate. Any help is appreciated. Thanks.

import scipy.io as sio
from matplotlib import pyplot as plt
from os.path import dirname, join as pjoin
mat_fname = pjoin('A00X.mat')
# based on the assigned list for the class, choose the number of your own patient here.
patient_number = X
# it seems lead 9 (as a single channel) is easier to analyze
ECG_lead = 9
# load the "mat" file into our Python
datapass = './Data'
if patient_number < 10:
    patient_name = 'A000' + str(patient_number)
else:
    patient_name = 'A00' + str(patient_number)
filename = patient_name + '.mat'
mat_fname = pjoin('A00X.mat')
mat_contents = sio.loadmat(mat_fname)
val = mat_contents['val']
# these are the names of ECG leads 
ECG_lead_names = ['I','II','III','aVR','aVL','aVF','V1','V2','V3','V4','V5','V6']
# plot your ECG for the first 2000 points (samples)
plt.plot(val[ECG_lead][0:2000])
plt.title('Patient X ECG')
plt.xlabel('Samples')
plt.ylabel('mv')
#plt.ylim([-200,200])
plt.show()


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source