.. DO NOT EDIT. .. THIS FILE WAS AUTOMATICALLY GENERATED BY SPHINX-GALLERY. .. TO MAKE CHANGES, EDIT THE SOURCE PYTHON FILE: .. "auto_examples/plot_benchmarks.py" .. LINE NUMBERS ARE GIVEN BELOW. .. only:: html .. note:: :class: sphx-glr-download-link-note Click :ref:`here ` to download the full example code .. rst-class:: sphx-glr-example-title .. _sphx_glr_auto_examples_plot_benchmarks.py: ====================================================== Benchmark Calculations for Coordinates Transformations ====================================================== Run some benchmarks similar to `http://antares.in2p3.fr/internal/dokuwiki/doku.php?id=benchmarks_astro` CAVEAT: IceCube and ANTARES/KM3NeT define "azimuth" differently: ``true_azimuth = (90 - azimuth) % 360``! .. GENERATED FROM PYTHON SOURCE LINES 15-90 .. code-block:: default # Author: Moritz Lotze # License: BSD-3 from collections import OrderedDict import numpy as np import pandas as pd from km3astro.coord import local_event, local_frame, neutrino_to_source_direction from km3astro.sources import SIRIUS, CANOPUS, ARCTURUS, ANTARES # noqa time = pd.to_datetime( [ "2007-10-04 03:03:03.00", "2007-10-04 03:03:03.00", "2007-10-04 03:03:03.00", "2007-10-04 03:03:03.00", "2007-10-04 03:03:03.00", ] ) theta_deg = np.array( [ 135.00, 11.97, 22.97, 33.97, 85.23, ] ) phi_deg = np.array( [ 97.07, 23.46, 97.07, 192.50, 333.33, ] ) theta = theta_deg * np.pi / 180 phi = phi_deg * np.pi / 180 azimuth, zenith = neutrino_to_source_direction(phi, theta) evt = local_event(theta, phi, time, location="antares") equat = evt.fk5 # dec = equat.dec.degree # ra = equat.ra.degree dec = equat.dec ra = equat.ra gal = evt.galactic l = gal.l b = gal.b data = pd.DataFrame( OrderedDict( [ ("time", time), ("theta [deg]", theta_deg), ("phi [deg]", phi_deg), ("theta", theta), ("phi", phi), ("zenith [deg]", zenith * 180 / np.pi), ("azimuth [deg]", azimuth * 180 / np.pi), ("zenith", zenith), ("azimuth", azimuth), ("declication", dec), ("right ascension", ra), ("gal_longitude", l), ("gal_latitude", b), ] ) ) print(data[:]) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none time theta [deg] ... gal_longitude gal_latitude 0 2007-10-04 03:03:03 135.00 ... 198.699744 -29.302666 1 2007-10-04 03:03:03 11.97 ... 342.250128 -5.601607 2 2007-10-04 03:03:03 22.97 ... 319.675397 -8.128101 3 2007-10-04 03:03:03 33.97 ... 317.713718 33.846205 4 2007-10-04 03:03:03 85.23 ... 61.085513 -18.955876 [5 rows x 13 columns] .. GENERATED FROM PYTHON SOURCE LINES 91-92 look at some sources in horizontal coordinates .. GENERATED FROM PYTHON SOURCE LINES 92-116 .. code-block:: default frame = local_frame( time=pd.to_datetime( [ "2007-10-04 03:03:03.00", ] ), location="antares", ) sirius_local = SIRIUS.transform_to(frame) sirius_alt = sirius_local.alt.degree sirius_az = sirius_local.az.degree sirius_zen = 90 - sirius_alt print() print(sirius_az) print(sirius_zen) canopus_local = CANOPUS.transform_to(frame) canopus_alt = canopus_local.alt.degree canopus_az = canopus_local.az.degree canopus_zen = 90 - canopus_alt print() print(canopus_az) print(canopus_zen) .. rst-class:: sphx-glr-script-out Out: .. code-block:: none [141.72305615] [68.55146457] [161.18692368] [99.31872121] .. rst-class:: sphx-glr-timing **Total running time of the script:** ( 0 minutes 0.051 seconds) .. _sphx_glr_download_auto_examples_plot_benchmarks.py: .. only :: html .. container:: sphx-glr-footer :class: sphx-glr-footer-example .. container:: sphx-glr-download sphx-glr-download-python :download:`Download Python source code: plot_benchmarks.py ` .. container:: sphx-glr-download sphx-glr-download-jupyter :download:`Download Jupyter notebook: plot_benchmarks.ipynb ` .. only:: html .. rst-class:: sphx-glr-signature `Gallery generated by Sphinx-Gallery `_