ascendants
ascendants

Reputation: 2381

Precision of AstroPy distance redshift conversion

How accurate is the redshift conversion of AstroPy.coordinates.Distance function?

It appears to be useful only to the thousandths digit (much less precise than floating point number precision issues):

from astropy import units as u
from astropy.coordinates import SkyCoord, Distance
from astropy.cosmology import Planck15

z1 = 0.05598
z2 = 0.31427

dist1 = Distance(unit=u.pc, z = z1, cosmology = Planck15)
dist2 = Distance(unit=u.pc, z = z2, cosmology = Planck15)

dist1.z    #prints 0.05718
dist2.z    #prints 0.31916

I am using this to compute 3D distances between extragalactic sources, and these discrepancies are on the order of Mpc, which is very large for what I am studying. Is this an unavoidable limitation of AstroPy?

Upvotes: 2

Views: 913

Answers (1)

user11563547
user11563547

Reputation:

This works in astropy 3.2.1 for python 3.7.

from astropy import units as u
from astropy.coordinates import SkyCoord, Distance
from astropy.cosmology import Planck15

z1 = 0.05598
z2 = 0.31427

dist1 = Distance(unit=u.pc, z = z1, cosmology = Planck15)
dist2 = Distance(unit=u.pc, z = z2, cosmology = Planck15)

dist1.z
Out[9]: 0.055979999974738834

dist2.z
Out[10]: 0.31427000077974493

It looks like the calculation has precision to the around 7 significant digits.

z3 = 1.31427987654321

dist3 = Distance(unit=u.pc, z = z3, cosmology = Planck15)

dist3.z
Out[23]: 1.3142798808605372

z4 = 900.31427987654321

dist4 = Distance(unit=u.pc, z = z4, cosmology = Planck15)

dist4.z
Out[29]: 900.3142861453044

Somewhere close to z=1000 this will return an error saying the value is maxed out, since at that point you're getting close to CMB territory.

Upvotes: 2

Related Questions