.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "_examples/07_tdip/plot_syscal_ip.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_07_tdip_plot_syscal_ip.py: Importing Syscal IP data ======================== .. GENERATED FROM PYTHON SOURCE LINES 8-10 .. code-block:: Python import reda .. GENERATED FROM PYTHON SOURCE LINES 11-12 a hack to prevent large loading times... .. GENERATED FROM PYTHON SOURCE LINES 12-27 .. code-block:: Python # import os # import pickle # pfile = 'ip.pickle' # if os.path.isfile(pfile): # with open(pfile, 'rb') as fid: # ip = pickle.load(fid) # else: # ip = reda.TDIP() # ip.import_syscal_bin('data_syscal_ip/data_normal.bin') # ip.import_syscal_bin( # 'data_syscal_ip/data_reciprocal.bin', reciprocals=48) # with open(pfile, 'wb') as fid: # pickle.dump(ip, fid) .. GENERATED FROM PYTHON SOURCE LINES 28-29 normal loading of tdip data .. GENERATED FROM PYTHON SOURCE LINES 29-44 .. code-block:: Python ip = reda.TDIP() # import pprofile # profiler = pprofile.Profile() # with profiler(): ip.import_syscal_bin('data_syscal_ip/data_normal.bin') # profile.print_stats() # exit() ip.import_syscal_bin('data_syscal_ip/data_reciprocal.bin', reciprocals=48) print(ip.data[['a', 'b', 'm', 'n', 'id', 'norrec']]) # import IPython # IPython.embed() # exit() .. rst-class:: sphx-glr-script-out .. code-block:: none a b m n id norrec 0 1 2 4 5 170 nor 1979 5 4 2 1 170 rec 1978 6 5 2 1 211 rec 1 1 2 5 6 211 nor 44 2 3 5 6 212 nor ... .. .. .. .. ... ... 986 42 43 47 48 1977 nor 988 43 44 47 48 1978 nor 991 48 47 44 43 1978 rec 990 48 47 45 44 1979 rec 989 44 45 47 48 1979 nor [1980 rows x 6 columns] .. GENERATED FROM PYTHON SOURCE LINES 46-53 .. code-block:: Python import reda.utils.geometric_factors as geomK K = geomK.compute_K_analytical(ip.data, spacing=0.25) geomK.apply_K(ip.data, K) import reda.utils.fix_sign_with_K as fixK ip.data = fixK.fix_sign_with_K(ip.data) .. GENERATED FROM PYTHON SOURCE LINES 54-56 plot a decay curve by specifying the index note that no file will be saved to disk if filename parameter is not provided .. GENERATED FROM PYTHON SOURCE LINES 56-59 .. code-block:: Python ip.plot_decay_curve(filename='decay_curve.png', index_nor=0, index_rec=1978, return_fig=True) .. image-sg:: /_examples/07_tdip/images/sphx_glr_plot_syscal_ip_001.png :alt: normed on current :srcset: /_examples/07_tdip/images/sphx_glr_plot_syscal_ip_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 60-62 you can also specify only one index this will only return a figure object, but will not save to file: .. GENERATED FROM PYTHON SOURCE LINES 62-65 .. code-block:: Python ip.plot_decay_curve(filename='decay_curve.png', index_nor=0, return_fig=True) .. image-sg:: /_examples/07_tdip/images/sphx_glr_plot_syscal_ip_002.png :alt: normed on current :srcset: /_examples/07_tdip/images/sphx_glr_plot_syscal_ip_002.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 66-67 it does not matter if you choose normal or reciprocal .. GENERATED FROM PYTHON SOURCE LINES 67-69 .. code-block:: Python ip.plot_decay_curve(index_rec=0, return_fig=True) .. image-sg:: /_examples/07_tdip/images/sphx_glr_plot_syscal_ip_003.png :alt: normed on current :srcset: /_examples/07_tdip/images/sphx_glr_plot_syscal_ip_003.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 70-71 plot a decay curve by specifying the index .. GENERATED FROM PYTHON SOURCE LINES 71-73 .. code-block:: Python ip.plot_decay_curve(nr_id=170, return_fig=True) .. image-sg:: /_examples/07_tdip/images/sphx_glr_plot_syscal_ip_004.png :alt: normed on current :srcset: /_examples/07_tdip/images/sphx_glr_plot_syscal_ip_004.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 74-77 a b m n 0 1 2 4 5 1978 5 4 2 1 .. GENERATED FROM PYTHON SOURCE LINES 77-79 .. code-block:: Python ip.plot_decay_curve(abmn=(1, 2, 5, 4), return_fig=True) .. image-sg:: /_examples/07_tdip/images/sphx_glr_plot_syscal_ip_005.png :alt: normed on current :srcset: /_examples/07_tdip/images/sphx_glr_plot_syscal_ip_005.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none
.. GENERATED FROM PYTHON SOURCE LINES 80-81 reciprocal is also ok .. GENERATED FROM PYTHON SOURCE LINES 81-82 .. code-block:: Python ip.plot_decay_curve(abmn=(4, 5, 2, 1), return_fig=True) .. image-sg:: /_examples/07_tdip/images/sphx_glr_plot_syscal_ip_006.png :alt: normed on current :srcset: /_examples/07_tdip/images/sphx_glr_plot_syscal_ip_006.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none
.. _sphx_glr_download__examples_07_tdip_plot_syscal_ip.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_syscal_ip.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_syscal_ip.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_