add .to_value
@@ -420,7 +420,6 @@ class SpectralModel(Model):
energies = []
for val in np.atleast_1d(value):
-
def f(x):
# scale by 1e12 to achieve better precision
energy = u.Quantity(x, eunit, copy=False)
@@ -1654,7 +1653,7 @@ class SpectralGaussian(SpectralModel):
u_min = (emin - pars["mean"].quantity) / (np.sqrt(2) * pars["sigma"].quantity)
u_max = (emax - pars["mean"].quantity) / (np.sqrt(2) * pars["sigma"].quantity)
- return pars["norm"].quantity / (2) * (erf(u_max) - erf(u_min))
+ return pars["norm"].quantity / (2) * (erf(u_max.to_value('')) - erf(u_min.to_value('')))
def energy_flux(self, emin, emax):
r"""Compute energy flux in given energy range analytically.
@@ -1677,6 +1676,6 @@ class SpectralGaussian(SpectralModel):
u_max = (emax - pars["mean"].quantity) / (np.sqrt(2) * pars["sigma"].quantity)
a = pars["norm"].quantity * pars["sigma"].quantity / np.sqrt(2 * np.pi)
b = pars["norm"].quantity * pars["mean"].quantity / 2
- return a * (np.exp(-u_min ** 2) - np.exp(-u_max ** 2)) + b * (
+ return a * (np.exp(-u_min.to_value('') ** 2) - np.exp(-u_max.to_value('') ** 2)) + b * (
erf(u_max) - erf(u_min)
)
