Commit 7a225867 authored by Maximilian Schanner's avatar Maximilian Schanner
Browse files

Broke coeffs in previous commit, now fixed.

parent dc1c2454
......@@ -287,7 +287,7 @@ def coeffs(posterior, mu_coeffs, cov_coeffs, r_ref, r_at=REARTH):
gm_weights = posterior / posterior.sum()
ens = sample_GM(gm_weights.flatten(), mu_coeffs, cov_coeffs,
n_par_samps=1000, n_g_samps=1000)
n_samps=100000)
err_16, err_84 = np.percentile(ens, (16, 84), axis=1)
mean = (mu_coeffs.T * gm_weights.flatten()).sum(axis=1)
......@@ -304,8 +304,7 @@ def coeffs(posterior, mu_coeffs, cov_coeffs, r_ref, r_at=REARTH):
return np.array(ls), np.array(ms), mean, np.sqrt(var), err_16, err_84
def spectrum(posterior, mu_coeffs, cov_coeffs, r_ref, r_at=REARTH,
n_samps=100000):
def spectrum(posterior, mu_coeffs, cov_coeffs, r_ref, r_at=REARTH):
""" Calculate the power spectrum resulting from the mixture and find the
68% confidence-interval by sampling
......@@ -321,8 +320,6 @@ def spectrum(posterior, mu_coeffs, cov_coeffs, r_ref, r_at=REARTH,
The reference radius for the input coefficients
r_at : float (optional, default is REARTH)
The reference radius for the output coefficients
n_samps: int (optional, default is 100000)
The number of samples for the percentiles
Returns
-------
......@@ -342,7 +339,7 @@ def spectrum(posterior, mu_coeffs, cov_coeffs, r_ref, r_at=REARTH,
gm_weights = posterior / posterior.sum()
ens = sample_GM(gm_weights.flatten(), mu_coeffs, cov_coeffs,
n_samps=n_samps)
n_samps=100000)
# 1st two moments of mixture
mean = np.sum(mu_coeffs * gm_weights.flatten()[:, None], axis=0)
......
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