.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "glr_examples/methods/plot_noise_removal.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note :ref:`Go to the end ` to download the full example code or to run this example in your browser via Binder .. rst-class:: sphx-glr-example-title .. _sphx_glr_glr_examples_methods_plot_noise_removal.py: ================================= Remove noises ================================= Filtered data to remove outliers, artifacts and existing noises in AMT data .. GENERATED FROM PYTHON SOURCE LINES 9-12 .. code-block:: Python # Author: L.Kouadio # Licence: BSD-3-clause .. GENERATED FROM PYTHON SOURCE LINES 13-14 Import required modules .. GENERATED FROM PYTHON SOURCE LINES 14-18 .. code-block:: Python import matplotlib.pyplot as plt import watex as wx from watex.methods.em import EMAP, filter_noises .. GENERATED FROM PYTHON SOURCE LINES 19-22 Fetch EDI data for the tests and load EM EDI objects using the Processing class. The demonstration will focus on the first station ``S00`` .. GENERATED FROM PYTHON SOURCE LINES 22-25 .. code-block:: Python edi_data = wx.fetch_data ('edis', samples =25 , return_data =True ) p= EMAP ( ).fit(edi_data) .. GENERATED FROM PYTHON SOURCE LINES 26-28 Print print seven values of resistivity and phase of the first station .. GENERATED FROM PYTHON SOURCE LINES 28-35 .. code-block:: Python station_index =4 print(p.ediObjs_[station_index].Z.resistivity[:, 0, 1][:7]) # resistivity # phase print(p.ediObjs_[station_index].Z.phase[:, 0, 1][:7]) # phase # Impedance values print(p.ediObjs_[station_index].Z.z[:, 0, 1][:7]) # impedance tensor .. rst-class:: sphx-glr-script-out .. code-block:: none [ 810.3093 1961.8073 3286.6644 4534.5832 4894.6956 3744.1404 2527.8144] [34.1924 35.7665 34.2575 32.2367 33.6213 31.8762 29.0344] [12766.91 +8673.923j 18348.04+13216.7j 22777.28+15512.85j 25780.15+16257.67j 24827.42+16508.58j 20849.86+12965.86j 16608.03 +9219.031j] .. GENERATED FROM PYTHON SOURCE LINES 36-40 Compute resistivity and phase from filters * base smooth filter with `method` set to ``base`` ( default) * Torres-Verdin filter with `method` set to ``tv`` * Adaptive moving average filter with `method` set to ``ama` .. GENERATED FROM PYTHON SOURCE LINES 40-48 .. code-block:: Python res_b, phase_b = filter_noises ( p, component='xy', return_z= False, ) res_t, phase_t = filter_noises ( p, component='xy', return_z= False, method ='torres') res_a, phase_a = filter_noises ( p, component='xy', return_z= False, method ='ama') .. GENERATED FROM PYTHON SOURCE LINES 49-50 Plot filtered data at station S00 .. GENERATED FROM PYTHON SOURCE LINES 50-80 .. code-block:: Python fig, ax = plt.subplots(2,1, figsize =(10, 6)) ax[0].plot(p.freqs_, p.ediObjs_[station_index].Z.resistivity[:, 0, 1], 'b-', label='Original Data') ax[0].plot(p.freqs_, res_b[:, station_index], '-ok', label='Smoothed Resistivity') ax[0].plot(p.freqs_, res_t[:, station_index], '-sg', label='Torres-Verdin Resistivity') ax[0].plot(p.freqs_, res_a[:, station_index], '-vr', label='AMA Resistivity ') ax[0].set_xlabel('Frequency (Hz)') ax[0].set_ylabel('Resistivity( $\Omega$.m)') ax[0].set_title(f'Filtered data at Station S{station_index}') ax[0].set_yscale ('log') ax[0].set_xscale ('log') ax[0].legend() ax[0].grid(True) ax[1].plot(p.freqs_, p.ediObjs_[station_index].Z.phase[:, 0, 1], 'b-', label='Original Phase Data') ax[1].plot(p.freqs_, phase_b[:, station_index], '-ok', label='Smoothed Phase') ax[1].plot(p.freqs_, phase_t[:, station_index], '-sg', label='Torres-Verdin phase') ax[1].plot(p.freqs_, phase_a[:, station_index], '-vr', label='AMA phase') ax[1].set_xlabel('Frequency (Hz)') ax[1].set_ylabel('phase( degrees)') ax[1].set_xscale ('log') ax[1].legend() ax[1].grid(True) plt.show() .. image-sg:: /glr_examples/methods/images/sphx_glr_plot_noise_removal_001.png :alt: Filtered data at Station S4 :srcset: /glr_examples/methods/images/sphx_glr_plot_noise_removal_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.587 seconds) .. _sphx_glr_download_glr_examples_methods_plot_noise_removal.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: binder-badge .. image:: images/binder_badge_logo.svg :target: https://mybinder.org/v2/gh/watex/watex/0.3.X?urlpath=lab/tree/notebooks/glr_examples/methods/plot_noise_removal.ipynb :alt: Launch binder :width: 150 px .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_noise_removal.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_noise_removal.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_