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

Adding AWGN to a signal #94

Open
adeeb10abbas opened this issue Nov 23, 2020 · 5 comments
Open

Adding AWGN to a signal #94

adeeb10abbas opened this issue Nov 23, 2020 · 5 comments

Comments

@adeeb10abbas
Copy link

Adding Gaussian noise to a signal of a specific SNR. The signal may or may not have noise already

@BastienTr
Copy link
Collaborator

Hi @adeeb10abbas,

Could you be more precise on your issue. Is this a question? Do you report a bug? Do you ask for a feature?

@adeeb10abbas
Copy link
Author

Yes sorry about that. I am asking for a feature! Thanks!

@BastienTr
Copy link
Collaborator

BastienTr commented Nov 30, 2020

Did you have a look to the SISOFlatChannel class? It should do what you ask for. There are several variants possible, like using a complex signal but this snippet should be enough to start.

from commpy.channels import SISOFlatChannel
from commpy.utilities import signal_power
import numpy as np

channel = SISOFlatChannel()
noiseless_signal = np.random.choice((-1, 1), 10)  # Use your own signal here
channel.set_SNR_dB(10, Es=signal_power(noiseless_signal))  # I compute the signal power but if you know it, you can just specified the right argument
noisy_signal = channel.propagate(noiseless_signal)

Is it OK for you? If so, I let you close this issue.

@adeeb10abbas
Copy link
Author

Yes, this works but partially. I am looking for something that can add noise to a signal that already has some amount of noise.

@BastienTr
Copy link
Collaborator

Replace noiseless_signal with your already noisy signal and it's done, isn't it?

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

2 participants