cristobal-sifon / profiley

Profile calculations for galaxies and clusters
MIT License
5 stars 2 forks source link

density fails with 2d parameter set #10

Closed cristobal-sifon closed 4 years ago

cristobal-sifon commented 4 years ago
m = np.logspace(14, 15, 3)
c = np.array([2,3])[:,None]
z = 0.5

nfw = NFW(m, c, z, overdensity=500, background='c')
R = np.logspace(-1, 0, 10)
rho = nfw.density(R)
rho.shape

output:

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-37-b740097f72d4> in <module>
      1 nfw = NFW(m, c, z, overdensity=500, background='c')
      2 R = np.logspace(-1, 0, 10)
----> 3 rho = nfw.density(R)
      4 rho.shape

~/anaconda3/envs/cmb/lib/python3.8/site-packages/profiley-1.1.0b4-py3.8.egg/profiley/helpers/decorators/base.py in decorated(*args, **kwargs)
     24             args = list(args)
     25             args[1] = args[1].to(u.Mpc).value
---> 26         return f(*args, **kwargs)
     27     return decorated
     28 

~/anaconda3/envs/cmb/lib/python3.8/site-packages/profiley-1.1.0b4-py3.8.egg/profiley/helpers/decorators/base.py in decorated(*args, **kwargs)
     13         if len(args[1].shape) == 1:
     14             args[1] = np.expand_dims(args[1], -1)
---> 15         return f(*args, **kwargs)
     16     return decorated
     17 

~/anaconda3/envs/cmb/lib/python3.8/site-packages/profiley-1.1.0b4-py3.8.egg/profiley/nfw.py in density(self, r)
    140     def density(self, r):
    141         """Three-dimensional density profile"""
--> 142         return self.delta_c * self.rho_bg / (r/self.rs * (1+r/self.rs)**2)
    143 
    144     @inMpc

ValueError: operands could not be broadcast together with shapes (10,1) (2,3)