.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_sparsecone.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_auto_examples_plot_sparsecone.py: ==== Cone ==== Sparse Cone .. GENERATED FROM PYTHON SOURCE LINES 10-31 .. code-block:: Python import numpy as np import matplotlib.pyplot as plt from mpl_toolkits.mplot3d import Axes3D # noqa from km3pipe.math import SparseCone import km3pipe.style km3pipe.style.use("moritz") spike = [0, 0, 1] bottom = [0, 0, 0] angle = np.pi / 4 n_angles = 20 cone = SparseCone(spike, bottom, angle) circ_samp = cone.sample_circle(n_angles=n_angles) axis_samp = cone.sample_axis samp = cone.sample(n_angles) samp = np.array(samp) .. GENERATED FROM PYTHON SOURCE LINES 32-33 plot the same in 3D because why not? .. GENERATED FROM PYTHON SOURCE LINES 33-37 .. code-block:: Python fig = plt.figure() ax = plt.axes(projection="3d") ax.scatter(samp[:, 0], samp[:, 1], samp[:, 2], "yo") .. image-sg:: /auto_examples/images/sphx_glr_plot_sparsecone_001.png :alt: plot sparsecone :srcset: /auto_examples/images/sphx_glr_plot_sparsecone_001.png :class: sphx-glr-single-img .. rst-class:: sphx-glr-script-out .. code-block:: none .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.175 seconds) .. _sphx_glr_download_auto_examples_plot_sparsecone.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_sparsecone.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_sparsecone.py ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_