

.. _sphx_glr_auto_examples_plot_zt.py:


==================
zt-plots.
==================

This example shows how to create a zt-plot of a given DU and event ID.




.. image:: /auto_examples/images/sphx_glr_plot_zt_001.png
    :align: center





.. code-block:: python


    import pandas as pd
    import matplotlib.pyplot as plt
    import km3pipe as kp
    import km3pipe.style
    km3pipe.style.use('default')


    DU = 26
    EVENT_ID = 23
    filename = "data/km3net_jul13_90m_muatm50T655.km3_v5r1.JTE_r2356.root.0-499.h5"
    geometry = kp.Geometry(filename="data/km3net_jul13_90m_r1494_corrected.detx")

    all_hits = pd.read_hdf(filename, 'hits')
    hits = all_hits[all_hits.event_id == EVENT_ID].copy()
    geometry.apply(hits)

    fig, ax = plt.subplots()

    hits[hits['du'] == DU].plot('time', 'pos_z', style='.', ax=ax)
    triggered_hits = hits[(hits['du'] == DU) & (hits['triggered'] == True)]
    triggered_hits.plot('time', 'pos_z', style='.', ax=ax)

    try:
        ax.legend_.remove()
    except AttributeError:
        pass
    ax.set_title("zt-plot of event {0} on DU{1}".format(EVENT_ID, DU))
    ax.set_xlabel("time [ns]")
    ax.set_ylabel("z [m]")

**Total running time of the script:**
(0 minutes 4.253 seconds)



.. container:: sphx-glr-download

    **Download Python source code:** :download:`plot_zt.py <plot_zt.py>`


.. container:: sphx-glr-download

    **Download IPython notebook:** :download:`plot_zt.ipynb <plot_zt.ipynb>`

.. rst-class:: sphx-glr-signature

    `Generated by Sphinx-Gallery <http://sphinx-gallery.readthedocs.io>`_
