Advertisement
Guest User

Untitled

a guest
Apr 28th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. def comovingDistance(self, z_min = 0.0, z_max = 0.0):
  2. """
  3. The comoving distance between redshift :math:`z_{min}` and :math:`z_{max}`.
  4.  
  5. Either z_min or z_min can be a numpy array; in those cases, the same z_min / z_max is
  6. applied to all values of the other. If both are numpy arrays, they need to have
  7. the same dimensions, and the comoving distance returned corresponds to a series of
  8. different z_min and z_max values.
  9.  
  10. Parameters
  11. -------------------------------------------------------------------------------------------
  12. zmin: array_like
  13. Redshift; can be a number or a numpy array.
  14. zmax: array_like
  15. Redshift; can be a number or a numpy array.
  16.  
  17. Returns
  18. -------------------------------------------------------------------------------------------
  19. d: array_like
  20. The comoving distance in Mpc/h; has the same dimensions as zmin and/or zmax.
  21.  
  22. See also
  23. -------------------------------------------------------------------------------------------
  24. luminosityDistance: The luminosity distance to redshift z.
  25. angularDiameterDistance: The angular diameter distance to redshift z.
  26. """
  27.  
  28. d = self._integral_oneOverEz(z_min = z_min, z_max = z_max)
  29.  
  30. if self.Ok0 > 0.:
  31. sqrtOk0 = np.sqrt(self.Ok0)
  32. d = np.sinh(sqrtOk0*d) / sqrtOk0
  33. elif self.Ok0 < 0:
  34. sqrtOk0 = np.sqrt(-self.Ok0)
  35. d = np.sin(sqrtOk0*d)/sqrtOk0
  36.  
  37. d *= constants.C * 1E-7
  38.  
  39. return d
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement