Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def lowpass_filter(channels,
- cutoff_freq=35,
- sample_rate=175,
- filter_order=7):
- """Filters channels with butterworth lowpass filter.
- Args:
- channels: list of ECG channels.
- cutoff_freq: cutoff freq in Hz used in filter, defaults to 35.
- sample_rate: sample rate of channel, defaults to 175.
- filter_order: filter order, defaults to 7.
- Returns: filtered list of channels."""
- is_dict = isinstance(channels, dict)
- if is_dict:
- filtered_channels = {}
- else:
- filtered_channels = []
- for channel in channels:
- curr_channel = channels[channel] if is_dict else channel
- filtered_channel = butter_lowpass_filter(curr_channel,
- cutoff_freq=cutoff_freq,
- sample_rate=sample_rate,
- filter_order=filter_order)
- if is_dict:
- filtered_channels[channel] = filtered_channel
- else:
- filtered_channels.append(filtered_channel)
- return filtered_channels
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement