1- Retrieving the coordinates of the star gam Cas

1.1 - Using Astropy - Coordinates

import of the Astropy library's coordinates management module

In [5]:
#!pip install astropy
from astropy.coordinates import SkyCoord

A SkyCoords object represents an ICRS position (Right ascension [RA], Declination [Dec]) in the sky.

It is thus possible to retrieve the position of our target, by calling the from_name method which takes the name of the object as a parameter, then we display its value .

In [6]:
from astropy.coordinates import SkyCoord

gam_cas_coords = SkyCoord.from_name("HD5394")
print(f"Objet SkyCoords : {gam_cas_coords}")
Objet SkyCoords : <SkyCoord (ICRS): (ra, dec) in deg
    (14.17721542, 60.71674028)>

From this variable, which is a SkyCoord object, it is possible to access the separate values for right ascent and declination. Depending on the methods used, different data formats and fineness are accessible.

In [7]:
print(f" - Position RA/DEC (hms & dms / ep=J2000): {gam_cas_coords.to_string('hmsdms')}")
print(f" - Position RA et DEC - Détail (ep=J2000) : {gam_cas_coords.ra.hms, gam_cas_coords.dec.dms}")
print(f" - RA (min) : {gam_cas_coords.ra.hms.m}")
 - Position RA/DEC (hms & dms / ep=J2000): 00h56m42.5317s +60d43m00.265s
 - Position RA et DEC - Détail (ep=J2000) : (hms_tuple(h=0.0, m=56.0, s=42.53170080000075), dms_tuple(d=60.0, m=43.0, s=0.26500800001201696))
 - RA (min) : 56.0

In the other direction, we can also create a SkyCoord object from the known coordinates and their format.

In [5]:
from astropy import units as u
c = SkyCoord(14.184, 60.7249, frame='icrs', unit='deg')
c = SkyCoord('00h56m44.16s', '+60d43m29.64s', frame='icrs')
c = SkyCoord('00 56 44.16 +60 43 29.64', unit=(u.hourangle, u.deg))
<SkyCoord (ICRS): (ra, dec) in deg
    (14.184, 60.7249)>