Commit a13aa0b9e3f59078e5e049c0f70974e7a465f78b

Authored by Jürgen Knödlseder
1 parent 57d8d1a8

Add HowTo for sky coordinate transformation.

Showing 1 changed file with 32 additions and 1 deletions
doc/source/howto/sky.rst
1   -Sky maps, sky coordinates and sky regions
  1 +Sky coordinates, sky maps and sky regions
2 2 -----------------------------------------
3 3  
  4 +How to convert a sky coordinate from celestial to Galactic?
  5 +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  6 +
  7 +To convert from celestial to Galactic coordinates you can set a sky
  8 +direction in celestial coordinates and read it back in Galactic
  9 +coordinates.
  10 +
  11 +Python:
  12 +
  13 +.. code-block:: python
  14 +
  15 + >>> import gammalib
  16 + >>> dir=gammalib.GSkyDir()
  17 + >>> dir.radec_deg(83.63,22.01)
  18 + >>> l=dir.l_deg()
  19 + >>> b=dir.b_deg()
  20 + >>> print(l,b)
  21 + (184.55973405309402, -5.7891829467816827)
  22 +
  23 +C++:
  24 +
  25 +.. code-block:: cpp
  26 +
  27 + #include "GammaLib.hpp"
  28 + GSkyDir dir;
  29 + dir.radec_deg(83.63,22.01);
  30 + double l = dir.l_deg();
  31 + double b = dir.b_deg();
  32 + std::cout << l << ", " << b << std::endl;
  33 +
  34 +
4 35 How to convert sky map projections?
5 36 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 37  
... ...