Skip to content

Commit

Permalink
vectorisation problem with astropy units
Browse files Browse the repository at this point in the history
  • Loading branch information
sambit-giri committed Dec 16, 2024
1 parent 2faefed commit 0e1a683
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/AstronomyCalc/cosmo_equations.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,11 +70,11 @@ def Hubble_dist(self):

def _comoving_dist(self, z):
I = lambda z: const.c/self.H(z=z)
return (quad(lambda x: I(x).value, 0, z)[0]*I(0).unit).to('Mpc') # Mpc
return (quad(lambda x: I(x).value, 0, z)[0]*I(0).unit).to('Mpc').value # Mpc

def comoving_dist(self, z=None, a=None):
if a is not None: z = a_to_z(a)
return np.vectorize(self._comoving_dist)(z)
return np.vectorize(self._comoving_dist)(z)*u.Mpc

def proper_dist(self, z=None, a=None):
dc = self.comoving_dist(z=z, a=a)
Expand Down

0 comments on commit 0e1a683

Please sign in to comment.