Denoising Data with FFT [Python]

Поделиться
HTML-код
  • Опубликовано: 19 окт 2024

Комментарии • 259

  • @somethingironic2227
    @somethingironic2227 3 года назад +17

    the way this video is setup, overlaying him, the code and a whiteboard, is really slick

  • @adityams1659
    @adityams1659 4 года назад +270

    Dude this guy is crazy, I still cant believe these videos are free.Thank You for making it free means a lot.❤️

    • @josephtran1500
      @josephtran1500 3 года назад

      I havent even watched the video yet and I can tell Im on for a ride. The content looks so good.

    • @payman_azari
      @payman_azari 2 года назад

      I can't even believe these videos are made

  • @jerickandrerodriguezmotta6809
    @jerickandrerodriguezmotta6809 3 года назад +16

    I've spent many hours trying to apply FFT to my data and I've finally done it with your amazing explanation. For sure, the best Fourier Transform video.

  • @pipertripp
    @pipertripp 3 года назад +15

    Pure gold. Fourier analysis still feels a bit like voodoo to me as I'm just learning the basics, and your videos have been very helpful. The python examples are really handy. Thanks for taking the time to do these things in both MatLab and Python.

  • @felicemorgigi1764
    @felicemorgigi1764 3 года назад +1

    People like you make the world a better place. Free education helps everybody in the end. Thank you.

  • @Via.Dolorosa
    @Via.Dolorosa 4 года назад +19

    Hi Steve, I watched many of your videos in Control the comments there are disable so I took this opportunity just to say thank you

  • @m.espejo
    @m.espejo 3 года назад +3

    This has been very useful for me. I am a Mechanical Engineer and I am working in dynamic studies of steel structures. This method is very practical to apply to the acquisition of accelerometer data in dynamic tests. Thank you so much Steve!!!

  • @abemartin2002
    @abemartin2002 4 года назад +19

    Professor Brunton, I love all your videos.

  • @TNTsundar
    @TNTsundar 3 года назад +1

    Brilliant. Just brilliant. The quality of this lecture is off the charts.

  • @andrerangel7654
    @andrerangel7654 2 года назад

    Steve Brunton, I may never meet you in person but you helped me a lot with these videos. I wish you a good health and a prosper life.

  • @bArda26
    @bArda26 Месяц назад

    I was watching you when I was in college for controls, life has brought us back together lol

  • @paulsenn1281
    @paulsenn1281 6 месяцев назад

    this is mind-boggling-ly useful! (written after hours of scrolling in vain attempting to understand both the transform itself and the code that implements it .) Thank you!

  • @HarrierBr
    @HarrierBr 3 года назад +2

    Very good explanation. GG for the backwards writing, REALLY nice.

  • @babaksanaee1460
    @babaksanaee1460 3 года назад +1

    This is so excellent. Absolutely the best, and most comprehensive video regarding real world FFT on youtube. Probably going to buy your book now. Thanks a lot!

  • @jinbobian1613
    @jinbobian1613 3 года назад +1

    Thanks very much! This really helps students who are struggling with denoising.

  • @hfkssadfrew
    @hfkssadfrew 4 года назад +2

    Very nice video professor Brunton. I think the idea behind is FOurier transform of white noise is a constant depending its amplitude. So for large signal-to-noise ratio , you will see a plateu + the real signal, then picking those peaks will work.

  • @saitaro
    @saitaro 4 года назад +7

    super-duper, as always. Python examples are what we need!

  • @doneel.5338
    @doneel.5338 2 года назад +1

    This is amazing! I am finally getting rid of the feeling that the topic is complicated thanks for these videos! I mean it is, but I also am capable of getting it with your explanation.

  • @umedina98
    @umedina98 Год назад +1

    Your videos are crystal clear! I cant thank enough for sharing this high quality content. Loved the approach you took of writing parallel to the code!

  • @goodlack9093
    @goodlack9093 Год назад

    one of the best channels I could've ever stumbled upon...immediately subscribed😅

  • @afghanexperts7815
    @afghanexperts7815 3 года назад +1

    One of the best explanation I have ever seen ❤️❤️

  • @kivancthewalrus
    @kivancthewalrus 3 года назад +3

    You forgot to multiply your np.fft.fft(...) output by dt. np.fft module assumes the sampling spacing is 1. So we have to fix for this if we have a different sampling spacing. Also, you don't have to give n as the second argument of your np.fft.fft because n is also the length of your signal, so it's effectless.

  • @JosephRajewskiWIII
    @JosephRajewskiWIII 4 года назад +3

    I had Steven Brunton as a professor at University of Washington in Applied Mathematics, and he was excellent. So glad I just stumbled upon his channel. It looks really good. Will be tuning in! I am hoping you will do a video on linear programming and optimization; I have a problem at work I want to apply this to. :)

    • @Eigensteve
      @Eigensteve  4 года назад +2

      Awesome, thanks Joe! I have some optimization videos in the works, so stay tuned!

  • @tedgerhardt2619
    @tedgerhardt2619 6 месяцев назад

    Thanks for such great videos! Been following you for years and I’ve learned so much and am truly inspired by your work. Just ordered the book and am excited to apply!

  • @giovanniiacobello2866
    @giovanniiacobello2866 4 года назад +8

    Thank you very much Prof. Brunton for the interesting video! It is amazing this way of making videos. Which software and devices do you use for that? Is that a glass board? or something similar?

    • @Eigensteve
      @Eigensteve  4 года назад +4

      Yes, a glass board

    • @DougWoodrow
      @DougWoodrow 2 года назад

      @@Eigensteve and yet the writing isn't back-to-front... clever! 🤔

  • @hardeepsingh68
    @hardeepsingh68 Год назад

    Beautifully explained ! Wonderful to learn from Steve !!

  • @Akshay-cy9tu
    @Akshay-cy9tu 3 года назад

    just in love with the way u teach concepts

  • @shillowcollins6392
    @shillowcollins6392 10 месяцев назад

    Wow, I am super impressed, why didn't I find this channel early. Thanks so much for sharing this valuable information.

  • @ElCanalMeu
    @ElCanalMeu 3 года назад +2

    Hello Steve, I just wanted to say thank you. It's been really helpful.

  • @yashodhanvivek8086
    @yashodhanvivek8086 3 года назад

    Amazing Prof. Brunton. These videos are extremely helpful for DPS researchers

  • @NowanIlfideme
    @NowanIlfideme 4 года назад +2

    I gotta say, watching these and re-remembering uni courses has been quite a blast. Thanks for your lectures!
    Also, what exactly do you use to make these videos? I assume you write on glass and then flip the video? It always turns out surprisingly clean, with the screen projection as well...

    • @Eigensteve
      @Eigensteve  4 года назад +1

      Thanks! Yep, glass and flip.

  • @sennabullet
    @sennabullet 3 года назад +1

    A fantastic video with great informational content...and mindblowing production!!! How do you do all the overlays???

  • @彭九方
    @彭九方 3 года назад +2

    Thanks a lot again Prof! Just wanted to mention that, when calculating the power spectrum (PSD), the data type of the production result of complex number with its conjugate is actually: complex with 0j (Python3)

  • @larcomj
    @larcomj Год назад

    Great application of the convolution theorem. Well explained.

  • @monh964
    @monh964 4 года назад

    I told my self lets see what this guy is talking about...
    Realized I discovered a wizard. I will have to see all your videos. I always was afraid from fft. Thank you for simplifying it. Thanks again.

  • @Ting3624
    @Ting3624 4 года назад +9

    thank you for the education kind sir!
    math + code example is a great idea

  • @MandarPatkar_html_addict
    @MandarPatkar_html_addict 2 года назад

    Thanks much Prof Brunton! This is gold.

  • @L2.Lagrange
    @L2.Lagrange Год назад

    Very helpful content. I have used MATLAB but not python. I want to use FFT and some basic signal processing techniques to learn how to use python, so these videos are very helpful

  • @shahriarhabibi8382
    @shahriarhabibi8382 7 месяцев назад +1

    The magnitudes of the signals with 50 and 120 Hz depends on the random numbers that you generate at the beginning of the code. I had this problem that my magnitudes where different from those presented in this video.

  • @TungNguyen-gx1fy
    @TungNguyen-gx1fy 2 года назад +1

    Take note: f is the noisy data
    1. f_hat = FFT(f)
    - f_hat is a vector of complex Fourier coefficients (increasing frequency: low to high) with its magnitude.
    2. PSD = |f_hat|
    - vector of real magnitude (power) for each frequency.
    3. Filter: on PSD, keep the power > Threshold, and set 0 to the rest (because they are the noise frequency) and we have new f_hat.
    4. f_denoised = iFFT(new f_hat)

  • @ilAnfoosh
    @ilAnfoosh 2 года назад

    Thanks for showing us how useful is learning Math!! Amazing!!

  • @surajyergude
    @surajyergude 4 года назад

    Your lecture gives insight to the content what is in there books.

  • @frankkoslowski6917
    @frankkoslowski6917 Год назад +1

    Love your presentation.
    Interesting though that you got your code to work without errors.
    Casting complex values to floats ist verboten! 😏 Here's how it should be for the graphs to display without error:
    plt.plot(freq[L], np.absolute(PSD[L]), color='c', lw=2, label='Noisy')
    However,
    this does not solve the problem at it's root, because the Boolean return for a complex like `PSD` referenced to and integer as in:
    indices = PSD > 100 does only return a Boolean array filled with `False`, unless np.absolute(PSD) gets implemented.
    The best place to do this without undue repetition throughout the code is where the problem starts.
    Here we see the amendment that forces absolutes and brings all the trouble caused by attempting to handle complex values like floats to an end:
    PSD = np.absolute(fhat * np.conj(fhat) / n) # Power Spectrum Density (power of FFT)
    However,
    the error finds itself repeated in the last set of plots with the `Inverse FFT for filtered time signal` and is best corrected like this:
    ffilt = np.absolute(np.fft.ifft(fhat)) # Inverse FFT for filtered time signal 😉
    All in all, a very clear and understandable `toy example`. 💚

  • @jacobanderson5693
    @jacobanderson5693 4 года назад +9

    Would you consider doing a lecture on FFT in the context of NMR/Xray Crystallography/electron microscopy. Especially "Fourier Filtering"

    • @Eigensteve
      @Eigensteve  4 года назад +12

      Cool idea -- i'll add it to the list :)

  • @dom996
    @dom996 3 года назад

    Thank you very much Prof. Brunton for the interesting video!

  • @Michallote
    @Michallote 10 месяцев назад

    For those wondering how to filter non stationary series, you can use overlapping windows to perform the same process per window then blend the signals in the overlapping regions

  • @azzouguenachour909
    @azzouguenachour909 7 месяцев назад

    Many many thanks professors this was very clear.

  • @afsinyilmaz8665
    @afsinyilmaz8665 3 года назад

    Effective! Your amplitude at per unit time teaching is above threshold.

  • @tatianaazarchenko7066
    @tatianaazarchenko7066 3 года назад

    Thank you a lot, Steve! Your lectures are absolutely amazing and extremely helpful!!

  • @matiaharonyan5218
    @matiaharonyan5218 3 года назад +1

    Steve, you are amazing. Thank you a 1000 times.

    • @Eigensteve
      @Eigensteve  3 года назад

      You are so very welcome!

  • @Asparuh.Emilov
    @Asparuh.Emilov 2 года назад

    This is one of the best videos on how to apply FFT in Python!!! Thank you so much! Is it possible to make a video with Time Series data denoising? And could be applied directly on the original Time Series Data Or first we should obtain the difference on 1st grade?

  • @robertschofield9838
    @robertschofield9838 3 года назад

    Thanks for contributing! Exactly what I was looking for.

  • @Barasuisyou19
    @Barasuisyou19 3 года назад

    Thank you very much for this amazing video! I was struggling to understand this, but you made it look easy.

  • @arkie3703
    @arkie3703 4 месяца назад

    Love your videos, I have a question tho. In the previous video Proffesor Brunton talked about how efficient the FFT was when our n was a power of 2. If I understand it correctly, here n = 1000? Why wouldnt we want n to be 1024?

  • @inchae5279
    @inchae5279 Год назад +1

    Thank you for making this video.
    I have one question with making a threshold,
    the threshold that you made, is subjective i thought.
    Is there any non-subjective threshold method?
    I mean, defined threshold to 100 isn't any valid reason..
    (Sorry for my english)

  • @nischalsehrawat2130
    @nischalsehrawat2130 4 года назад +10

    Hi Steve, I have a doubt. If we run a Kalman filter on this data, can the filter distort / change the frequency content of the signal? I tried to run a Kalman filter and sometimes I get funny results. I am not able to understand what might be going wrong. Can you please help?
    Thanks

    • @Eigensteve
      @Eigensteve  4 года назад +11

      That is a really good question. Yes, in general, filtering algorithms will change the spectrum of the signal, sometimes quite significantly. There is a lot of work in designing filters that have certain nice properties. For example, if we run a simple low-pass filter over the data, it will mess up the phase information in the signal (because there will be a small delay). So the 2nd order Butterworth filter is often used to prevent this phase corruption. Sometimes people also use the "filtfilt" function, which runs a forward and a backward pass of the filter to get rid of the phase delay. So long way of saying that yes, this is a real concern and it is not always easy to filter and preserve frequency content. But, remember, often when you filter, your goal is to modify the frequency content, for example to remove high-frequency noise. So there is no "silver bullet" for filtering.

    • @Daniel88santos
      @Daniel88santos 4 года назад

      @@Eigensteve I'm using the filtfilt in sensor live data and that technic doesn't work for live data since I'm seeing a kind of "repaint" after I receive the last point on the data received previously. Let's say that I have 50 points ... when I receive the point 51 what was calculated on the previous 50 points will change when I receive this last point, so the filtfilt technic doesn't work well on the last point received. Another issue is when I compare the live output of my Butterworth filter to filtfilt output they are exactly the same on the last received data, meaning that the delay is there on the last point received, the delay is only taken away for that particular "event"(Let's point 50) when we receive more data( >=51 points). Can you advise me any technic that allow me to filter data in live stream having no or very few delay? My data is not periodic, I think that for example the FFT is not an option. Thanks you.

    • @romanvereb7144
      @romanvereb7144 4 года назад

      @@Daniel88santos Applying FFT on live data sets, the size of which are not power-of-2? And then you're also filtering and inverse-transforming? Brave, yet interesting. My own power-of-2-cents would be... Don't allow the dataset to be sized dynamically. Keep a fixed size and let the live data "roll" through it. Make sure the size of this dataset is something like 64 instead of 50 or 51. Zero-pad if you must. If none of what I just advised made any sense to you, you may have to do a bit more research. Fourier Analysis and noise filtering is not a subject mastered with a few youtube videos.

    • @Daniel88santos
      @Daniel88santos 4 года назад

      @@romanvereb7144 thanks by you reply, I've figure out how to do it with any size of points, and not using zero padding ... but I cannot comment on it, since is proprietary technology.

    • @romanvereb7144
      @romanvereb7144 4 года назад

      ​@@Daniel88santos Such is the way of the world... One learns without giving back. A seed planted, but no longer spread.

  • @rafaelcardoso270
    @rafaelcardoso270 3 года назад

    You are awesome, dude. Thanks a lot. I wish I had a professor like you at the college.

  • @kubumshel
    @kubumshel Год назад

    This lecture is very clean and precise. But I need to do this in matlab and I am really getting confused on how to implement the index vector and multiplying it from the noisy signal

  • @Maria-mt2rz
    @Maria-mt2rz 4 года назад +1

    This video is adorably stylish!

  • @jean-francoisnoel9577
    @jean-francoisnoel9577 6 месяцев назад

    Thank you very much for your amazing videos, but what about averaging to remove the Gaussian noise? (if the recordoing is long enough to perform several FFTs of course) It feels like a better method to remove noise since it can show information hidden below the noise floor that would otherwise be removed with the truncation method.

  • @rajinfootonchuriquen
    @rajinfootonchuriquen Год назад

    Thanks Steve for your knowledge.

  • @nhatson2265
    @nhatson2265 3 года назад +1

    This work really helps, Sir!
    Thank you for your videos

  • @fastlab8506
    @fastlab8506 3 года назад +1

    thanks for great explanation! You guys are doing it on a different level :)

  • @nightlyowll
    @nightlyowll 2 года назад

    This video is amazing.. Just to the point !! I'm speechless on how good the video is.. ❤

  • @Greg-ld4tr
    @Greg-ld4tr Год назад

    Thank you for the enlightening video. In order to calculate the PSD you have to use the prefactor 2/n**2, i.e. PSD = 2 * fhat * np.conj(fhat) /n**2, right?

  • @code2compass
    @code2compass 6 месяцев назад +1

    Every body's a gangsta until a man with glasses enters the room and explains fft

  • @robv3872
    @robv3872 3 года назад

    what a great instructor! Thanks!

  • @otaviocarvalho1140
    @otaviocarvalho1140 3 года назад +1

    Thank you teacher for the awesome explanation!

  • @DiverselyArtistic
    @DiverselyArtistic 3 года назад +1

    Thank you so much sir ,i was really confused before this video

  • @stijndeboer3721
    @stijndeboer3721 4 года назад +2

    Thanks for your videos Steve.

  • @nitinupadhyay9193
    @nitinupadhyay9193 3 года назад

    i liked and subscribed before even starting the video.. i knew it was going to be great!

  • @artsyengineer2086
    @artsyengineer2086 4 года назад +1

    Hi Steve, thanks for the nice and helpful video! One thing though, I was wondering if there is a "standard" way of choosing a filter value? Is your case of two "peaks" a good rule of thumb?

    • @HackionSTx
      @HackionSTx 2 года назад

      I'm not an expert so please don't take this as an absolute truth.
      I'd look at the graph first (or have so metrics, depending on the type of data) and see if we get only few very high peaks or something more regular.
      In the first case you'd probably have a lot of liberty if you wanted only the big peaks. In the second case I'd probably start being conservative and get some noise in the result if it means I'd get everything I wanted from the data. But depending on what I'd be working on I'd begin increasing the threshold until the data starts losing too much.

  • @goodlack9093
    @goodlack9093 Год назад

    thank you very much, you're a really good teacher!!

  • @harisgulzar4605
    @harisgulzar4605 4 года назад

    Wow great content. Python example just boosted my interest in signals processing by many folds. Thanks a lot Mr. Steve, I really wish to see your behind the scene setup by the way :p

  • @arturfoden7139
    @arturfoden7139 Год назад

    Thank you for the clean explanation

  • @supervince110
    @supervince110 2 года назад

    These video series are worth more than the courses you spend thousands of dollars in a university

  • @psheep8206
    @psheep8206 3 года назад

    Thanks Steve, great footage! Any chance to extend this series with a explainer on how to detrend a periodic signal in 2D data?

  • @cygtrafolia1007
    @cygtrafolia1007 3 месяца назад

    epic lighting. subscribed.

  • @berkceyhan5031
    @berkceyhan5031 2 года назад

    First I liked, then I watched. Amazing!

  • @unikerl95
    @unikerl95 2 года назад

    Thanks for the nice Video. Ive got a small question. The decision where we make our threshold is made by the frequency-psd plot. Before we neglect the entry with the frequency of zero. Can this have an impact?

  • @jacobthomas939
    @jacobthomas939 4 года назад +3

    Agreed. A wealth of knowledge.

  • @arnoldsu
    @arnoldsu 2 года назад

    Thanks for the explain, it is very details and easy to understand. One question, how can we demonstrate/apply the 95% significant test onto the plot? Thanks!

  • @EW-mb1ih
    @EW-mb1ih 3 года назад +1

    To go further, it would be interesting to have a method to determine the threshold for PSD that we keep. In your case, it’s obvious that there are only two frequencies but what kind of methodology will you recommand if there no clear contrast between noise and real
    Frequency ( would a simple
    Normal t’est be sufficient?)?

  • @XwitterEye
    @XwitterEye 3 года назад

    damn the video quality is amazing here. got a sub

  • @shillowcollins6392
    @shillowcollins6392 10 месяцев назад +1

    Pls I want to purchase your book, do I need to purchase both vol1 and vol2, or the vol2 is the second edition of volume 1?

    • @Eigensteve
      @Eigensteve  10 месяцев назад

      No that is just the 2nd edition, so no need to buy both

  • @juancarlosesquivel7855
    @juancarlosesquivel7855 3 года назад

    Thanks for your amazing videos and book. I'm watching them all, and I hope they'll help me with a Kaggle competition on detection of gravitational waves from time series obtained by LIGO and Virgo.

  • @SP-ui6zn
    @SP-ui6zn 3 года назад

    Thank you Dr. Brunton.

  • @jaehoyoon7061
    @jaehoyoon7061 3 года назад +1

    You just made my day. THANKS :)

  • @Asparuh.Emilov
    @Asparuh.Emilov 3 года назад

    Thank you so much for those lectures! I love it! Is it actually possible to use Fourier series to create time series forecasting?

  • @vigneshrb1626
    @vigneshrb1626 3 года назад

    Great lecture prof but I have one doubt. How to compute the x axis of the plot for any given data

  • @babak5115
    @babak5115 3 года назад

    Thank you Dear Steve for your best job, how can I see this similar example in Python?

  • @midasredblade236
    @midasredblade236 Год назад

    Yes, THIS IS WHAT I WAS LOOKING FOR
    THANK YOU RUclips ALGORITHM

  • @タナカコウイチ-w3p
    @タナカコウイチ-w3p 4 года назад

    鏡文字書けるのすごいですね!(
    It's amazing to be able to write mirror writing!)

  • @hongluanosgeo
    @hongluanosgeo 3 года назад

    Thanks alot sir! I want to ask if the Fourier transformation adoptable to time-series data with trends?

  • @dudidahan8721
    @dudidahan8721 2 года назад

    WOW, thank you for sharing this video!

  • @monkeypoohonyou
    @monkeypoohonyou Год назад

    Amazing lecturer!

  • @pdirac
    @pdirac 3 года назад

    Brilliant. Just brilliant. Thanks

  • @MatthewHooper-kb4kq
    @MatthewHooper-kb4kq Год назад

    Great video - thank you, very helpful. Just curious to determine whether or not there is a way to computer a PSD minimum. You selected 100, but that was after observing the graphed data. Is there a statistical approach to computer this value?

    • @amiwk8291
      @amiwk8291 Год назад

      Just take PSD max and set a threshold of 90% of it to filter-out lower frequencies.

  • @yunfan7034
    @yunfan7034 2 года назад

    Hi
    Thank you for this tutorial.
    Do you know if it is a signal with phase/shift, how to inverse it?
    When calculating magnitude, we don't have phase info.
    Thank you

  • @siavashkazembakhshi8073
    @siavashkazembakhshi8073 4 года назад

    Hi Steve, Thank you for the video, I have two questions:
    1- Why did you plot only half of the data? I tried to plot the whole data but I got a diagram which did not make sense (my code: plt.plot(freq,PSD,color="c"))
    2- suppose that we have the Fhat vector, how can we exactly find the sin, cos coefficients, and the constant that have made up the signal?

    • @muhammadadeen3171
      @muhammadadeen3171 4 года назад

      The answer to first is that np.fft.fft gives you F^hat for both negative and positive frequencies. We are only interested in positive ones. So we plot half of the data.