Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Signal lines break #22

Open
Papazola43 opened this issue Jan 12, 2022 · 0 comments
Open

Signal lines break #22

Papazola43 opened this issue Jan 12, 2022 · 0 comments

Comments

@Papazola43
Copy link

Papazola43 commented Jan 12, 2022

Untitled
And this happens more if I add filters like below:

convert list to aray

x = np.array(self.dataBuffer).T

set up mean and scaling coef

`
if self.chunk_idx == 0 or self.mean.size == 0:
self.mean = np.mean(x, axis=1).reshape(-1, 1)
x2 = copy.deepcopy(x) - self.mean

data_range = (np.max(x2, axis=1) - np.min(x2, axis=1) + 0.0000000000001).reshape(-1, 1)
self.scaling = self.channelHeight * CHANNEL_Y_FILL / data_range
self.scaling = np.clip(self.scaling, 0.05, 1e8)

`

rescaling and minus mean

x = x - self.mean x = x * self.scaling

bandpass filter

nyq = 0.5 * 1024
low = 1 / nyq
high = 50 / nyq
order = 5
b, a = signal.butter(order, [low,high], btype='band')
x = signal.filtfilt(b, a, x, axis=1)`

turn back to list

`self.dataBuffer = list(x.T)

This is the signal after filtering:
image

If there is any question regarding the issue, please feel free to ask me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant