[AstroPy] missing distance in galactic coordinates from catalog

Eric Jensen ejensen1 at swarthmore.edu
Mon Feb 3 20:09:44 EST 2020


Hi Rodrigo, 

> On Feb 3, 2020, at 5:26 PM, Rodrigo Amestica <ramestica at gmail.com> wrote:
> 
> My reading of your reply is that there is no bullet-proof recipe to query
> for the distance to an object. For that sort of information one needs to
> know very well how the value is to be used and, eventually, consult papers
> like the one linked before; that is, not as simple as just querying a
> catalog.

It is certainly true that there is no single method for finding the distance to an object.  However, many objects have distance measurements available in Simbad, so depending on your needs, you might be able to use those distances.   You can access Simbad information using astroquery. 

However, you have to deal with the fact that Simbad may return no information for a given source, so the relevant field in the returned table will be masked.  Here’s an example, building on your original code, that shows how this is used.  I’ve added two other objects to your list to show the kinds of results you get (since none of your original objects returns a distance): 

from astropy.coordinates import SkyCoord
from astroquery.simbad import Simbad

# Add to the default field returned by Simbad:
Simbad.add_votable_fields('plx', 'distance’)    

for i in ['Galactic Center', 'Cygnus A', 'Eta Carinae', 'T Tau', 'M13']:
    c = SkyCoord.from_name(i)
    g = c.galactic
    print("\n", i)
    print("  Galactic coords l={:0.3f}, b={:0.3f}".format(g.l.degree, g.b.degree))
    sim = Simbad.query_object(i)
    # Prefer the parallax distance if available: 
    if not sim['PLX_VALUE'].mask[0]:
        # Parallax distance: 
        print("  Parallax distance is {:0.1f} pc.".format(1000./sim['PLX_VALUE'][0]))
    # but if no parallax we'll take any other distance: 
    elif not sim['Distance_distance'].mask[0]:
        print("  Distance from reference {} is {} {}.".format(sim['Distance_bibcode'][0], 
                                                       sim['Distance_distance'][0], 
                                                       sim['Distance_unit'][0]))
    else: 
        print("  No distance available in Simbad.")

This returns the following output: 

 Galactic Center
  Galactic coords l=359.944, b=-0.046
  No distance available in Simbad.

 Cygnus A
  Galactic coords l=76.190, b=5.755
  No distance available in Simbad.

 Eta Carinae
  Galactic coords l=287.597, b=-0.630
  No distance available in Simbad.

 T Tau
  Galactic coords l=176.230, b=-20.887
  Parallax distance is 144.3 pc.

 M13
  Galactic coords l=59.009, b=40.912
  Distance from reference 2008MNRAS.389.1924F is 0.008 Mpc.

Hope this helps, 


Eric


P.S.  As an aside, I’ll note that the first item shows nicely the fact that the Galactic Coordinate system was defined in 1958, but measurements of the position of Sgr A* have continued to improve, so it is not actually located at 0, 0 in Galactic coords despite being our best marker of the Galactic Center. 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/astropy/attachments/20200203/20d713ad/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 3952 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/astropy/attachments/20200203/20d713ad/attachment-0001.bin>


More information about the AstroPy mailing list