.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_examples/01_modelling/plot_02_anomalies.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. .. rst-class:: sphx-glr-example-title .. _sphx_glr__examples_01_modelling_plot_02_anomalies.py: Generate Gaussian Models ^^^^^^^^^^^^^^^^^^^^^^^^ .. GENERATED FROM PYTHON SOURCE LINES 9-10 imports .. GENERATED FROM PYTHON SOURCE LINES 10-12 .. code-block:: Python import crtomo import matplotlib.pylab as plt .. GENERATED FROM PYTHON SOURCE LINES 13-14 we need a tomodir object .. GENERATED FROM PYTHON SOURCE LINES 14-21 .. code-block:: Python grid = crtomo.crt_grid( 'grid_anomalies/elem.dat', 'grid_anomalies/elec.dat', # 'grid_surface/elem.dat', 'grid_surface/elec.dat' ) tdm = crtomo.tdMan(grid=grid) .. rst-class:: sphx-glr-script-out .. code-block:: none This grid was sorted using CutMcK. The nodes were resorted! Triangular grid found .. GENERATED FROM PYTHON SOURCE LINES 22-23 Create a cos(x)cos(y) anomaly .. GENERATED FROM PYTHON SOURCE LINES 23-152 .. code-block:: Python fig, axes = plt.subplots( 3, 1, sharex=True, figsize=(12 / 2.54, 13 / 2.54), ) ax = axes[0] pid_rmag, rpha = tdm.add_homogeneous_model(100, 0) p0 = [2.0, -2.5] anomaly_width = 1 anomaly_height = 1 peak_value = 10 tdm.parman.add_2d_cos_anomaly_line( pid_rmag, p0=[2, -0.5], anomaly_width=1, anomaly_height=1, peak_value=10, area='only_one_x', ) tdm.plot.plot_elements_to_ax( pid_rmag, ax=ax, plot_colorbar=True, cmap_name='jet', ) ax.set_title('One vertical anomaly line', loc='left', fontsize=8) ax = axes[1] pid_rmag, rpha = tdm.add_homogeneous_model(100, 0) p0 = [2.0, -2.5] anomaly_width = 1 anomaly_height = 1 peak_value = 10 tdm.parman.add_2d_cos_anomaly_line( pid_rmag, p0=[2, -0.5], anomaly_width=1, anomaly_height=1, peak_value=10, area='all', ) tdm.plot.plot_elements_to_ax( pid_rmag, ax=ax, plot_colorbar=True, cmap_name='jet', ) ax.set_title( 'Anomaly patterns applied to the whole area', loc='left', fontsize=8) ax = axes[2] pid_rmag, rpha = tdm.add_homogeneous_model(100, 0) p0 = [2.0, -2.5] anomaly_width = 1 anomaly_height = 1 peak_value = 10 tdm.parman.add_2d_cos_anomaly_line( pid_rmag, p0=[0, -0.5], anomaly_width=1, anomaly_height=1, peak_value=10, area='only_one_y', ) tdm.parman.add_2d_cos_anomaly_line( pid_rmag, p0=[0.5, -1.5], anomaly_width=1, anomaly_height=1, peak_value=10, ) tdm.parman.add_2d_cos_anomaly_line( pid_rmag, p0=[1.0, -2.5], anomaly_width=1, anomaly_height=1, peak_value=10, ) tdm.parman.add_2d_cos_anomaly_line( pid_rmag, p0=[1.5, -3.5], anomaly_width=1, anomaly_height=1, peak_value=10, ) tdm.parman.add_2d_cos_anomaly_line( pid_rmag, p0=[2.0, -4.5], anomaly_width=1, anomaly_height=1, peak_value=10, ) # tdm.parman.add_checkerboard_pattern( # pid_rmag, # [0, -0.5], # 1, # 1, # 10, # ) tdm.plot.plot_elements_to_ax( pid_rmag, ax=ax, plot_colorbar=True, cmap_name='jet', ) ax.set_title('Multiple shifted horizontal lines', loc='left', fontsize=8) axes[0].set_xlabel('') axes[1].set_xlabel('') fig.tight_layout() fig.savefig('out_cos.jpg', dpi=300) # fig, ax = plt.subplots() # tdm.grid.plot_grid_to_ax(ax) .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_02_anomalies_001.png :alt: One vertical anomaly line, Anomaly patterns applied to the whole area, Multiple shifted horizontal lines :srcset: /_examples/01_modelling/images/sphx_glr_plot_02_anomalies_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none model already set, will overwrite model already set, will overwrite .. GENERATED FROM PYTHON SOURCE LINES 153-154 create a new parameter set with one anomaly .. GENERATED FROM PYTHON SOURCE LINES 154-170 .. code-block:: Python pid = tdm.parman.create_parset_with_gaussian_anomaly( [4, -2], max_value=100, width=1, background=10, ) fig, ax = plt.subplots() tdm.plot.plot_elements_to_ax( pid, ax=ax, plot_colorbar=True, cbmin=10, cbmax=120, ) .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_02_anomalies_002.png :alt: plot 02 anomalies :srcset: /_examples/01_modelling/images/sphx_glr_plot_02_anomalies_002.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 171-172 create another new parameter set with one anomaly .. GENERATED FROM PYTHON SOURCE LINES 172-186 .. code-block:: Python pid = tdm.parman.create_parset_with_gaussian_anomaly( [4, -2], max_value=100, width=3, background=10, ) fig, ax = plt.subplots() tdm.plot.plot_elements_to_ax( pid, ax=ax, plot_colorbar=True, ) .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_02_anomalies_003.png :alt: plot 02 anomalies :srcset: /_examples/01_modelling/images/sphx_glr_plot_02_anomalies_003.png :class: sphx-glr-single-img .. GENERATED FROM PYTHON SOURCE LINES 187-188 add an additional anomaly to this parset .. GENERATED FROM PYTHON SOURCE LINES 188-203 .. code-block:: Python tdm.parman.add_gaussian_anomaly_to_parset( pid, [8, -3], width=[0.5, 2], max_value=50, ) fig, ax = plt.subplots() tdm.plot.plot_elements_to_ax( pid, ax=ax, plot_colorbar=True, ) # sphinx_gallery_thumbnail_number = 2 .. image-sg:: /_examples/01_modelling/images/sphx_glr_plot_02_anomalies_004.png :alt: plot 02 anomalies :srcset: /_examples/01_modelling/images/sphx_glr_plot_02_anomalies_004.png :class: sphx-glr-single-img .. _sphx_glr_download__examples_01_modelling_plot_02_anomalies.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_02_anomalies.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_02_anomalies.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: plot_02_anomalies.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_