Commit a9ffc36a authored by Yannick Roehlly's avatar Yannick Roehlly

Adpat pcigale.sed.utils for astropy v0.3

astropy v0.3 cosmology methods now returns quantities. We keep only the
value to avoid problems in numpy computations.
parent 926c9325
......@@ -94,7 +94,15 @@ def luminosity_to_flux(luminosity, redshift=0):
else:
dist = cosmology.luminosity_distance(redshift) * 1.e6 * parsec
return luminosity / (4 * pi * np.square(dist))
flux = luminosity / (4 * pi * np.square(dist))
# astropy 0.3 cosmology functions return quantities
try:
result = flux.value
except AttributeError:
result = flux
return result
def lambda_flambda_to_fnu(wavelength, flambda):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment