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

Removing high/low frequency noise #46

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
Open

Conversation

Cosmos491
Copy link

The code does the following steps:

  1. Transform the data to the frequency domain using FFT.
  2. Apply a bandpass filter by zeroing out components outside the specified frequency range.
  3. Perform the inverse FFT to return to the time domain, giving a cleaned-up version of the data with reduced noise.

This example retains frequencies between 0.001 Hz and 0.05 Hz, effectively filtering out lower and higher frequencies. I have to adjust low_freq and high_freq based on the signal characteristics: I need to experiment with different thresholds to find suitable values for the collected data.

I have added the code which does the following:
1. Transform the data to the frequency domain using FFT.
2. Apply a bandpass filter by zeroing out components outside the specified frequency range.
3. Perform the inverse FFT to return to the time domain, giving a cleaned-up version of the data with reduced noise.
Removed the section for plotting the difference
@Cosmos491 Cosmos491 added the python python related label Nov 6, 2024
@laserlab
Copy link
Contributor

laserlab commented Nov 7, 2024

@ubsuny/cp1-24 Anyone wants to review this?

@laserlab
Copy link
Contributor

laserlab commented Nov 7, 2024

@Cosmos491 You have to resolve the merge conflicts before this can be merged as we discussed in class.

This unit test module has the following functions:
1. setUp: Generates synthetic data with a known mix of low and high-frequency components.
2. test_remove_low_frequency: Tests removing frequencies below 0.02, verifying that low frequencies are removed by checking the FFT result.
3. test_remove_high_frequency: Tests removing frequencies above 0.02, ensuring that high frequencies are removed.
4. test_full_bandpass_filter: Tests both low and high frequency filtering by setting a bandpass filter between 0.01 and 0.05.
Added a data variable for the example
@laserlab
Copy link
Contributor

laserlab commented Nov 7, 2024

Work on one single data preparation module called preparation.py that contains the following functions

Copy link
Contributor

@dhamalakamal dhamalakamal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to write these methods in the same preparation.py module file. We shouldn't make separate module files for these. Same for unit test cases as well. Please do include them in test_preparation.py module file.

noise_removal.py Outdated Show resolved Hide resolved
test_noise_removal.py Outdated Show resolved Hide resolved
@Cosmos491
Copy link
Author

@dhamalakamal I will work on them now. Thanks

added the remove noise function in the same preparation.py module
added the unit tests function to remove noise
Copy link
Contributor

@dhamalakamal dhamalakamal left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Have to be careful while merging. Might come some conflict there.

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

Successfully merging this pull request may close these issues.

3 participants