.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples\cartesian_to_spherical.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_cartesian_to_spherical.py: Cartesian to Spherical Conversion Example =============================== Convert Cartesian coordinates to spherical coordinates (theta, phi). .. GENERATED FROM PYTHON SOURCE LINES 7-23 .. rst-class:: sphx-glr-script-out .. code-block:: none Input Cartesian points: [[ 0.57735027 0.57735027 0.57735027] [-0.57735027 0.57735027 -0.57735027]] Output spherical coordinates (theta, phi): [[0.95531662 0.78539816] [2.18627604 2.35619449]] | .. code-block:: Python import numpy as np from spheresmooth import cartesian_to_spherical # Example 1 data cartesian_points1 = np.array([ [1/np.sqrt(3), 1/np.sqrt(3), 1/np.sqrt(3)], [-1/np.sqrt(3), 1/np.sqrt(3), -1/np.sqrt(3)], ]) print("Input Cartesian points:") print(cartesian_points1) theta_phi = cartesian_to_spherical(cartesian_points1) print("\nOutput spherical coordinates (theta, phi):") print(theta_phi) .. rst-class:: sphx-glr-timing **Total running time of the script:** (0 minutes 0.001 seconds) .. _sphx_glr_download_auto_examples_cartesian_to_spherical.py: .. only:: html .. container:: sphx-glr-footer sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: cartesian_to_spherical.ipynb ` .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: cartesian_to_spherical.py ` .. container:: sphx-glr-download sphx-glr-download-zip :download:`Download zipped: cartesian_to_spherical.zip ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_